mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +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', () => {
|
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');
|
const resizeTextarea = jest.spyOn(wrapper.instance(), 'resizeTextarea');
|
||||||
wrapper.find('textarea').simulate('change', 'test');
|
wrapper.find('textarea').simulate('change', 'test');
|
||||||
expect(resizeTextarea).toHaveBeenCalled();
|
expect(resizeTextarea).toHaveBeenCalled();
|
||||||
@ -133,7 +127,9 @@ describe('TextArea', () => {
|
|||||||
it('handleKeyDown', () => {
|
it('handleKeyDown', () => {
|
||||||
const onPressEnter = jest.fn();
|
const onPressEnter = jest.fn();
|
||||||
const onKeyDown = 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 });
|
wrapper.instance().handleKeyDown({ keyCode: 13 });
|
||||||
expect(onPressEnter).toBeCalled();
|
expect(onPressEnter).toBeCalled();
|
||||||
expect(onKeyDown).toBeCalled();
|
expect(onKeyDown).toBeCalled();
|
||||||
|
@ -191,7 +191,7 @@
|
|||||||
"xhr2": "^0.1.4"
|
"xhr2": "^0.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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-node": "jest --config .jest.node.js --no-cache",
|
||||||
"test-all": "./scripts/test-all.sh",
|
"test-all": "./scripts/test-all.sh",
|
||||||
"lint": "npm run lint:ts && npm run lint:es && npm run lint:demo && npm run lint:style",
|
"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