forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a few missing post-insertion-step tests (web-platform-tests#44906)
* Add insertion step for meta with referrer+script * Added form association test * Rename Node-appendChild-form-and-script-from-fragment.tentative.html to Node-append-form-and-script-from-fragment.tentative.html * Rename Node-appendChild-meta-referrer-and-script-from-fragment.tentative.html to Node-append-meta-referrer-and-script-from-fragment.tentative.html
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
dom/nodes/insertion-removing-steps/Node-append-form-and-script-from-fragment.tentative.html
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,22 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and associated form</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<button id="someButton" form="someForm"></button> | ||
<script> | ||
test(() => { | ||
const script = document.createElement("script"); | ||
const form = document.createElement("form"); | ||
form.id = "someForm"; | ||
const fragment = new DocumentFragment(); | ||
script.textContent = ` | ||
window.buttonAssociatedForm = document.querySelector("#someButton").form; | ||
`; | ||
fragment.append(script, form); | ||
document.body.append(fragment); | ||
assert_equals(window.buttonAssociatedForm, form); | ||
}, "When adding a script+form in a fragment and the form matches an associated element, " + | ||
"the script that checks whether the button is associated to the form should run after " + | ||
"inserting the form"); | ||
</script> |
29 changes: 29 additions & 0 deletions
29
...nsertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html
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 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and meta-referrer from a div</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script> | ||
promise_test(async t => { | ||
const script = document.createElement("script"); | ||
const meta = document.createElement("meta"); | ||
meta.name = "referrer"; | ||
meta.content = "no-referrer"; | ||
const fragment = new DocumentFragment(); | ||
const done = new Promise(resolve => { | ||
window.didFetch = resolve; | ||
}); | ||
script.textContent = ` | ||
(async function() { | ||
const response = await fetch("/html/infrastructure/urls/terminology-0/resources/echo-referrer-text.py") | ||
const text = await response.text(); | ||
window.didFetch(text); | ||
})(); | ||
`; | ||
fragment.append(script, meta); | ||
document.head.append(fragment); | ||
const result = await done; | ||
assert_equals(result, ""); | ||
}, "<meta name=referrer> should apply before script, as it is an insertion step " + | ||
"and not a post-insertion step"); | ||
</script> |