aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Header.spec.jsx
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-10-22 16:34:22 +0800
committerGitHub <noreply@github.com>2017-10-22 16:34:22 +0800
commit8a116e355bfabda48537be06d21cf01fdceaa8b7 (patch)
tree1661660b49bb81a3fa3869ea6979ffd51cf8c2ad /tests/Header.spec.jsx
parent18b5785f0f551f8b97d40a1eb31d80d8cc5db562 (diff)
parent78598cc9f8608fc8bb1830d3384c8e7fd032eb3f (diff)
downloadtime-picker-8a116e355bfabda48537be06d21cf01fdceaa8b7.tar.gz
time-picker-8a116e355bfabda48537be06d21cf01fdceaa8b7.tar.zst
time-picker-8a116e355bfabda48537be06d21cf01fdceaa8b7.zip
Merge pull request #71 from ZaiusInc/focus-on-open
add focusOnOpen option (#61)
Diffstat (limited to 'tests/Header.spec.jsx')
-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});