Clear timeouts when starting to process a milli instead of at the end

- Fixes #1482
This commit is contained in:
Gregg Van Hove
2018-01-19 17:47:28 -08:00
parent c82e5947f5
commit 53529bdc9a
2 changed files with 17 additions and 1 deletions

View File

@@ -254,6 +254,22 @@ describe("DelayedFunctionScheduler", function() {
expect(fn.calls.count()).toBe(1);
});
it("does not remove a function that hasn't been added yet", function() {
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
fn = jasmine.createSpy('fn'),
fnDelay = 10,
timeoutKey;
scheduler.removeFunctionWithId('foo');
scheduler.scheduleFunction(fn, fnDelay, [], false, 'foo');
expect(fn).not.toHaveBeenCalled();
scheduler.tick(fnDelay + 1);
expect(fn).toHaveBeenCalled();
});
it("updates the mockDate per scheduled time", function () {
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
tickDate = jasmine.createSpy('tickDate');