X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FSelect.spec.jsx;h=fd2ec326800dfb80d65058e99b8b571ee03d6529;hb=4e020febdf6201ab5f10a0e49be81c6ff32daaeb;hp=fb58145630d239f90a54f0820042870ad0fbf1b3;hpb=79405d1bc30c868cdf2c4bfb3abe654d28aeb5ca;p=github%2Ffretlink%2Ftime-picker.git diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx index fb58145..fd2ec32 100644 --- a/tests/Select.spec.jsx +++ b/tests/Select.spec.jsx @@ -446,7 +446,45 @@ describe('Select', () => { Simulate.click(selector.getElementsByTagName('li')[0]); setTimeout(next, 200); }, (next) => { - expect((input).value).to.be('12:00 pm'); + expect((input).value).to.be('12:00 am'); + next(); + }], () => { + done(); + }); + }); + + it('renders uppercase AM correctly', (done) => { + const picker = renderPicker({ + use12Hours: true, + defaultValue: moment().hour(0).minute(0).second(0), + showSecond: false, + format: 'h:mm A', + }); + 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, 200); + }, (next) => { + expect((input).value).to.be('12:00 PM'); + next(); + }, (next) => { + Simulate.click(selector.getElementsByTagName('li')[0]); + setTimeout(next, 200); + }, (next) => { + expect((input).value).to.be('12:00 AM'); next(); }], () => { done();