Skip to content

Commit

Permalink
Bug 1456707 [wpt PR 10623] - html: Add a test for _charset_., a=testonly
Browse files Browse the repository at this point in the history
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
marco-c committed Oct 2, 2019
1 parent 194ced0 commit 1c8393f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testing/web-platform/meta/MANIFEST.json
Expand Up @@ -337417,6 +337417,12 @@
{}
]
],
"html/semantics/forms/form-submission-0/constructing-form-data-set.html": [
[
"/html/semantics/forms/form-submission-0/constructing-form-data-set.html",
{}
]
],
"html/semantics/forms/form-submission-0/form-data-set-usv.html": [
[
"/html/semantics/forms/form-submission-0/form-data-set-usv.html",
Expand Down Expand Up @@ -574106,6 +574112,10 @@
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"html/semantics/forms/form-submission-0/constructing-form-data-set.html": [
"28ddddb0e685b6de4bb1270afdd791865d6bb787",
"testharness"
],
"html/semantics/forms/form-submission-0/contains.json": [
"5cb7e225df89561a1137933615b93c9912444006",
"support"
Expand Down
@@ -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>

0 comments on commit 1c8393f

Please sign in to comment.