mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-06 02:15:35 +08:00
b7e877aeef
* refactor(slider): rewrite with hook
* improve test
* Revert "improve test"
This reverts commit 48cd83d0cc
.
* improve test
* improve test 2
23 lines
855 B
JavaScript
23 lines
855 B
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import InputNumber from '..';
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
import mountTest from '../../../tests/shared/mountTest';
|
|
import rtlTest from '../../../tests/shared/rtlTest';
|
|
|
|
describe('InputNumber', () => {
|
|
focusTest(InputNumber, { refFocus: true });
|
|
mountTest(InputNumber);
|
|
rtlTest(InputNumber);
|
|
|
|
// https://github.com/ant-design/ant-design/issues/13896
|
|
it('should return null when blur a empty input number', () => {
|
|
const onChange = jest.fn();
|
|
const wrapper = mount(<InputNumber defaultValue="1" onChange={onChange} />);
|
|
wrapper.find('input').simulate('change', { target: { value: '' } });
|
|
expect(onChange).toHaveBeenLastCalledWith('');
|
|
wrapper.find('input').simulate('blur');
|
|
expect(onChange).toHaveBeenLastCalledWith(null);
|
|
});
|
|
});
|