aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-10-22 16:20:47 +0800
committerGitHub <noreply@github.com>2017-10-22 16:20:47 +0800
commit6022baedfba9ec831d9fddaf7979771a71ca7fb8 (patch)
tree243b0a85cc29e79fb30c4d7cba51b0d09ec99125 /tests
parent35d5ed7815f4707c79565a45261ffadc21d604be (diff)
parente30387aba831b80ed9bcceafe1e2b66d69ee59cc (diff)
downloadtime-picker-6022baedfba9ec831d9fddaf7979771a71ca7fb8.tar.gz
time-picker-6022baedfba9ec831d9fddaf7979771a71ca7fb8.tar.zst
time-picker-6022baedfba9ec831d9fddaf7979771a71ca7fb8.zip
Merge pull request #68 from csenk/focus-blur
add focus/blur support.
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});