From 39d648e3b8092e48ee8b0a9f0f16f86b0373bebd Mon Sep 17 00:00:00 2001 From: zy410419243 Date: Thu, 7 Mar 2019 11:31:36 +0800 Subject: [PATCH] test: update cases for TimePicker --- .../time-picker/__tests__/index.test.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/components/time-picker/__tests__/index.test.js b/components/time-picker/__tests__/index.test.js index b7c121345e..3d97f16c9d 100644 --- a/components/time-picker/__tests__/index.test.js +++ b/components/time-picker/__tests__/index.test.js @@ -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().instance(); + wrapper.handleChange(date); + }); + + it('handleOpenClose should work correctly', done => { + const onOpenChange = open => { + expect(open).toBe(true); + done(); + }; + const wrapper = mount().instance(); + wrapper.handleOpenClose({ open: true }); + }); + + it('clearIcon should render correctly', () => { + const clearIcon =
test
; + const wrapper = mount(); + expect(wrapper.find('Picker').prop('clearIcon')).toEqual( +
test
, + ); + }); });