From 35949690d0c5bada9a86fc67a9ee04c96d9a8b15 Mon Sep 17 00:00:00 2001
From: Antony Shaleynikov <shaleynikov@gmail.com>
Date: Thu, 2 Mar 2017 16:06:32 +0300
Subject: Added more tests

---
 tests/Select.spec.jsx | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

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

diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index ef9ca32..fe20178 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -371,8 +371,6 @@ describe('Select', () => {
         expect(picker.state.open).to.be(true);
         selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
           'rc-time-picker-panel-select');
-        expect((input).value).to.be('12:00 am');
-
         setTimeout(next, 100);
       }, (next) => {
         expect(selector.length).to.be(3);
@@ -382,5 +380,38 @@ describe('Select', () => {
         done();
       });
     });
+
+
+    it('renders 5am correctly', (done) => {
+      const picker = renderPicker({
+        use12Hours: true,
+        defaultValue: moment().hour(0).minute(0).second(0),
+        showSecond: false,
+        format: undefined,
+      });
+      expect(picker.state.open).not.to.be.ok();
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
+        'rc-time-picker-input')[0];
+      let selector;
+      async.series([(next) => {
+        expect(picker.state.open).to.be(false);
+
+        Simulate.click(input);
+        setTimeout(next, 100);
+      }, (next) => {
+        expect(picker.state.open).to.be(true);
+        selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
+          'rc-time-picker-panel-select')[0];
+        expect((input).value).to.be('12:00 am');
+        const option = selector.getElementsByTagName('li')[3];
+        Simulate.click(option);
+        setTimeout(next, 100);
+      }, (next) => {
+        expect((input).value).to.be('3:00 am');
+        next();
+      }], () => {
+        done();
+      });
+    });
   });
 });
-- 
cgit v1.2.3

