-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For whatwg/html#4965.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
html/semantics/embedded-content/the-iframe-element/load-event-timing.window.js
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,58 @@ | ||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
let happened = [] | ||
frame.onload = t.step_func(() => happened.push("load")); | ||
document.body.append(frame); | ||
happened.push("append"); | ||
// Use timeout for assert in case there's multiple load events erroneously | ||
t.step_timeout(() => { | ||
assert_array_equals(happened, ["load", "append"]); | ||
t.done(); | ||
}, 500); | ||
}, "<iframe> without src and load event"); | ||
|
||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
let happened = [] | ||
frame.onload = t.step_func(() => happened.push("load")); | ||
frame.src = "about:blank"; | ||
document.body.append(frame); | ||
happened.push("append"); | ||
// Use timeout for assert in case there's multiple load events erroneously | ||
t.step_timeout(() => { | ||
assert_array_equals(happened, ["load", "append"]); | ||
t.done(); | ||
}, 500); | ||
}, "<iframe> with about:blank src and load event"); | ||
|
||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
let happened = false; | ||
frame.onload = t.step_func_done(() => assert_true(happened)); | ||
frame.src = URL.createObjectURL(new Blob([""], { type: "text/html" })); | ||
document.body.append(frame); | ||
happened = true; | ||
}, "<iframe> with blob: URL src and load event"); | ||
|
||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
let happened = false; | ||
frame.onload = t.step_func_done(() => assert_true(happened)); | ||
frame.src = "data:text/html,"; | ||
document.body.append(frame); | ||
happened = true; | ||
}, "<iframe> with data: URL src and load event"); | ||
|
||
async_test(t => { | ||
const frame = document.createElement("iframe"); | ||
t.add_cleanup(() => frame.remove()); | ||
let happened = false; | ||
frame.onload = t.step_func_done(() => assert_true(happened)); | ||
frame.srcdoc = ""; | ||
document.body.append(frame); | ||
happened = true; | ||
}, "<iframe> with srcdoc and load event"); |