diff options
author | Marek Piechut <marek.piechut@gmail.com> | 2017-10-09 13:38:00 +0200 |
---|---|---|
committer | Marek Piechut <marek.piechut@gmail.com> | 2017-10-09 13:38:00 +0200 |
commit | 5827568ef882ae5a474f37ff5c843e931528ebe8 (patch) | |
tree | de49d29b22db47adcaba3dee2bdf94227fdae665 /tests | |
parent | 35d5ed7815f4707c79565a45261ffadc21d604be (diff) | |
download | time-picker-5827568ef882ae5a474f37ff5c843e931528ebe8.tar.gz time-picker-5827568ef882ae5a474f37ff5c843e931528ebe8.tar.zst time-picker-5827568ef882ae5a474f37ff5c843e931528ebe8.zip |
Add hourStep, minuteStep and secondStep props to control intervals in picker
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Select.spec.jsx | 34 |
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'; | |||
7 | import async from 'async'; | 7 | import async from 'async'; |
8 | import moment from 'moment'; | 8 | import moment from 'moment'; |
9 | 9 | ||
10 | const map = (arr, fn) => Array.prototype.map.call(arr, fn); | ||
11 | |||
10 | describe('Select', () => { | 12 | describe('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', () => { |