aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Header.spec.jsx12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/Header.spec.jsx b/tests/Header.spec.jsx
index 4b27abb..291f938 100644
--- a/tests/Header.spec.jsx
+++ b/tests/Header.spec.jsx
@@ -335,8 +335,8 @@ describe('Header', () => {
335 }); 335 });
336 }); 336 });
337 337
338 it('exit correctly', (done) => { 338 const closeOnEscSpec = (closeOnEsc) => (done) => {
339 const picker = renderPicker(); 339 const picker = renderPicker({ closeOnEsc });
340 expect(picker.state.open).not.to.be.ok(); 340 expect(picker.state.open).not.to.be.ok();
341 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 341 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
342 'rc-time-picker-input')[0]; 342 'rc-time-picker-input')[0];
@@ -359,7 +359,7 @@ describe('Header', () => {
359 }); 359 });
360 setTimeout(next, 100); 360 setTimeout(next, 100);
361 }, (next) => { 361 }, (next) => {
362 expect(picker.state.open).to.be(false); 362 expect(picker.state.open).to.be(!closeOnEsc);
363 expect((header).value).to.be('01:02:03'); 363 expect((header).value).to.be('01:02:03');
364 expect((input).value).to.be('01:02:03'); 364 expect((input).value).to.be('01:02:03');
365 365
@@ -367,7 +367,11 @@ describe('Header', () => {
367 }], () => { 367 }], () => {
368 done(); 368 done();
369 }); 369 });
370 }); 370 };
371
372 it('exit correctly', closeOnEscSpec(true));
373
374 it('stays open if `closeOnEsc` is `false`', closeOnEscSpec(false));
371 375
372 it('focus on open', (done) => { 376 it('focus on open', (done) => {
373 const picker = renderPicker({ 377 const picker = renderPicker({