From 5827568ef882ae5a474f37ff5c843e931528ebe8 Mon Sep 17 00:00:00 2001
From: Marek Piechut <marek.piechut@gmail.com>
Date: Mon, 9 Oct 2017 13:38:00 +0200
Subject: Add hourStep, minuteStep and secondStep props to control intervals in
 picker

---
 tests/Select.spec.jsx | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

(limited to 'tests/Select.spec.jsx')

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';
 import async from 'async';
 import moment from 'moment';
 
+const map = (arr, fn) => Array.prototype.map.call(arr, fn);
+
 describe('Select', () => {
   let container;
 
@@ -59,6 +61,38 @@ describe('Select', () => {
         done();
       });
     });
+
+    it('shows only numbers according to step props', (done) => {
+      const picker = renderPicker({
+        hourStep: 5,
+        minuteStep: 15,
+        secondStep: 21,
+      });
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
+        'rc-time-picker-input')[0];
+      async.series([(next) => {
+        Simulate.click(input);
+        setTimeout(next, 100);
+      }, (next) => {
+        const selectors = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
+          'rc-time-picker-panel-select');
+
+        const hourSelector = selectors[0];
+        const minuteSelector = selectors[1];
+        const secondSelector = selectors[2];
+
+        const hours = map(hourSelector.getElementsByTagName('li'), (li) => li.innerHTML);
+        expect(hours).to.eql(['00', '05', '10', '15', '20']);
+
+        const minutes = map(minuteSelector.getElementsByTagName('li'), (li) => li.innerHTML);
+        expect(minutes).to.eql(['00', '15', '30', '45']);
+
+        const seconds = map(secondSelector.getElementsByTagName('li'), (li) => li.innerHTML);
+        expect(seconds).to.eql(['00', '21', '42']);
+
+        next();
+      }], done);
+    });
   });
 
   describe('select number', () => {
-- 
cgit v1.2.3

