From 6459f410e744a515d4b1324bcbb0ce257b589597 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Thu, 26 Jan 2017 15:09:01 -0800 Subject: [PATCH] [Frontend] Code style cleanups in Timer *spec files Fixes #623 Moved testState() function placement in code; Added semicolons; --- .../test/actions/PauseTimerActionSpec.js | 24 +++++++++---------- .../test/actions/RestartTimerActionSpec.js | 24 +++++++++---------- .../test/actions/StartTimerActionSpec.js | 24 +++++++++---------- .../clock/test/actions/StopTimerActionSpec.js | 24 +++++++++---------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/platform/features/clock/test/actions/PauseTimerActionSpec.js b/platform/features/clock/test/actions/PauseTimerActionSpec.js index 7cf230968f..098e29c634 100644 --- a/platform/features/clock/test/actions/PauseTimerActionSpec.js +++ b/platform/features/clock/test/actions/PauseTimerActionSpec.js @@ -39,6 +39,18 @@ define( }; } + function testState(type, timerState, timestamp, expected) { + testModel.type = type; + testModel.timerState = timerState; + testModel.timestamp = timestamp; + + if (expected) { + expect(PauseTimerAction.appliesTo(testContext)).toBeTruthy(); + } else { + expect(PauseTimerAction.appliesTo(testContext)).toBeFalsy(); + } + } + beforeEach(function () { mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( @@ -88,18 +100,6 @@ define( //not a timer testState('clock', 'started', 12000, false); }); - - function testState(type, timerState, timestamp, expected) { - testModel.type = type; - testModel.timerState = timerState; - testModel.timestamp = timestamp; - - if (expected) { - expect(PauseTimerAction.appliesTo(testContext)).toBeTruthy() - } else { - expect(PauseTimerAction.appliesTo(testContext)).toBeFalsy() - } - } }); } ); diff --git a/platform/features/clock/test/actions/RestartTimerActionSpec.js b/platform/features/clock/test/actions/RestartTimerActionSpec.js index e1bddbe4eb..fc1978322f 100644 --- a/platform/features/clock/test/actions/RestartTimerActionSpec.js +++ b/platform/features/clock/test/actions/RestartTimerActionSpec.js @@ -39,6 +39,18 @@ define( }; } + function testState(type, timerState, timestamp, expected) { + testModel.type = type; + testModel.timerState = timerState; + testModel.timestamp = timestamp; + + if (expected) { + expect(RestartTimerAction.appliesTo(testContext)).toBeTruthy(); + } else { + expect(RestartTimerAction.appliesTo(testContext)).toBeFalsy(); + } + } + beforeEach(function () { mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( @@ -94,18 +106,6 @@ define( //not a timer testState('clock', 'paused', 12000, false); }); - - function testState(type, timerState, timestamp, expected) { - testModel.type = type; - testModel.timerState = timerState; - testModel.timestamp = timestamp; - - if (expected) { - expect(RestartTimerAction.appliesTo(testContext)).toBeTruthy() - } else { - expect(RestartTimerAction.appliesTo(testContext)).toBeFalsy() - } - } }); } ); diff --git a/platform/features/clock/test/actions/StartTimerActionSpec.js b/platform/features/clock/test/actions/StartTimerActionSpec.js index a7a34f2043..1506c79738 100644 --- a/platform/features/clock/test/actions/StartTimerActionSpec.js +++ b/platform/features/clock/test/actions/StartTimerActionSpec.js @@ -39,6 +39,18 @@ define( }; } + function testState(type, timerState, timestamp, expected) { + testModel.type = type; + testModel.timerState = timerState; + testModel.timestamp = timestamp; + + if (expected) { + expect(StartTimerAction.appliesTo(testContext)).toBeTruthy(); + } else { + expect(StartTimerAction.appliesTo(testContext)).toBeFalsy(); + } + } + beforeEach(function () { mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( @@ -93,18 +105,6 @@ define( //not a timer testState('clock', 'paused', 12000, false); }); - - function testState(type, timerState, timestamp, expected) { - testModel.type = type; - testModel.timerState = timerState; - testModel.timestamp = timestamp; - - if (expected) { - expect(StartTimerAction.appliesTo(testContext)).toBeTruthy() - } else { - expect(StartTimerAction.appliesTo(testContext)).toBeFalsy() - } - } }); } ); diff --git a/platform/features/clock/test/actions/StopTimerActionSpec.js b/platform/features/clock/test/actions/StopTimerActionSpec.js index e54d7ca514..a4c27ad921 100644 --- a/platform/features/clock/test/actions/StopTimerActionSpec.js +++ b/platform/features/clock/test/actions/StopTimerActionSpec.js @@ -39,6 +39,18 @@ define( }; } + function testState(type, timerState, timestamp, expected) { + testModel.type = type; + testModel.timerState = timerState; + testModel.timestamp = timestamp; + + if (expected) { + expect(StopTimerAction.appliesTo(testContext)).toBeTruthy(); + } else { + expect(StopTimerAction.appliesTo(testContext)).toBeFalsy(); + } + } + beforeEach(function () { mockNow = jasmine.createSpy('now'); mockDomainObject = jasmine.createSpyObj( @@ -93,18 +105,6 @@ define( //not a timer testState('clock', 'paused', 12000, false); }); - - function testState(type, timerState, timestamp, expected) { - testModel.type = type; - testModel.timerState = timerState; - testModel.timestamp = timestamp; - - if (expected) { - expect(StopTimerAction.appliesTo(testContext)).toBeTruthy() - } else { - expect(StopTimerAction.appliesTo(testContext)).toBeFalsy() - } - } }); } );