forked from hotwired/turbo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test coverage for event listener leaking
Add test coverage to [hotwired#454][]. While the original fix was important to ship, it was unclear how to guard against re-introducing the leaks. This commit introduces the `withoutChangingEventListenersCount()` test helper to wrap a block within the test harness. While executing within the block, the driven page's `document.addEventListener` and `document.removeEventListener` functions are replaced with decorated functions that increment and decrement a counter. At the start of the block, capture and return how many times `addEventListener` has been invoked without a matching `removeEventListener`. At the end, capture and return the differential. [hotwired#454]: hotwired#454
- Loading branch information
1 parent
ce984f4
commit 774b4b9
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters