Skip to content

Commit

Permalink
fixup! add nested listener test
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamingr committed Nov 19, 2020
1 parent 0811102 commit 279129b
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 @@ -116,3 +116,18 @@ test(function() {
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");

test(function() {
const et = new EventTarget();
const ac = new AbortController();
let count = 0;
et.addEventListener('foo', () => {
et.addEventListener('foo', () => {
count++;
if (count > 5) ac.abort();
et.dispatchEvent(new Event('foo'));
}, { signal: ac.signal });
et.dispatchEvent(new Event('foo'));
}, { once: true });
et.dispatchEvent(new Event('foo'));
}, "Aborting from a nested listener should remove it");

0 comments on commit 279129b

Please sign in to comment.