Skip to content

Commit 127f260

Browse files
TimothyGumoz-wptsync-bot
authored andcommitted
Bug 1478947 [wpt PR 12201] - HTML: tests for new event handler spec, a=testonly
Automatic update from web-platform-testsHTML event handlers: More uniform naming convention -- HTML event handlers: Use .window.js instead of .html for some files -- HTML event handlers: Use IDL parser for list of event handlers -- HTML event handlers: Use synchronous test() where able -- HTML event handlers: Additionally test unshadowed event handlers -- HTML: tests for new event handler spec See: whatwg/html#3850 -- HTML event handlers: Test document.createElement("body") -- wpt-commits: db24506f8af9048c0a80d89c9981ef445d6c3af9, 3e273bc58ae2af40f4b00b514f2fd6d604ffc98d, 8bf45a39c3435737ebc862904af245d27b68efce, 776041862ca0cab7a8dd10e29361dbf3359a0b2f, fa58a12fc565fc152bff196e803fd9290dfa1bc7, fc2eba9d6f0a860c0db1457852124e320fd8d499, 8e668a6b63e5dbb68304c182fdc1f7b4e6edaf96 wpt-pr: 12201
1 parent 6bdeb33 commit 127f260

12 files changed

+363
-197
lines changed

testing/web-platform/meta/MANIFEST.json

+53-24
Original file line numberDiff line numberDiff line change
@@ -287318,6 +287318,11 @@
287318287318
{}
287319287319
]
287320287320
],
287321+
"html/webappapis/scripting/events/resources/event-handler-body.js": [
287322+
[
287323+
{}
287324+
]
287325+
],
287321287326
"html/webappapis/scripting/events/resources/open-window.html": [
287322287327
[
287323287328
{}
@@ -361544,12 +361549,6 @@
361544361549
{}
361545361550
]
361546361551
],
361547-
"html/webappapis/scripting/events/body-exposed-window-event-handlers.html": [
361548-
[
361549-
"/html/webappapis/scripting/events/body-exposed-window-event-handlers.html",
361550-
{}
361551-
]
361552-
],
361553361552
"html/webappapis/scripting/events/body-onload.html": [
361554361553
[
361555361554
"/html/webappapis/scripting/events/body-onload.html",
@@ -361580,6 +361579,12 @@
361580361579
{}
361581361580
]
361582361581
],
361582+
"html/webappapis/scripting/events/event-handler-attributes-windowless-body.html": [
361583+
[
361584+
"/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html",
361585+
{}
361586+
]
361587+
],
361583361588
"html/webappapis/scripting/events/event-handler-javascript.html": [
361584361589
[
361585361590
"/html/webappapis/scripting/events/event-handler-javascript.html",
@@ -361670,9 +361675,15 @@
361670361675
{}
361671361676
]
361672361677
],
361673-
"html/webappapis/scripting/events/event-handler-spec-example.html": [
361678+
"html/webappapis/scripting/events/event-handler-removal.window.js": [
361679+
[
361680+
"/html/webappapis/scripting/events/event-handler-removal.window.html",
361681+
{}
361682+
]
361683+
],
361684+
"html/webappapis/scripting/events/event-handler-spec-example.window.js": [
361674361685
[
361675-
"/html/webappapis/scripting/events/event-handler-spec-example.html",
361686+
"/html/webappapis/scripting/events/event-handler-spec-example.window.html",
361676361687
{}
361677361688
]
361678361689
],
@@ -361688,15 +361699,21 @@
361688361699
{}
361689361700
]
361690361701
],
361691-
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.html": [
361702+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js": [
361703+
[
361704+
"/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.html",
361705+
{}
361706+
]
361707+
],
361708+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js": [
361692361709
[
361693-
"/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.html",
361710+
"/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.html",
361694361711
{}
361695361712
]
361696361713
],
361697-
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.html": [
361714+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js": [
361698361715
[
361699-
"/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.html",
361716+
"/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.html",
361700361717
{}
361701361718
]
361702361719
],
@@ -600647,10 +600664,6 @@
600647600664
"c14a043b6ab10ab5e9e08d5bae1088f8dbf5e9c3",
600648600665
"testharness"
600649600666
],
600650-
"html/webappapis/scripting/events/body-exposed-window-event-handlers.html": [
600651-
"e4f00b866dba9849c8aabb4b1e2ef9b8d1d58e5d",
600652-
"testharness"
600653-
],
600654600667
"html/webappapis/scripting/events/body-onload.html": [
600655600668
"1e43d1ccd476a530738cfdc7846adad807ca1edc",
600656600669
"testharness"
@@ -600672,11 +600685,15 @@
600672600685
"testharness"
600673600686
],
600674600687
"html/webappapis/scripting/events/event-handler-attributes-body-window.html": [
600675-
"1c87892cba7fa30533c2c28f8c0244dd90ff8548",
600688+
"4a6bee61bef240cd0947d796f7b3c2c4166b2670",
600676600689
"testharness"
600677600690
],
600678600691
"html/webappapis/scripting/events/event-handler-attributes-window-body.html": [
600679-
"29c4c133b9ef3847146182a5fb24a4e0fd96bbfe",
600692+
"1ceed5278de7d17c4ef655a2a79e3ecc97339dbf",
600693+
"testharness"
600694+
],
600695+
"html/webappapis/scripting/events/event-handler-attributes-windowless-body.html": [
600696+
"9b81d42ff729399d57e182abc8b8950cef503e12",
600680600697
"testharness"
600681600698
],
600682600699
"html/webappapis/scripting/events/event-handler-javascript.html": [
@@ -600751,8 +600768,12 @@
600751600768
"f5423d7ed448fbceb4d43ef7352b708b48ce2364",
600752600769
"testharness"
600753600770
],
600754-
"html/webappapis/scripting/events/event-handler-spec-example.html": [
600755-
"1f3cff426523ea5799d12b90e45f2f50eb6f8181",
600771+
"html/webappapis/scripting/events/event-handler-removal.window.js": [
600772+
"d0f75c511dd3d04e1e9334753bb0d030f0eb805e",
600773+
"testharness"
600774+
],
600775+
"html/webappapis/scripting/events/event-handler-spec-example.window.js": [
600776+
"7bfbe58bce55aad177adb18f408852d7aed08a96",
600756600777
"testharness"
600757600778
],
600758600779
"html/webappapis/scripting/events/eventhandler-cancellation.html": [
@@ -600763,12 +600784,16 @@
600763600784
"aae0f1abf8bf3ced9e69e83996f76ef700c11866",
600764600785
"testharness"
600765600786
],
600766-
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.html": [
600767-
"83ee25032c5877ed830e0070d3fff963746e290e",
600787+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js": [
600788+
"2892a4c3ab98740dc2fa8240b91217ff6dd49e17",
600768600789
"testharness"
600769600790
],
600770-
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.html": [
600771-
"a67f66ead4ffce7b6692f01dbe6449e28f062f08",
600791+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js": [
600792+
"b39b54b0e9cea49e4628b72ddd84e236cb57e77a",
600793+
"testharness"
600794+
],
600795+
"html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js": [
600796+
"f9443bf99a0a9dfd937d8d1cf3bd618a3734aa1c",
600772600797
"testharness"
600773600798
],
600774600799
"html/webappapis/scripting/events/messageevent-constructor.https.html": [
@@ -600787,6 +600812,10 @@
600787600812
"d40c0b9cce8a7b9a369a30679560b0d1ab22aca0",
600788600813
"support"
600789600814
],
600815+
"html/webappapis/scripting/events/resources/event-handler-body.js": [
600816+
"656903cf99e6e36b491bec30d902466a83b9504f",
600817+
"support"
600818+
],
600790600819
"html/webappapis/scripting/events/resources/open-window.html": [
600791600820
"1d23263570e6db17d36e6bf611f4f31d231327b6",
600792600821
"support"

testing/web-platform/tests/html/webappapis/scripting/events/body-exposed-window-event-handlers.html

-48
This file was deleted.

testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html

+38-21
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,49 @@
33

44
<script src="/resources/testharness.js"></script>
55
<script src="/resources/testharnessreport.js"></script>
6+
<script src="/resources/WebIDLParser.js"></script>
7+
<script src="resources/event-handler-body.js"></script>
68
<div id="log"></div>
79
<body>
810
<script>
9-
function f() {
10-
return 0;
11-
}
11+
setup({ explicit_done: true });
1212

13-
var handlers = ['blur','error','focus','load','resize','scroll',
14-
'afterprint','beforeprint','beforeunload','hashchange',
15-
'languagechange','message','offline','online','pagehide',
16-
'pageshow','popstate','storage','unload'];
17-
handlers.forEach(function(handler) {
18-
test(function() {
19-
document.body['on' + handler] = f;
20-
assert_equals(window['on' + handler], f);
21-
}, handler);
22-
});
13+
handlersListPromise.then(({ shadowedHandlers, notShadowedHandlers }) => {
14+
const createdBody = document.createElement("body");
15+
for (const [description, body, altBody] of [
16+
["document.body", document.body, createdBody],
17+
['document.createElement("body")', createdBody, document.body]
18+
]) {
19+
const f = () => 0;
2320

24-
handlers.forEach(function(handler) {
25-
document.body['on' + handler] = null;
26-
});
21+
shadowedHandlers.forEach(function(handler) {
22+
test(function() {
23+
body['on' + handler] = f;
24+
assert_equals(window['on' + handler], f, "window should reflect");
25+
assert_equals(altBody['on' + handler], f, "alternative body should reflect");
26+
}, `shadowed ${handler} (${description})`);
27+
});
28+
notShadowedHandlers.forEach(function(handler) {
29+
test(function() {
30+
body['on' + handler] = f;
31+
assert_equals(window['on' + handler], null, "window should reflect");
32+
assert_equals(altBody['on' + handler], null, "alternative body should reflect");
33+
}, `not shadowed ${handler} (${description})`);
34+
});
35+
36+
[...shadowedHandlers, ...notShadowedHandlers].forEach(function(handler) {
37+
body['on' + handler] = null;
38+
});
39+
40+
shadowedHandlers.forEach(function(handler) {
41+
test(function() {
42+
assert_equals(body['on' + handler], null, "body should reflect changes to itself");
43+
assert_equals(window['on' + handler], null, "window should reflect");
44+
assert_equals(altBody['on' + handler], null, "alternative body should reflect");
45+
}, `shadowed ${handler} removal (${description})`);
46+
});
47+
}
2748

28-
handlers.forEach(function(handler) {
29-
test(function() {
30-
assert_equals(document.body['on' + handler], null);
31-
assert_equals(window['on' + handler], null);
32-
}, handler + " removal");
49+
done();
3350
});
3451
</script>

testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-window-body.html

+32-17
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,47 @@
33

44
<script src="/resources/testharness.js"></script>
55
<script src="/resources/testharnessreport.js"></script>
6+
<script src="/resources/WebIDLParser.js"></script>
7+
<script src="resources/event-handler-body.js"></script>
68
<div id="log"></div>
79
<body>
810
<script>
11+
setup({ explicit_done: true });
12+
913
function f() {
1014
return 0;
1115
}
1216

13-
var handlers = ['blur','error','focus','load','resize','scroll',
14-
'afterprint','beforeprint','beforeunload','hashchange',
15-
'languagechange','message','offline','online','pagehide',
16-
'pageshow','popstate','storage','unload'];
17-
handlers.forEach(function(handler) {
18-
test(function() {
19-
window['on' + handler] = f;
20-
assert_equals(document.body['on' + handler], f);
21-
}, handler);
22-
});
17+
handlersListPromise.then(({ shadowedHandlers, notShadowedHandlers }) => {
18+
const body = document.createElement("body");
19+
20+
shadowedHandlers.forEach(function(handler) {
21+
test(function() {
22+
window['on' + handler] = f;
23+
assert_equals(document.body['on' + handler], f, "document.body should reflect");
24+
assert_equals(body['on' + handler], f, "document.createElement('body') should reflect");
25+
}, `shadowed ${handler}`);
26+
});
27+
notShadowedHandlers.forEach(function(handler) {
28+
test(function() {
29+
window['on' + handler] = f;
30+
assert_equals(document.body['on' + handler], null, "document.body should reflect");
31+
assert_equals(body['on' + handler], null, "document.createElement('body') should reflect");
32+
}, `not shadowed ${handler}`);
33+
});
2334

24-
handlers.forEach(function(handler) {
35+
[...shadowedHandlers, ...notShadowedHandlers].forEach(function(handler) {
2536
window['on' + handler] = null;
26-
});
37+
});
38+
39+
shadowedHandlers.forEach(function(handler) {
40+
test(function() {
41+
assert_equals(window['on' + handler], null, "window should reflect changes to itself");
42+
assert_equals(document.body['on' + handler], null, "document.body should reflect");
43+
assert_equals(body['on' + handler], null, "document.createElement('body') should reflect");
44+
}, `shadowed ${handler} removal`);
45+
});
2746

28-
handlers.forEach(function(handler) {
29-
test(function() {
30-
assert_equals(window['on' + handler], null);
31-
assert_equals(document.body['on' + handler], null);
32-
}, handler + " removal");
47+
done();
3348
});
3449
</script>

0 commit comments

Comments
 (0)