diff options
author | Cyril Sobierajewicz <38043722+cyrilfretlink@users.noreply.github.com> | 2018-06-11 11:42:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-11 11:42:36 +0200 |
commit | 273181d5cc2d23808d4302d763bbb7f7fa440c11 (patch) | |
tree | 6308553bb431137c20d2d3babb75ff23d4a137ed /tests | |
parent | 77862aea6a529152c46fd43dee5fc48fce8100e8 (diff) | |
parent | 3931819e40ce408d8f7c1a969e160631b376c07e (diff) | |
download | time-picker-master.tar.gz time-picker-master.tar.zst time-picker-master.zip |
Add a prop to configure whether `<kbd>esc</kbd>` should close the panel
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Header.spec.jsx | 12 |
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({ |