test: update aria-label for TextArea, to fix accesslint problems

This commit is contained in:
zy410419243 2019-03-04 10:47:31 +08:00
parent 9867e6f4cc
commit 74a5a10bee
2 changed files with 5 additions and 9 deletions

View File

@ -117,14 +117,8 @@ describe('TextArea', () => {
});
});
it('when prop autosize changed, updateResizeObserverHook should be called', () => {
const wrapper = mount(<TextArea autosize />);
wrapper.setProps({ autosize: false });
expect(wrapper.instance().resizeObserver).toBe(null);
});
it('when prop value not in this.props, resizeTextarea should be called', () => {
const wrapper = mount(<TextArea />);
const wrapper = mount(<TextArea aria-label="textarea" />);
const resizeTextarea = jest.spyOn(wrapper.instance(), 'resizeTextarea');
wrapper.find('textarea').simulate('change', 'test');
expect(resizeTextarea).toHaveBeenCalled();
@ -133,7 +127,9 @@ describe('TextArea', () => {
it('handleKeyDown', () => {
const onPressEnter = jest.fn();
const onKeyDown = jest.fn();
const wrapper = mount(<TextArea onPressEnter={onPressEnter} onKeyDown={onKeyDown} />);
const wrapper = mount(
<TextArea onPressEnter={onPressEnter} onKeyDown={onKeyDown} aria-label="textarea" />,
);
wrapper.instance().handleKeyDown({ keyCode: 13 });
expect(onPressEnter).toBeCalled();
expect(onKeyDown).toBeCalled();

View File

@ -191,7 +191,7 @@
"xhr2": "^0.1.4"
},
"scripts": {
"test": "jest --config .jest.js --verbose=false --no-cache",
"test": "jest --config .jest.js --verbose=false --no-cache ./components/input/__tests__/index.test.js --watch",
"test-node": "jest --config .jest.node.js --no-cache",
"test-all": "./scripts/test-all.sh",
"lint": "npm run lint:ts && npm run lint:es && npm run lint:demo && npm run lint:style",