Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1456707 [wpt PR 10623] - html: Add a test for _charset_., a=testonly
Automatic update from web-platform-testsHTML: form's _charset_ handling HTML change: whatwg/html#3645. URL change: whatwg/url#382. -- wpt-commits: c70b18e9e43e3a41f6988a2a1f88d84b01a3dfcc wpt-pr: 10623 UltraBlame original commit: bfc1a530e1c8cc210e2ad9fc866c3caeb4b2ec4d
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
...web-platform/tests/html/semantics/forms/form-submission-0/constructing-form-data-set.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,32 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set"> | ||
<link ref="help" href="https://xhr.spec.whatwg.org/#dom-formdata"> | ||
<link rel="help" href="https://fetch.spec.whatwg.org/#concept-bodyinit-extract"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
|
||
<iframe name="frame1"></iframe> | ||
<form accept-charset="iso-8859-1" target="frame1" action="/common/blank.html"> | ||
<input type="hidden" name="_charset_"> | ||
</form> | ||
|
||
<script> | ||
test(() => { | ||
let formData = new FormData(document.querySelector('form')); | ||
assert_equals(formData.get('_charset_'), 'UTF-8'); | ||
}, 'FormData constructor always produces UTF-8 _charset_ value.'); | ||
|
||
let t = async_test('_charset_ control sets the expected encoding name.'); | ||
t.step(() => { | ||
let iframe = document.querySelector('iframe'); | ||
iframe.onload = t.step_func_done(() => { | ||
assert_not_equals(iframe.contentDocument.URL.indexOf('_charset_=windows-1252'), -1); | ||
}); | ||
document.querySelector('form').submit(); | ||
}); | ||
</script> | ||
</body> |