diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TimePicker.spec.jsx | 36 |
1 files changed, 36 insertions, 0 deletions
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', () => { | |||
208 | }); | 208 | }); |
209 | }); | 209 | }); |
210 | }); | 210 | }); |
211 | |||
212 | describe('other operations', () => { | ||
213 | it('focus/blur correctly', (done) => { | ||
214 | let focus = false; | ||
215 | let blur = false; | ||
216 | |||
217 | const picker = renderPicker({ | ||
218 | onFocus: () => { | ||
219 | focus = true; | ||
220 | }, | ||
221 | onBlur: () => { | ||
222 | blur = true; | ||
223 | }, | ||
224 | }); | ||
225 | expect(picker.state.open).not.to.be.ok(); | ||
226 | const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, | ||
227 | 'rc-time-picker-input')[0]; | ||
228 | |||
229 | async.series([(next) => { | ||
230 | Simulate.focus(input); | ||
231 | setTimeout(next, 100); | ||
232 | }, (next) => { | ||
233 | expect(picker.state.open).to.be(false); | ||
234 | |||
235 | Simulate.blur(input); | ||
236 | setTimeout(next, 100); | ||
237 | }, (next) => { | ||
238 | expect(focus).to.be(true); | ||
239 | expect(blur).to.be(true); | ||
240 | |||
241 | next(); | ||
242 | }], () => { | ||
243 | done(); | ||
244 | }); | ||
245 | }); | ||
246 | }); | ||
211 | }); | 247 | }); |