From 3931819e40ce408d8f7c1a969e160631b376c07e Mon Sep 17 00:00:00 2001 From: Cyril Sobierajewicz Date: Mon, 11 Jun 2018 10:35:05 +0200 Subject: Add a prop to configure whether `esc` should close the panel --- tests/Header.spec.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') 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', () => { }); }); - it('exit correctly', (done) => { - const picker = renderPicker(); + const closeOnEscSpec = (closeOnEsc) => (done) => { + const picker = renderPicker({ closeOnEsc }); expect(picker.state.open).not.to.be.ok(); const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0]; @@ -359,7 +359,7 @@ describe('Header', () => { }); setTimeout(next, 100); }, (next) => { - expect(picker.state.open).to.be(false); + expect(picker.state.open).to.be(!closeOnEsc); expect((header).value).to.be('01:02:03'); expect((input).value).to.be('01:02:03'); @@ -367,7 +367,11 @@ describe('Header', () => { }], () => { done(); }); - }); + }; + + it('exit correctly', closeOnEscSpec(true)); + + it('stays open if `closeOnEsc` is `false`', closeOnEscSpec(false)); it('focus on open', (done) => { const picker = renderPicker({ -- cgit v1.2.3