Files
jasmine/spec/html/SpyRegistryHtmlSpec.js
Steve Gravrock 434575f49d Use one declaration per statement
The old style of merging all of a function's variable declarations into
a single statement made some sense back in the days of var, but there's
no reason to keep doing it now that we use const and let.
2026-03-11 06:30:46 -07:00

26 lines
675 B
JavaScript

describe('Spy Registry browser-specific behavior', function() {
function createSpy(name, originalFn) {
return privateUnderTest.Spy(name, originalFn);
}
it('can spy on and unspy window.onerror', function() {
const spies = [];
const spyRegistry = new privateUnderTest.SpyRegistry({
currentSpies: function() {
return spies;
},
createSpy: createSpy,
global: window
});
const originalHandler = window.onerror;
try {
spyRegistry.spyOn(window, 'onerror');
spyRegistry.clearSpies();
expect(window.onerror).toBe(originalHandler);
} finally {
window.onerror = originalHandler;
}
});
});