2019-02-20 18:18:19 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
2018-03-23 19:19:29 +08:00
|
|
|
import InputNumber from '..';
|
|
|
|
import focusTest from '../../../tests/shared/focusTest';
|
2019-08-26 22:53:20 +08:00
|
|
|
import mountTest from '../../../tests/shared/mountTest';
|
2018-03-23 19:19:29 +08:00
|
|
|
|
2019-02-20 18:18:19 +08:00
|
|
|
describe('InputNumber', () => {
|
|
|
|
focusTest(InputNumber);
|
2019-08-26 22:53:20 +08:00
|
|
|
mountTest(InputNumber);
|
2019-02-20 18:18:19 +08:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
});
|
|
|
|
});
|