diff options
author | 偏右 <afc163@gmail.com> | 2017-10-22 16:25:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-22 16:25:33 +0800 |
commit | cc2dca8a2bb0bf3b820903043be2586fb413c458 (patch) | |
tree | 4e0621e9b18f7938ffc31b87263182c79793d581 /tests | |
parent | 5827568ef882ae5a474f37ff5c843e931528ebe8 (diff) | |
parent | b6767d8a08ccfc52836e09e3a0886a5cf225b93f (diff) | |
download | time-picker-cc2dca8a2bb0bf3b820903043be2586fb413c458.tar.gz time-picker-cc2dca8a2bb0bf3b820903043be2586fb413c458.tar.zst time-picker-cc2dca8a2bb0bf3b820903043be2586fb413c458.zip |
Merge branch 'master' into picker-step
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 | }); |