mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
update input test case
This commit is contained in:
parent
767c4ab70d
commit
7381cc95fe
@ -8,9 +8,22 @@ const calculateNodeHeight = require('../calculateNodeHeight');
|
|||||||
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
|
const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));
|
||||||
|
|
||||||
describe('Input', () => {
|
describe('Input', () => {
|
||||||
|
it('should not auto calculate height when type is text', async () => {
|
||||||
|
const wrapper = mount(
|
||||||
|
<Input value="" readOnly />
|
||||||
|
);
|
||||||
|
expect(calculateNodeHeight).toHaveBeenCalledTimes(0);
|
||||||
|
wrapper.setProps({ value: '1111\n2222\n3333' });
|
||||||
|
await delay(0);
|
||||||
|
expect(calculateNodeHeight).toHaveBeenCalledTimes(0);
|
||||||
|
wrapper.setProps({ value: '1111' });
|
||||||
|
await delay(0);
|
||||||
|
expect(calculateNodeHeight).toHaveBeenCalledTimes(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('should auto calculate height according to content length', async () => {
|
it('should auto calculate height according to content length', async () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<Input type="textarea" autosize />
|
<Input value="" readOnly type="textarea" autosize />
|
||||||
);
|
);
|
||||||
expect(calculateNodeHeight).toHaveBeenCalledTimes(1);
|
expect(calculateNodeHeight).toHaveBeenCalledTimes(1);
|
||||||
wrapper.setProps({ value: '1111\n2222\n3333' });
|
wrapper.setProps({ value: '1111\n2222\n3333' });
|
||||||
|
Loading…
Reference in New Issue
Block a user