-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes `Event` constructor to improve `Event Web API` compatibility. The test added was written by referring to `wpt@dom/events/Event-constructors.any.js`. Signed-off-by: Daeyeon Jeong [email protected] PR-URL: #43461 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: LiviaMedeiros <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 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
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,29 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const { test, assert_equals, assert_array_equals } = | ||
require('../common/wpt').harness; | ||
|
||
// Source: https://github.com/web-platform-tests/wpt/blob/6cef1d2087d6a07d7cc6cee8cf207eec92e27c5f/dom/events/Event-constructors.any.js#L91-L112 | ||
test(function() { | ||
const called = []; | ||
const ev = new Event('Xx', { | ||
get cancelable() { | ||
called.push('cancelable'); | ||
return false; | ||
}, | ||
get bubbles() { | ||
called.push('bubbles'); | ||
return true; | ||
}, | ||
get sweet() { | ||
called.push('sweet'); | ||
return 'x'; | ||
}, | ||
}); | ||
assert_array_equals(called, ['bubbles', 'cancelable']); | ||
assert_equals(ev.type, 'Xx'); | ||
assert_equals(ev.bubbles, true); | ||
assert_equals(ev.cancelable, false); | ||
assert_equals(ev.sweet, undefined); | ||
}); |