From 0328afec8ec844b7f8c948f0434a1021d9c11033 Mon Sep 17 00:00:00 2001 From: Antony Shaleynikov Date: Thu, 2 Mar 2017 16:20:29 +0300 Subject: Added more tests --- tests/Select.spec.jsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests') diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx index fe20178..827a736 100644 --- a/tests/Select.spec.jsx +++ b/tests/Select.spec.jsx @@ -413,5 +413,38 @@ describe('Select', () => { done(); }); }); + + + it('renders 12am/pm correctly', (done) => { + const picker = renderPicker({ + use12Hours: true, + defaultValue: moment().hour(0).minute(0).second(0), + showSecond: false, + format: undefined, + }); + expect(picker.state.open).not.to.be.ok(); + const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, + 'rc-time-picker-input')[0]; + let selector; + async.series([(next) => { + expect(picker.state.open).to.be(false); + + Simulate.click(input); + setTimeout(next, 100); + }, (next) => { + expect(picker.state.open).to.be(true); + selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, + 'rc-time-picker-panel-select')[2]; + expect((input).value).to.be('12:00 am'); + const option = selector.getElementsByTagName('li')[1]; + Simulate.click(option); + setTimeout(next, 100); + }, (next) => { + expect((input).value).to.be('12:00 pm'); + next(); + }], () => { + done(); + }); + }); }); }); -- cgit v1.2.3