]> git.immae.eu Git - github/fretlink/time-picker.git/commitdiff
Add test
authorcaojunchao <caojunchao@didichuxing.com>
Thu, 9 Mar 2017 06:22:01 +0000 (14:22 +0800)
committercaojunchao <caojunchao@didichuxing.com>
Thu, 9 Mar 2017 06:22:01 +0000 (14:22 +0800)
tests/Select.spec.jsx

index fd2ec326800dfb80d65058e99b8b571ee03d6529..2d300987fe2175c60ecfbae6ea642a6f7d53ccb9 100644 (file)
@@ -33,6 +33,34 @@ describe('Select', () => {
     document.body.removeChild(container);
   });
 
+  describe('select panel', () => {
+    it('select panel reacts to mouseenter and mouseleave correctly', (done) => {
+      const picker = renderPicker();
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker,
+        'rc-time-picker-input')[0];
+      async.series([(next) => {
+        Simulate.click(input);
+        setTimeout(next, 100);
+      }, (next) => {
+        const re = /(^|\s+)rc-time-picker-panel-select-active(\s+|$)/;
+        const selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance,
+          'rc-time-picker-panel-select')[0];
+
+        expect(re.test(selector.className)).to.be(false);
+
+        Simulate.mouseEnter(selector);
+        expect(re.test(selector.className)).to.be(true);
+
+        Simulate.mouseLeave(selector);
+        expect(re.test(selector.className)).to.be(false);
+
+        next();
+      }], () => {
+        done();
+      });
+    });
+  });
+
   describe('select number', () => {
     it('select number correctly', (done) => {
       const picker = renderPicker();