From e30387aba831b80ed9bcceafe1e2b66d69ee59cc Mon Sep 17 00:00:00 2001 From: Christian Senk Date: Tue, 12 Sep 2017 19:12:40 +0200 Subject: add focus/blur support. --- tests/TimePicker.spec.jsx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/TimePicker.spec.jsx b/tests/TimePicker.spec.jsx index 0dd6c10..d698e48 100644 --- a/tests/TimePicker.spec.jsx +++ b/tests/TimePicker.spec.jsx @@ -208,4 +208,40 @@ describe('TimePicker', () => { }); }); }); + + describe('other operations', () => { + it('focus/blur correctly', (done) => { + let focus = false; + let blur = false; + + const picker = renderPicker({ + onFocus: () => { + focus = true; + }, + onBlur: () => { + blur = true; + }, + }); + expect(picker.state.open).not.to.be.ok(); + const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, + 'rc-time-picker-input')[0]; + + async.series([(next) => { + Simulate.focus(input); + setTimeout(next, 100); + }, (next) => { + expect(picker.state.open).to.be(false); + + Simulate.blur(input); + setTimeout(next, 100); + }, (next) => { + expect(focus).to.be(true); + expect(blur).to.be(true); + + next(); + }], () => { + done(); + }); + }); + }); }); -- cgit v1.2.3