aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Select.spec.jsx34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index b2c111d..2a15e7c 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -7,6 +7,8 @@ import expect from 'expect.js';
7import async from 'async'; 7import async from 'async';
8import moment from 'moment'; 8import moment from 'moment';
9 9
10const map = (arr, fn) => Array.prototype.map.call(arr, fn);
11
10describe('Select', () => { 12describe('Select', () => {
11 let container; 13 let container;
12 14
@@ -59,6 +61,38 @@ describe('Select', () => {
59 done(); 61 done();
60 }); 62 });
61 }); 63 });
64
65 it('shows only numbers according to step props', (done) => {
66 const picker = renderPicker({
67 hourStep: 5,
68 minuteStep: 15,
69 secondStep: 21,
70 });
71 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
72 'rc-time-picker-input')[0];
73 async.series([(next) => {
74 Simulate.click(input);
75 setTimeout(next, 100);
76 }, (next) => {
77 const selectors = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
78 'rc-time-picker-panel-select');
79
80 const hourSelector = selectors[0];
81 const minuteSelector = selectors[1];
82 const secondSelector = selectors[2];
83
84 const hours = map(hourSelector.getElementsByTagName('li'), (li) => li.innerHTML);
85 expect(hours).to.eql(['00', '05', '10', '15', '20']);
86
87 const minutes = map(minuteSelector.getElementsByTagName('li'), (li) => li.innerHTML);
88 expect(minutes).to.eql(['00', '15', '30', '45']);
89
90 const seconds = map(secondSelector.getElementsByTagName('li'), (li) => li.innerHTML);
91 expect(seconds).to.eql(['00', '21', '42']);
92
93 next();
94 }], done);
95 });
62 }); 96 });
63 97
64 describe('select number', () => { 98 describe('select number', () => {