aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorLevi Lansing <helives@gmail.com>2017-09-28 11:44:03 -0400
committerLevi Lansing <helives@gmail.com>2017-09-28 11:44:03 -0400
commitbcb307b79a2481bad496085b75b701bf864adc6d (patch)
tree73e1b5268a7b35dc1d836e060b0b4797be12315f /tests
parent1c72daf036bee06cde97639ac80b741c3ed38fa8 (diff)
downloadtime-picker-bcb307b79a2481bad496085b75b701bf864adc6d.tar.gz
time-picker-bcb307b79a2481bad496085b75b701bf864adc6d.tar.zst
time-picker-bcb307b79a2481bad496085b75b701bf864adc6d.zip
add test that covers focus on open code
Diffstat (limited to 'tests')
-rw-r--r--tests/Header.spec.jsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Header.spec.jsx b/tests/Header.spec.jsx
index 5ab0ba0..4b27abb 100644
--- a/tests/Header.spec.jsx
+++ b/tests/Header.spec.jsx
@@ -368,5 +368,33 @@ describe('Header', () => {
368 done(); 368 done();
369 }); 369 });
370 }); 370 });
371
372 it('focus on open', (done) => {
373 const picker = renderPicker({
374 focusOnOpen: true,
375 });
376 expect(picker.state.open).not.to.be.ok();
377 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
378 'rc-time-picker-input')[0];
379 let header;
380 async.series([(next) => {
381 expect(picker.state.open).to.be(false);
382
383 Simulate.click(input);
384 setTimeout(next, 100);
385 }, (next) => {
386 // this touches the focusOnOpen code, but we cannot verify the input is in focus
387 expect(picker.state.open).to.be(true);
388 header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
389 'rc-time-picker-panel-input')[0];
390 expect(header).to.be.ok();
391 expect((header).value).to.be('01:02:03');
392 expect((input).value).to.be('01:02:03');
393
394 next();
395 }], () => {
396 done();
397 });
398 });
371 }); 399 });
372}); 400});