[Timer] Updated Timer UI and fixed tests
Added peeking stop button to view, added legacy and first run support, added new and fixed old tests
This commit is contained in:
@@ -63,26 +63,39 @@ define(
|
||||
});
|
||||
|
||||
it("updates the model with a timestamp", function () {
|
||||
testModel.pausedTime = 12000;
|
||||
mockNow.andReturn(12000);
|
||||
action.perform();
|
||||
expect(testModel.timestamp).toEqual(12000);
|
||||
});
|
||||
|
||||
it("applies only to timers in a non-stopped state", function () {
|
||||
//in a stopped state
|
||||
testStates(testModel, 'timer', undefined, undefined, false);
|
||||
|
||||
//in a paused state
|
||||
testStates(testModel, 'timer', 'pause', undefined, true);
|
||||
|
||||
//in a playing state
|
||||
testStates(testModel, 'timer', 'play', undefined, true);
|
||||
|
||||
//not a timer
|
||||
testStates(testModel, 'clock', 'pause', undefined, false);
|
||||
it("updates the model with a pausedTime", function () {
|
||||
testModel.pausedTime = 12000;
|
||||
action.perform();
|
||||
expect(testModel.pausedTime).toEqual(undefined);
|
||||
});
|
||||
|
||||
function testStates(testModel, type, timerState, timestamp, expected) {
|
||||
it("updates the model with a timerState", function () {
|
||||
testModel.timerState = 'stopped';
|
||||
action.perform();
|
||||
expect(testModel.timerState).toEqual('started');
|
||||
});
|
||||
|
||||
it("applies only to timers in a non-stopped state", function () {
|
||||
//in a stopped state
|
||||
testState('timer', 'stopped', undefined, false);
|
||||
|
||||
//in a paused state
|
||||
testState('timer', 'paused', 12000, true);
|
||||
|
||||
//in a playing state
|
||||
testState('timer', 'started', 12000, true);
|
||||
|
||||
//not a timer
|
||||
testState('clock', 'paused', 12000, false);
|
||||
});
|
||||
|
||||
function testState(type, timerState, timestamp, expected) {
|
||||
testModel.type = type;
|
||||
testModel.timerState = timerState;
|
||||
testModel.timestamp = timestamp;
|
||||
@@ -92,11 +105,6 @@ define(
|
||||
} else {
|
||||
expect(RestartTimerAction.appliesTo(testContext)).toBeFalsy()
|
||||
}
|
||||
|
||||
//first test without time, this test with time
|
||||
if (timestamp === undefined) {
|
||||
testStates(testModel, type, timerState, 12000, expected);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user