From e3583f75ca49c8a746689644563c65f40236c23b Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 20 Feb 2017 16:40:58 +0800 Subject: Add test cases --- tests/TimePicker.spec.jsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/TimePicker.spec.jsx b/tests/TimePicker.spec.jsx index 150f727..1ea3b8b 100644 --- a/tests/TimePicker.spec.jsx +++ b/tests/TimePicker.spec.jsx @@ -111,6 +111,33 @@ describe('TimePicker', () => { done(); }); }); + + it('support name', () => { + const picker = renderPicker({ + name: 'time-picker-form-name', + }); + const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, + 'rc-time-picker-input')[0]; + expect(input.name).to.be('time-picker-form-name'); + }); + + it('support focus', () => { + const picker = renderPicker({ + name: 'time-picker-form-name', + }); + expect(picker.focus).to.be.a('function'); + }); + + it('should be controlled by open', () => { + const picker = renderPicker({ + open: false, + }); + expect(picker.state.open).not.to.be.ok(); + const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, + 'rc-time-picker-input')[0]; + Simulate.click(input); + expect(picker.state.open).not.to.be.ok(); + }); }); describe('render panel to body (without seconds)', () => { -- cgit v1.2.3