aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorafc163 <afc163@gmail.com>2017-03-08 15:00:09 +0800
committerafc163 <afc163@gmail.com>2017-03-08 15:00:09 +0800
commit369ffb9a3883cb01ff5d80cc2312a1a7f2fbe6a4 (patch)
treee5636fff22c61a93236e4a7dfe1e00e87d371061
parent5423edb11fac7f8ed5d35ba739878ee4435fa5af (diff)
downloadtime-picker-369ffb9a3883cb01ff5d80cc2312a1a7f2fbe6a4.tar.gz
time-picker-369ffb9a3883cb01ff5d80cc2312a1a7f2fbe6a4.tar.zst
time-picker-369ffb9a3883cb01ff5d80cc2312a1a7f2fbe6a4.zip
add test case
-rw-r--r--tests/Select.spec.jsx38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index ea0a827..fd2ec32 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -452,5 +452,43 @@ describe('Select', () => {
452 done(); 452 done();
453 }); 453 });
454 }); 454 });
455
456 it('renders uppercase AM correctly', (done) => {
457 const picker = renderPicker({
458 use12Hours: true,
459 defaultValue: moment().hour(0).minute(0).second(0),
460 showSecond: false,
461 format: 'h:mm A',
462 });
463 expect(picker.state.open).not.to.be.ok();
464 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
465 'rc-time-picker-input')[0];
466 let selector;
467 async.series([(next) => {
468 expect(picker.state.open).to.be(false);
469
470 Simulate.click(input);
471 setTimeout(next, 100);
472 }, (next) => {
473 expect(picker.state.open).to.be(true);
474 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
475 'rc-time-picker-panel-select')[2];
476 expect((input).value).to.be('12:00 AM');
477 const option = selector.getElementsByTagName('li')[1];
478 Simulate.click(option);
479 setTimeout(next, 200);
480 }, (next) => {
481 expect((input).value).to.be('12:00 PM');
482 next();
483 }, (next) => {
484 Simulate.click(selector.getElementsByTagName('li')[0]);
485 setTimeout(next, 200);
486 }, (next) => {
487 expect((input).value).to.be('12:00 AM');
488 next();
489 }], () => {
490 done();
491 });
492 });
455 }); 493 });
456}); 494});