From 4f26f23b14ec9f1aa6260b1eee9a190639530b45 Mon Sep 17 00:00:00 2001 From: Antony Shaleynikov Date: Wed, 8 Mar 2017 22:50:57 +0300 Subject: Fixed unwanted exception on missed value --- tests/TimePicker.spec.jsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/TimePicker.spec.jsx b/tests/TimePicker.spec.jsx index 1ea3b8b..6f9ac2d 100644 --- a/tests/TimePicker.spec.jsx +++ b/tests/TimePicker.spec.jsx @@ -174,4 +174,38 @@ describe('TimePicker', () => { }); }); }); + + describe('render panel to body 12pm mode', () => { + it('popup correctly', (done) => { + let change; + const picker = renderPickerWithoutSeconds({ + use12Hours: true, + value: null, + onChange(v) { + change = v; + }, + }); + expect(picker.state.open).not.to.be.ok(); + const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, + 'rc-time-picker-input')[0]; + expect((input).value).to.be(''); + async.series([(next) => { + Simulate.click(input); + setTimeout(next, 100); + }, (next) => { + expect(TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, + 'rc-time-picker-panel-inner')[0]).to.be.ok(); + expect(picker.state.open).to.be(true); + const hour = TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[1]; + Simulate.click(hour); + setTimeout(next, 100); + }, (next) => { + expect(change).to.be.ok(); + expect(picker.state.open).to.be.ok(); + next(); + }], () => { + done(); + }); + }); + }); }); -- cgit v1.2.3