Fixing global leak for 'timer'

This commit is contained in:
Davis W. Frank
2013-10-24 17:16:57 -07:00
parent 284bb0b608
commit 243ff80196
2 changed files with 2 additions and 21 deletions

View File

@@ -341,24 +341,4 @@ describe("Clock (acceptance)", function() {
clock.tick();
expect(delayedFn2).toHaveBeenCalled();
});
it("calls the global clearTimeout correctly when not installed", function() {
var delayedFunctionScheduler = jasmine.createSpyObj('delayedFunctionScheduler', ['clearTimeout']),
global = jasmine.getGlobal(),
clock = new j$.Clock(global, delayedFunctionScheduler);
expect(function() {
clock.clearTimeout(123)
}).not.toThrow();
});
it("calls the global clearTimeout correctly when not installed", function() {
var delayedFunctionScheduler = jasmine.createSpyObj('delayedFunctionScheduler', ['clearTimeout']),
global = jasmine.getGlobal(),
clock = new j$.Clock(global, delayedFunctionScheduler);
expect(function() {
clock.clearInterval(123)
}).not.toThrow();
});
});

View File

@@ -13,7 +13,8 @@ getJasmineRequireObj().Clock = function() {
setInterval: setInterval,
clearInterval: clearInterval
},
installed = false;
installed = false,
timer;
self.install = function() {
replace(global, fakeTimingFunctions);