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/TimePicker.spec.jsx | 101 +++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 54 deletions(-)

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

diff --git a/tests/TimePicker.spec.jsx b/tests/TimePicker.spec.jsx
index 5bd056e..95a1fd1 100644
--- a/tests/TimePicker.spec.jsx
+++ b/tests/TimePicker.spec.jsx
@@ -3,21 +3,27 @@ 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 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('TimePicker', function () {
-  var container;
+function formatTime(time, formatter) {
+  return formatter.parse(time, {
+    locale: zhCn,
+    obeyCount: true,
+  });
+}
+
+describe('TimePicker', () => {
+  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,8 +36,8 @@ describe('TimePicker', function () {
   }
 
   function renderPickerWithoutSeconds(props) {
-    var showSecond = false;
-    var formatter = new DateTimeFormat('HH:mm');
+    const showSecond = false;
+    const formatter = new DateTimeFormat('HH:mm');
 
     return ReactDOM.render(
       <TimePicker
@@ -43,44 +49,37 @@ describe('TimePicker', 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('render panel to body', function () {
-    it('popup correctly', function (done) {
-      var change;
-      var picker = renderPicker({
-        onChange: function (v) {
+  describe('render panel to body', () => {
+    it('popup 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];
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
       expect(ReactDOM.findDOMNode(input).value).to.be('12:57:58');
-      async.series([function (next) {
+      async.series([(next) => {
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-inner')[0]).to.be.ok();
         expect(picker.state.open).to.be(true);
-        var hour = TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[1];
+        const hour = TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[1];
         Simulate.click(hour);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(change).to.be.ok();
         expect(change.getHourOfDay()).to.be(1);
         expect(change.getMinutes()).to.be(57);
@@ -88,24 +87,19 @@ describe('TimePicker', function () {
         expect(ReactDOM.findDOMNode(input).value).to.be('01:57:58');
         expect(picker.state.open).to.be.ok();
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
 
-    it('destroy correctly', function (done) {
-      var change;
-      var picker = renderPicker({
-        onChange: function (v) {
-          change = v;
-        }
-      });
+    it('destroy correctly', (done) => {
+      const picker = renderPicker();
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
-      async.series([function (next) {
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
+      async.series([(next) => {
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-panel-inner')[0]).not.to.be.ok();
         expect(picker.state.open).to.be(true);
         if (document.querySelectorAll) {
@@ -114,49 +108,48 @@ describe('TimePicker', function () {
         expect(TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[0]).to.be.ok();
         ReactDOM.unmountComponentAtNode(container);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         if (document.querySelectorAll) {
           expect(document.querySelectorAll('.rc-time-picker').length).to.be(0);
         }
         expect(picker.panelInstance).not.to.be.ok();
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
   });
 
-  describe('render panel to body (without seconds)', function () {
-    it('popup correctly', function (done) {
-      var change;
-      var picker = renderPickerWithoutSeconds({
-        onChange: function (v) {
+  describe('render panel to body (without seconds)', () => {
+    it('popup correctly', (done) => {
+      let change;
+      const picker = renderPickerWithoutSeconds({
+        onChange(v) {
           change = v;
-        }
+        },
       });
       expect(picker.state.open).not.to.be.ok();
-      var input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
+      const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
       expect(ReactDOM.findDOMNode(input).value).to.be('08:24');
-      async.series([function (next) {
+      async.series([(next) => {
         Simulate.click(input);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-inner')[0]).to.be.ok();
         expect(picker.state.open).to.be(true);
-        var hour = TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[1];
+        const hour = TestUtils.scryRenderedDOMComponentsWithTag(picker.panelInstance, 'li')[1];
         Simulate.click(hour);
         setTimeout(next, 100);
-      }, function (next) {
+      }, (next) => {
         expect(change).to.be.ok();
         expect(change.getHourOfDay()).to.be(1);
         expect(change.getMinutes()).to.be(24);
         expect(ReactDOM.findDOMNode(input).value).to.be('01:24');
         expect(picker.state.open).to.be.ok();
         next();
-      }], function () {
+      }], () => {
         done();
       });
     });
   });
-
 });
-- 
cgit v1.2.3

