Skip to content

Commit

Permalink
HTML: add test for document.open() and URL fragment
Browse files Browse the repository at this point in the history
For whatwg/html#3970.

Co-authored-by: Timothy Gu <[email protected]>
  • Loading branch information
annevk and TimothyGu committed Aug 28, 2018
1 parent cab4439 commit 110d907
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
onload = () => {
const beforeURL = document.URL;
document.open();
const afterURL = document.URL;
document.close();
parent.testDone(beforeURL, afterURL);
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe")),
urlSansHash = document.URL;
assert_equals(frame.contentDocument.URL, "about:blank");
assert_equals(frame.contentWindow.location.href, "about:blank");
self.onhashchange = t.step_func_done(() => {
frame.contentDocument.open();
assert_equals(frame.contentDocument.URL, urlSansHash);
assert_equals(frame.contentWindow.location.href, urlSansHash);
});
self.location.hash = "heya";
t.step_timeout(t.unreached_func("timeout"), 2000);
}, "document.open() and document's URL containing a fragment");

window.testDone = undefined;
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"))
frame.src = "resources/url-frame.html#heya";
window.testDone = t.step_func_done((beforeURL, afterURL) => {
assert_equals(beforeURL, frame.src);
assert_equals(afterURL, frame.src);
assert_equals(frame.contentDocument.URL, frame.src);
});
}, "document.open() and document's URL containing a fragment (entry is current)");

0 comments on commit 110d907

Please sign in to comment.