diff options
author | Christian Senk <senk.christian@googlemail.com> | 2017-09-12 19:12:40 +0200 |
---|---|---|
committer | Christian Senk <senk.christian@googlemail.com> | 2017-09-12 19:12:40 +0200 |
commit | e30387aba831b80ed9bcceafe1e2b66d69ee59cc (patch) | |
tree | 243b0a85cc29e79fb30c4d7cba51b0d09ec99125 /tests/TimePicker.spec.jsx | |
parent | 35d5ed7815f4707c79565a45261ffadc21d604be (diff) | |
download | time-picker-e30387aba831b80ed9bcceafe1e2b66d69ee59cc.tar.gz time-picker-e30387aba831b80ed9bcceafe1e2b66d69ee59cc.tar.zst time-picker-e30387aba831b80ed9bcceafe1e2b66d69ee59cc.zip |
add focus/blur support.
Diffstat (limited to 'tests/TimePicker.spec.jsx')
-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 | }); |