mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
test: update cases for TimePicker
This commit is contained in:
parent
be22c9148b
commit
39d648e3b8
@ -40,4 +40,32 @@ describe('TimePicker', () => {
|
||||
);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('handleChange should work correctly', done => {
|
||||
const date = moment('2000-01-01 00:00:00');
|
||||
const onChange = (value, formattedValue) => {
|
||||
expect(value).toBe(date);
|
||||
expect(formattedValue).toBe(date.format('HH:mm:ss'));
|
||||
done();
|
||||
};
|
||||
const wrapper = mount(<TimePicker onChange={onChange} />).instance();
|
||||
wrapper.handleChange(date);
|
||||
});
|
||||
|
||||
it('handleOpenClose should work correctly', done => {
|
||||
const onOpenChange = open => {
|
||||
expect(open).toBe(true);
|
||||
done();
|
||||
};
|
||||
const wrapper = mount(<TimePicker onOpenChange={onOpenChange} />).instance();
|
||||
wrapper.handleOpenClose({ open: true });
|
||||
});
|
||||
|
||||
it('clearIcon should render correctly', () => {
|
||||
const clearIcon = <div className="test-clear-icon">test</div>;
|
||||
const wrapper = mount(<TimePicker clearIcon={clearIcon} />);
|
||||
expect(wrapper.find('Picker').prop('clearIcon')).toEqual(
|
||||
<div className="test-clear-icon ant-time-picker-clear">test</div>,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user