Skip to content

Commit

Permalink
fixup! github suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamingr committed Nov 19, 2020
1 parent 5946d26 commit 0811102
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dom/events/AddEventListenerOptions-signal.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,18 @@ test(function() {
et.dispatchEvent(new Event('test'));
assert_equals(count, 0, "The listener was still removed");
}, "Aborting from a listener does not call future listeners");

test(function() {
let count = 0;
function handler() {
count++;
}
const et = new EventTarget();
const controller = new AbortController();
et.addEventListener('test', () => {
et.addEventListener('test', handler, { signal: controller.signal });
controller.abort();
}, { signal: controller.signal });
et.dispatchEvent(new Event('test'));
assert_equals(count, 0, "The listener was still removed");
}, "Adding then aborting a listener in another listener does not call it");

0 comments on commit 0811102

Please sign in to comment.