Commit 80c90c20 authored by Bryce Johnson's avatar Bryce Johnson

Shush eslint.

parent 705ca18e
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
}, },
abbreviateTime(timeStr) { abbreviateTime(timeStr) {
return PrettyTime.abbreviateTime(timeStr); return PrettyTime.abbreviateTime(timeStr);
} },
}, },
template: ` template: `
<div class='time_tracker time-tracking-component-wrap' v-cloak> <div class='time_tracker time-tracking-component-wrap' v-cloak>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
class PrettyTime { class PrettyTime {
/* /*
* Accepts seconds (Number) and returns a timeObject: { weeks: #, days: #, hours: #, minutes: # }. * Accepts seconds and returns a timeObject { weeks: #, days: #, hours: #, minutes: # }
* Seconds can be negative or positive, zero or non-zero. * Seconds can be negative or positive, zero or non-zero.
*/ */
static parseSeconds(seconds) { static parseSeconds(seconds) {
......
//= require lib/utils/pretty_time //= require directives/tooltip_title
(() => { (() => {
const PrettyTime = gl.PrettyTime; const PrettyTime = gl.PrettyTime;
describe('PrettyTime methods', function() { describe('PrettyTime methods', function () {
describe('parseSeconds', function() { describe('parseSeconds', function () {
it('should correctly parse a negative value', function() { it('should correctly parse a negative value', function () {
const parser = PrettyTime.parseSeconds; const parser = PrettyTime.parseSeconds;
const zeroSeconds = parser(-1000); const zeroSeconds = parser(-1000);
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
expect(zeroSeconds.weeks).toBe(0); expect(zeroSeconds.weeks).toBe(0);
}); });
it('should correctly parse a zero value', function() { it('should correctly parse a zero value', function () {
const parser = PrettyTime.parseSeconds; const parser = PrettyTime.parseSeconds;
const zeroSeconds = parser(0); const zeroSeconds = parser(0);
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
expect(zeroSeconds.weeks).toBe(0); expect(zeroSeconds.weeks).toBe(0);
}); });
it('should correctly parse a small non-zero second values', function() { it('should correctly parse a small non-zero second values', function () {
const parser = PrettyTime.parseSeconds; const parser = PrettyTime.parseSeconds;
const subOneMinute = parser(10); const subOneMinute = parser(10);
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
expect(manyMinutes.weeks).toBe(0); expect(manyMinutes.weeks).toBe(0);
}); });
it('should correctly parse large second values', function() { it('should correctly parse large second values', function () {
const parser = PrettyTime.parseSeconds; const parser = PrettyTime.parseSeconds;
const aboveOneHour = parser(4800); const aboveOneHour = parser(4800);
...@@ -78,14 +78,13 @@ ...@@ -78,14 +78,13 @@
}); });
}); });
describe('stringifyTime', function() { describe('stringifyTime', function () {
it('should stringify values with all non-zero units', function() { it('should stringify values with all non-zero units', function () {
const timeObject = { const timeObject = {
weeks: 1, weeks: 1,
days: 4, days: 4,
hours: 7, hours: 7,
minutes: 20 minutes: 20,
}; };
const timeString = PrettyTime.stringifyTime(timeObject); const timeString = PrettyTime.stringifyTime(timeObject);
...@@ -93,12 +92,12 @@ ...@@ -93,12 +92,12 @@
expect(timeString).toBe('1w 4d 7h 20m'); expect(timeString).toBe('1w 4d 7h 20m');
}); });
it('should stringify values with some non-zero units', function() { it('should stringify values with some non-zero units', function () {
const timeObject = { const timeObject = {
weeks: 0, weeks: 0,
days: 4, days: 4,
hours: 0, hours: 0,
minutes: 20 minutes: 20,
}; };
const timeString = PrettyTime.stringifyTime(timeObject); const timeString = PrettyTime.stringifyTime(timeObject);
...@@ -106,12 +105,12 @@ ...@@ -106,12 +105,12 @@
expect(timeString).toBe('4d 20m'); expect(timeString).toBe('4d 20m');
}); });
it('should stringify values with no non-zero units', function() { it('should stringify values with no non-zero units', function () {
const timeObject = { const timeObject = {
weeks: 0, weeks: 0,
days: 0, days: 0,
hours: 0, hours: 0,
minutes: 0 minutes: 0,
}; };
const timeString = PrettyTime.stringifyTime(timeObject); const timeString = PrettyTime.stringifyTime(timeObject);
...@@ -120,13 +119,13 @@ ...@@ -120,13 +119,13 @@
}); });
}); });
describe('abbreviateTime', function() { describe('abbreviateTime', function () {
it('should abbreviate stringified times for weeks', function() { it('should abbreviate stringified times for weeks', function () {
const fullTimeString = '1w 3d 4h 5m'; const fullTimeString = '1w 3d 4h 5m';
expect(PrettyTime.abbreviateTime(fullTimeString)).toBe('1w'); expect(PrettyTime.abbreviateTime(fullTimeString)).toBe('1w');
}); });
it('should abbreviate stringified times for non-weeks', function() { it('should abbreviate stringified times for non-weeks', function () {
const fullTimeString = '0w 3d 4h 5m'; const fullTimeString = '0w 3d 4h 5m';
expect(PrettyTime.abbreviateTime(fullTimeString)).toBe('3d'); expect(PrettyTime.abbreviateTime(fullTimeString)).toBe('3d');
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment