-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add WPT AddEventListenerOptions-once test
add reference comments for WPT tests convert to common mustCall Update test/parallel/test-eventtarget-whatwg-once.js Co-authored-by: James M Snell <[email protected]> Update test/parallel/test-eventtarget-whatwg-passive.js Co-authored-by: James M Snell <[email protected]> convert other tests to utilize common mustcall improve test with bind add customevent wpt add no-unused-vars comment reorder header utilize common.mustcall remove internal and use global EventTarget
- Loading branch information
1 parent
36fbbe0
commit 7f6ada3
Showing
3 changed files
with
85 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
const { strictEqual, throws, equal } = require('assert'); | ||
|
||
// Manually converted from https://github.com/web-platform-tests/wpt/blob/master/dom/events/CustomEvent.html | ||
// in order to define the `document` ourselves | ||
|
||
{ | ||
const type = 'foo'; | ||
const target = new EventTarget(); | ||
|
||
target.addEventListener(type, common.mustCall((evt) => { | ||
strictEqual(evt.type, type); | ||
})); | ||
|
||
target.dispatchEvent(new Event(type)); | ||
} | ||
|
||
{ | ||
throws(() => { | ||
new Event(); | ||
}, TypeError); | ||
} | ||
|
||
{ | ||
const event = new Event('foo'); | ||
equal(event.type, 'foo'); | ||
equal(event.bubbles, false); | ||
equal(event.cancelable, false); | ||
equal(event.detail, null); | ||
} |
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
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