Bug 1448643 [wpt PR 10169] - expand tests to test in reverse direction, a=testonly

Automatic update from web-platform-testsTest that event handlers set on the window object are found on the body element (#10169)

Based on event-handler-attributes-body-window.html.

wpt-commits: 6fca0b2cd6f7f8d915e78b1e3aa00a3ac6893019
wpt-pr: 10169
wpt-commits: 6fca0b2cd6f7f8d915e78b1e3aa00a3ac6893019
wpt-pr: 10169
This commit is contained in:
Kriti Singh 2018-04-09 18:20:25 +00:00 коммит произвёл James Graham
Родитель 278173d49a
Коммит e08e789e37
2 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -338545,6 +338545,12 @@
{}
]
],
"html/webappapis/scripting/events/event-handler-attributes-window-body.html": [
[
"/html/webappapis/scripting/events/event-handler-attributes-window-body.html",
{}
]
],
"html/webappapis/scripting/events/event-handler-javascript.html": [
[
"/html/webappapis/scripting/events/event-handler-javascript.html",
@ -572364,6 +572370,10 @@
"c25750e626c5c2121833fd4627f656ffe9c83d38",
"testharness"
],
"html/webappapis/scripting/events/event-handler-attributes-window-body.html": [
"d5a47edd139eb2ff2fe035451f44996bfe2f414d",
"testharness"
],
"html/webappapis/scripting/events/event-handler-javascript.html": [
"2dece90b5e8b3ac3371a732e158ff44b8ea63b00",
"testharness"

Просмотреть файл

@ -0,0 +1,34 @@
<!DOCTYPE html>
<title>HTMLBodyElement event handlers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<body>
<script>
function f() {
return 0;
}
var handlers = ['blur','error','focus','load','resize','scroll',
'afterprint','beforeprint','beforeunload','hashchange',
'languagechange','message','offline','online','pagehide',
'pageshow','popstate','storage','unload'];
handlers.forEach(function(handler) {
test(function() {
window['on' + handler] = f;
assert_equals(document.body['on' + handler], f);
}, handler);
});
handlers.forEach(function(handler) {
window['on' + handler] = null;
});
handlers.forEach(function(handler) {
test(function() {
assert_equals(window['on' + handler], null);
assert_equals(document.body['on' + handler], null);
}, handler + " removal");
});
</script>