Commit d5ace953 authored by Robert Knight's avatar Robert Knight

Reset callback before checking for absence of call

This pattern makes it clearer that we are testing for a callback not
being invoked after a sequence of events.
parent f7ab8ac0
......@@ -235,12 +235,13 @@ describe('annotator/frame-observer', () => {
const unsubscribe = onDocumentReady(frame, callback);
await waitForCall(callback);
callback.resetHistory();
unsubscribe();
frame.src = sameOriginURL + '?v2';
await waitForEvent(frame, 'load');
assert.calledOnce(callback);
assert.notCalled(callback);
});
it('does not start polling if "unload" event is received after subscription is canceled', async () => {
......@@ -253,6 +254,7 @@ describe('annotator/frame-observer', () => {
const unsubscribe = onDocumentReady(frame, callback);
clock.tick();
assert.calledOnce(callback);
callback.resetHistory();
const contentWindow = frame.contentWindow;
unsubscribe();
......@@ -262,7 +264,7 @@ describe('annotator/frame-observer', () => {
await waitForEvent(frame, 'load');
clock.tick(50); // Wait for any active polling to trigger
assert.calledOnce(callback);
assert.notCalled(callback);
} finally {
clock.restore();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment