Permalink
Browse files

Clean up jscs and jshint errors in tests.

  • Loading branch information...
1 parent d5262a0 commit 9494aaf8b432a470cd0dfabed2b0feed0a9d43bd @timrwood timrwood committed with ichernev Jan 17, 2015
View
@@ -63,5 +63,6 @@
"validateQuoteMarks": {
"mark": "'",
"escape": true
- }
+ },
+ "esnext": true
}
View
@@ -0,0 +1,31 @@
+{
+ "node" : true,
+ "browser" : true,
+ "boss" : false,
+ "curly" : true,
+ "debug" : false,
+ "devel" : false,
+ "eqeqeq" : true,
+ "eqnull" : true,
+ "esnext" : true,
+ "evil" : false,
+ "forin" : false,
+ "immed" : false,
+ "laxbreak" : false,
+ "newcap" : true,
+ "noarg" : true,
+ "noempty" : false,
+ "nonew" : false,
+ "onevar" : true,
+ "plusplus" : false,
+ "regexp" : false,
+ "undef" : true,
+ "sub" : true,
+ "strict" : false,
+ "white" : true,
+ "es3" : false,
+ "camelcase" : true,
+ "globals": {
+ "define": false
+ }
+}
View
@@ -133,34 +133,7 @@ module.exports = function (grunt) {
'!test/browser*.js'
],
options: {
- 'node' : true,
- 'browser' : true,
- 'boss' : false,
- 'curly' : true,
- 'debug' : false,
- 'devel' : false,
- 'eqeqeq' : true,
- 'eqnull' : true,
- 'evil' : false,
- 'forin' : false,
- 'immed' : false,
- 'laxbreak' : false,
- 'newcap' : true,
- 'noarg' : true,
- 'noempty' : false,
- 'nonew' : false,
- 'onevar' : true,
- 'plusplus' : false,
- 'regexp' : false,
- 'undef' : true,
- 'sub' : true,
- 'strict' : false,
- 'white' : true,
- 'es3' : true,
- 'camelcase' : true,
- 'globals': {
- 'define': false
- }
+ jshintrc: true
}
},
jscs: {
@@ -1,6 +1,8 @@
-export default function (array, callback) {
+function each(array, callback) {
var i;
for (i = 0; i < array.length; i++) {
callback(array[i], i, array);
}
}
+
+export default each;
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("add and subtract");
+module('add and subtract');
test('add short reverse args', function (assert) {
var a = moment(), b, c, d;
View
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("create");
+module('create');
test('array', function (assert) {
assert.ok(moment([2010]).toDate() instanceof Date, '[2010]');
@@ -344,12 +344,12 @@ test('string with array of formats', function (assert) {
['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ'])
.format('YYYY-MM-DD'), '2011-07-01', 'Works for long strings');
- assert.equal(moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'escape RegExp special characters on comparing');
+ assert.equal(moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'escape RegExp special characters on comparing');
- assert.equal(moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year');
- assert.equal(moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year');
+ assert.equal(moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year');
+ assert.equal(moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year');
- assert.equal(moment('01', ['MM', 'DD'])._f, 'MM', 'Should use first valid format');
+ assert.equal(moment('01', ['MM', 'DD'])._f, 'MM', 'Should use first valid format');
});
test('string with array of formats + ISO', function (assert) {
@@ -1,15 +1,15 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
-import each from "../helpers/each";
+import { module, test } from '../qunit';
+import moment from '../../moment';
+import each from '../helpers/each';
module('days in month');
test('days in month', function (assert) {
each([31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], function (days, i) {
- var firstDay = moment([2012, i]);
- var lastDay = moment([2012, i, days]);
+ var firstDay = moment([2012, i]),
+ lastDay = moment([2012, i, days]);
assert.equal(firstDay.daysInMonth(), days, firstDay.format('L') + ' should have ' + days + ' days.');
- assert.equal( lastDay.daysInMonth(), days, lastDay.format('L') + ' should have ' + days + ' days.');
+ assert.equal(lastDay.daysInMonth(), days, lastDay.format('L') + ' should have ' + days + ' days.');
});
});
View
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
function equal(assert, a, b, message) {
assert.ok(Math.abs(a - b) < 0.00000001, '(' + a + ' === ' + b + ') ' + message);
@@ -103,7 +103,7 @@ test('diff month', function (assert) {
});
test('diff across DST', function (assert) {
- var dst = dstForYear(2012), a, b, daysInMonth;
+ var dst = dstForYear(2012), a, b, daysInMonth;
if (!dst) {
return;
}
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('duration');
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('duration from moments');
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('format');
@@ -119,9 +119,9 @@ test('escaping quotes', function (assert) {
moment.locale('en');
var date = moment([2012, 0]);
assert.equal(date.format('MMM \'YY'), 'Jan \'12', 'Should be able to format with single parenthesis');
- assert.equal(date.format("MMM 'YY"), 'Jan \'12', 'Should be able to format with double parenthesis');
+ assert.equal(date.format('MMM "YY'), 'Jan "12', 'Should be able to format with double parenthesis');
assert.equal(date.format('MMM \'YY'), 'Jan \'12', 'Should be able to format with single parenthesis');
- assert.equal(date.format("MMM 'YY"), 'Jan \'12', 'Should be able to format with double parenthesis');
+ assert.equal(date.format('MMM "YY'), 'Jan "12', 'Should be able to format with double parenthesis');
});
test('toJSON', function (assert) {
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('getters and setters');
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('invalid');
@@ -1,5 +1,5 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
module('is after');
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is before");
+module('is before');
test('is after without units', function (assert) {
var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is between");
+module('is between');
test('is between without units', function (assert) {
var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
@@ -1,11 +1,11 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is date");
+module('is date');
test('isDate recognizes Date objects', function (assert) {
assert.ok(moment.isDate(new Date()), 'no args (now)');
- assert.ok(moment.isDate(new Date([2014, 02, 15])), 'array args');
+ assert.ok(moment.isDate(new Date([2014, 2, 15])), 'array args');
assert.ok(moment.isDate(new Date('2014-03-15')), 'string args');
assert.ok(moment.isDate(new Date('does NOT look like a date')), 'invalid date');
});
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is moment");
+module('is moment');
test('is moment object', function (assert) {
var MyObj = function () {},
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is same");
+module('is same');
test('is same without units', function (assert) {
var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("is valid");
+module('is valid');
test('array bad month', function (assert) {
assert.equal(moment([2010, -1]).isValid(), false, 'month -1 invalid');
@@ -135,7 +135,7 @@ test('invalidAt', function (assert) {
assert.equal(moment([2000, 12]).invalidAt(), 1, 'month 12 is invalid: 0-11');
assert.equal(moment([2000, 1, 30]).invalidAt(), 2, '30 is not a valid february day');
assert.equal(moment([2000, 1, 29, 25]).invalidAt(), 3, '25 is invalid hour');
- assert.equal(moment([2000, 1, 29, 24, 01]).invalidAt(), 3, '24:01 is invalid hour');
+ assert.equal(moment([2000, 1, 29, 24, 1]).invalidAt(), 3, '24:01 is invalid hour');
assert.equal(moment([2000, 1, 29, 23, 60]).invalidAt(), 4, '60 is invalid minute');
assert.equal(moment([2000, 1, 29, 23, 59, 60]).invalidAt(), 5, '60 is invalid second');
assert.equal(moment([2000, 1, 29, 23, 59, 59, 1000]).invalidAt(), 6, '1000 is invalid millisecond');
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("leap year");
+module('leap year');
test('leap year', function (assert) {
assert.equal(moment([2010, 0, 1]).isLeapYear(), false, '2010');
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("listers");
+module('listers');
test('default', function (assert) {
assert.deepEqual(moment.months(), ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
View
@@ -1,33 +1,33 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
-import each from "../helpers/each";
+import { module, test } from '../qunit';
+import moment from '../../moment';
+import each from '../helpers/each';
-module("locale", {
+module('locale', {
setup : function () {
// TODO: Remove once locales are switched to ES6
each([{
- name: "en-gb",
+ name: 'en-gb',
data: {}
}, {
- name: "en-ca",
+ name: 'en-ca',
data: {}
}, {
- name: "es",
+ name: 'es',
data: {
- relativeTime: { past: 'hace %s', s: 'unos segundos', d: 'un día' },
+ relativeTime: {past: 'hace %s', s: 'unos segundos', d: 'un día'},
months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_')
}
}, {
- name: "fr",
+ name: 'fr',
data: {}
}, {
- name: "fr-ca",
+ name: 'fr-ca',
data: {}
}, {
- name: "it",
+ name: 'it',
data: {}
}, {
- name: "zh-cn",
+ name: 'zh-cn',
data: {
months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_')
}
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("min max");
+module('min max');
test('min', function (assert) {
var now = moment(),
@@ -1,7 +1,7 @@
-import { module, test } from "../qunit";
-import moment from "../../moment";
+import { module, test } from '../qunit';
+import moment from '../../moment';
-module("mutable");
+module('mutable');
test('manipulation methods', function (assert) {
var m = moment();
Oops, something went wrong.

0 comments on commit 9494aaf

Please sign in to comment.