aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-10-22 16:24:17 +0800
committerGitHub <noreply@github.com>2017-10-22 16:24:17 +0800
commit78598cc9f8608fc8bb1830d3384c8e7fd032eb3f (patch)
treed015484db93d83f9ea17fbe6b5602cd9936d37c8 /tests
parentbcb307b79a2481bad496085b75b701bf864adc6d (diff)
parentb6767d8a08ccfc52836e09e3a0886a5cf225b93f (diff)
downloadtime-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.tar.gz
time-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.tar.zst
time-picker-78598cc9f8608fc8bb1830d3384c8e7fd032eb3f.zip
Merge branch 'master' into focus-on-open
Diffstat (limited to 'tests')
-rw-r--r--tests/TimePicker.spec.jsx36
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});