aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 16:06:32 +0300
committerAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 16:06:32 +0300
commit35949690d0c5bada9a86fc67a9ee04c96d9a8b15 (patch)
tree881be2fa6826e3ef8a54c42cb0f99dd1da2e85d8 /tests
parentdd2f6abda00cea99ec0a24e3f162fabeba7ac176 (diff)
downloadtime-picker-35949690d0c5bada9a86fc67a9ee04c96d9a8b15.tar.gz
time-picker-35949690d0c5bada9a86fc67a9ee04c96d9a8b15.tar.zst
time-picker-35949690d0c5bada9a86fc67a9ee04c96d9a8b15.zip
Added more tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Select.spec.jsx35
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index ef9ca32..fe20178 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -371,8 +371,6 @@ describe('Select', () => {
371 expect(picker.state.open).to.be(true); 371 expect(picker.state.open).to.be(true);
372 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 372 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
373 'rc-time-picker-panel-select'); 373 'rc-time-picker-panel-select');
374 expect((input).value).to.be('12:00 am');
375
376 setTimeout(next, 100); 374 setTimeout(next, 100);
377 }, (next) => { 375 }, (next) => {
378 expect(selector.length).to.be(3); 376 expect(selector.length).to.be(3);
@@ -382,5 +380,38 @@ describe('Select', () => {
382 done(); 380 done();
383 }); 381 });
384 }); 382 });
383
384
385 it('renders 5am correctly', (done) => {
386 const picker = renderPicker({
387 use12Hours: true,
388 defaultValue: moment().hour(0).minute(0).second(0),
389 showSecond: false,
390 format: undefined,
391 });
392 expect(picker.state.open).not.to.be.ok();
393 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
394 'rc-time-picker-input')[0];
395 let selector;
396 async.series([(next) => {
397 expect(picker.state.open).to.be(false);
398
399 Simulate.click(input);
400 setTimeout(next, 100);
401 }, (next) => {
402 expect(picker.state.open).to.be(true);
403 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
404 'rc-time-picker-panel-select')[0];
405 expect((input).value).to.be('12:00 am');
406 const option = selector.getElementsByTagName('li')[3];
407 Simulate.click(option);
408 setTimeout(next, 100);
409 }, (next) => {
410 expect((input).value).to.be('3:00 am');
411 next();
412 }], () => {
413 done();
414 });
415 });
385 }); 416 });
386}); 417});