mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
test: update aria-label for TextArea, to fix accesslint problems
This commit is contained in:
parent
9867e6f4cc
commit
74a5a10bee
@ -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();
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user