diff options
Diffstat (limited to 'tests/Header.spec.jsx')
-rw-r--r-- | tests/Header.spec.jsx | 28 |
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 | }); |