fixup! fix(Clock): Ensure that uninstalling the clock also stops auto tick

This commit is contained in:
Andrew Scott
2025-05-01 10:25:24 -07:00
parent 84daa0f5dc
commit 3ecddc2555

View File

@@ -699,16 +699,19 @@ describe('Clock (acceptance)', function() {
tick: function() {}, tick: function() {},
uninstall: function() {} uninstall: function() {}
}; };
// window setTimeout to window to make firefox happy
const _setTimeout =
typeof window !== 'undefined' ? setTimeout.bind(window) : setTimeout;
// passing a fake global allows us to preserve the real timing functions for use in tests
const _global = { setTimeout: _setTimeout, setInterval: setInterval };
clock = new jasmineUnderTest.Clock( clock = new jasmineUnderTest.Clock(
// We use the real window for global or firefox is displeased when we try to call a real setTimeout on an object "that doesn't implement window". _global,
typeof window !== 'undefined' ? window : { setTimeout: setTimeout },
function() { function() {
return delayedFunctionScheduler; return delayedFunctionScheduler;
}, },
mockDate mockDate
); );
clock.install(); clock.install().autoTick();
clock.autoTick();
}); });
afterEach(() => { afterEach(() => {