aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 15:42:05 +0300
committerAntony Shaleynikov <shaleynikov@gmail.com>2017-03-02 15:42:05 +0300
commitdd2f6abda00cea99ec0a24e3f162fabeba7ac176 (patch)
tree770b27246656d47c5308894919238238c0dc4d6d /tests
parentdd275f7df354e218d170ddbcc1eadff1427db76b (diff)
downloadtime-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.tar.gz
time-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.tar.zst
time-picker-dd2f6abda00cea99ec0a24e3f162fabeba7ac176.zip
Updated 12 hours example, added default format for 12 hours mode, updated tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Select.spec.jsx68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index e6d32dd..ef9ca32 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -315,4 +315,72 @@ describe('Select', () => {
315 }); 315 });
316 }); 316 });
317 }); 317 });
318
319
320 describe('select in 12 hours mode', () => {
321 it('renders correctly', (done) => {
322 const picker = renderPicker({
323 use12Hours: true,
324 defaultValue: moment().hour(14).minute(0).second(0),
325 showSecond: false,
326 format: undefined,
327 });
328 expect(picker.state.open).not.to.be.ok();
329 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
330 'rc-time-picker-input')[0];
331 let selector;
332 async.series([(next) => {
333 expect(picker.state.open).to.be(false);
334
335 Simulate.click(input);
336 setTimeout(next, 100);
337 }, (next) => {
338 expect(picker.state.open).to.be(true);
339 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
340 'rc-time-picker-panel-select');
341 expect((input).value).to.be('2:00 pm');
342
343 setTimeout(next, 100);
344 }, (next) => {
345 expect(selector.length).to.be(3);
346
347 next();
348 }], () => {
349 done();
350 });
351 });
352
353
354 it('renders 12am correctly', (done) => {
355 const picker = renderPicker({
356 use12Hours: true,
357 defaultValue: moment().hour(0).minute(0).second(0),
358 showSecond: false,
359 format: undefined,
360 });
361 expect(picker.state.open).not.to.be.ok();
362 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
363 'rc-time-picker-input')[0];
364 let selector;
365 async.series([(next) => {
366 expect(picker.state.open).to.be(false);
367
368 Simulate.click(input);
369 setTimeout(next, 100);
370 }, (next) => {
371 expect(picker.state.open).to.be(true);
372 selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
373 'rc-time-picker-panel-select');
374 expect((input).value).to.be('12:00 am');
375
376 setTimeout(next, 100);
377 }, (next) => {
378 expect(selector.length).to.be(3);
379
380 next();
381 }], () => {
382 done();
383 });
384 });
385 });
318}); 386});