-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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. PR-URL: #34169 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
- Loading branch information
1 parent
5c0ddbc
commit 8a6cabb
Showing
3 changed files
with
83 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