From e9060dda0dd04e99666ff29efe459ebc7d7c65a7 Mon Sep 17 00:00:00 2001
From: yiminghe <yiminghe@gmail.com>
Date: Sat, 5 Dec 2015 03:26:32 +0800
Subject: lint

---
 tests/Select.spec.jsx | 133 ++++++++++++++++++++++++--------------------------
 1 file changed, 63 insertions(+), 70 deletions(-)

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

diff --git a/tests/Select.spec.jsx b/tests/Select.spec.jsx
index 036a0f9..7e53c31 100644
--- a/tests/Select.spec.jsx
+++ b/tests/Select.spec.jsx
@@ -3,22 +3,26 @@ import React from 'react';
 import TimePicker from '../src/TimePicker';
 
 import TestUtils from 'react-addons-test-utils';
-var Simulate = TestUtils.Simulate;
+const Simulate = TestUtils.Simulate;
 import expect from 'expect.js';
 import async from 'async';
-import {KeyCode} from 'rc-util';
-
 import DateTimeFormat from 'gregorian-calendar-format';
-import GregorianCalendar from 'gregorian-calendar';
 import zhCn from 'gregorian-calendar/lib/locale/zh_CN';
 import TimePickerLocale from '../src/locale/zh_CN';
 
-describe('Select', function () {
-  var container;
+function formatTime(time, formatter) {
+  return formatter.parse(time, {
+    locale: zhCn,
+    obeyCount: true,
+  });
+}
+
+describe('Select', () => {
+  let container;
 
   function renderPicker(props) {
-    var showSecond = true;
-    var formatter = new DateTimeFormat('HH:mm:ss');
+    const showSecond = true;
+    const formatter = new DateTimeFormat('HH:mm:ss');
 
     return ReactDOM.render(
       <TimePicker
@@ -30,80 +34,70 @@ describe('Select', function () {
       />, container);
   }
 
-  function formatTime(time, formatter) {
-    return formatter.parse(time, {
-      locale: zhCn,
-      obeyCount: true,
-    });
-  }
-
-  beforeEach(function () {
+  beforeEach(() => {
     container = document.createElement('div');
     document.body.appendChild(container);
   });
 
-  afterEach(function () {
+  afterEach(() => {
     ReactDOM.unmountComponentAtNode(container);
     document.body.removeChild(container);
   });
 
-  describe('select number', function () {
-
-    it('select number correctly', function (done) {
-      var picker = renderPicker();
+  describe('select number', () => {
+    it('select number correctly', (done) => {
+      const picker = renderPicker();
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
-      var selector;
-      async.series([function (next) {
+      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);
-      }, function (next) {
+      }, (next) => {
         expect(picker.state.open).to.be(true);
         selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select');
 
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(selector.length).to.be(3);
 
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
-
   });
 
-  describe('select to change value', function () {
-
-    it('hour correctly', function (done) {
-      var change;
-      var picker = renderPicker({
-        onChange: function (v) {
+  describe('select to change value', () => {
+    it('hour correctly', (done) => {
+      let change;
+      const picker = renderPicker({
+        onChange(v) {
           change = v;
-        }
+        },
       });
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
-      var header;
-      async.series([function (next) {
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
+      let header;
+      async.series([(next) => {
         expect(picker.state.open).to.be(false);
 
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(picker.state.open).to.be(true);
         header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-input')[0];
-        var selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[0];
-        var option = selector.getElementsByTagName('li')[19];
+        const selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[0];
+        const option = selector.getElementsByTagName('li')[19];
         expect(header).to.be.ok();
         expect(ReactDOM.findDOMNode(header).value).to.be('01:02:03');
         expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
 
         Simulate.click(option);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(change).to.be.ok();
         expect(change.getHourOfDay()).to.be(19);
         expect(ReactDOM.findDOMNode(header).value).to.be('19:02:03');
@@ -111,38 +105,38 @@ describe('Select', function () {
         expect(picker.state.open).to.be.ok();
 
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
 
-    it('minute correctly', function (done) {
-      var change;
-      var picker = renderPicker({
-        onChange: function (v) {
+    it('minute correctly', (done) => {
+      let change;
+      const picker = renderPicker({
+        onChange(v) {
           change = v;
-        }
+        },
       });
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
-      var header;
-      async.series([function (next) {
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
+      let header;
+      async.series([(next) => {
         expect(picker.state.open).to.be(false);
 
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(picker.state.open).to.be(true);
         header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-input')[0];
-        var selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[1];
-        var option = selector.getElementsByTagName('li')[19];
+        const selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[1];
+        const option = selector.getElementsByTagName('li')[19];
         expect(header).to.be.ok();
         expect(ReactDOM.findDOMNode(header).value).to.be('01:02:03');
         expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
 
         Simulate.click(option);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(change).to.be.ok();
         expect(change.getMinutes()).to.be(19);
         expect(ReactDOM.findDOMNode(header).value).to.be('01:19:03');
@@ -150,38 +144,38 @@ describe('Select', function () {
         expect(picker.state.open).to.be.ok();
 
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
 
-    it('second correctly', function (done) {
-      var change;
-      var picker = renderPicker({
-        onChange: function (v) {
+    it('second correctly', (done) => {
+      let change;
+      const picker = renderPicker({
+        onChange(v) {
           change = v;
-        }
+        },
       });
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
-      var header;
-      async.series([function (next) {
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
+      let header;
+      async.series([(next) => {
         expect(picker.state.open).to.be(false);
 
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(picker.state.open).to.be(true);
         header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-input')[0];
-        var selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[2];
-        var option = selector.getElementsByTagName('li')[19];
+        const selector = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-select')[2];
+        const option = selector.getElementsByTagName('li')[19];
         expect(header).to.be.ok();
         expect(ReactDOM.findDOMNode(header).value).to.be('01:02:03');
         expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
 
         Simulate.click(option);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(change).to.be.ok();
         expect(change.getSeconds()).to.be(19);
         expect(ReactDOM.findDOMNode(header).value).to.be('01:02:19');
@@ -189,10 +183,9 @@ describe('Select', function () {
         expect(picker.state.open).to.be.ok();
 
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
-
   });
 });
-- 
cgit v1.2.3

