Bug 1494158 [wpt PR 13210] - Forms: Fix 'autocomplete' IDL attribute getter., a=testonly
authorKent Tamura <tkent@chromium.org>
Wed, 03 Oct 2018 09:30:28 +0000
changeset 495415 0049a5019269c77d3b36ee0ed70aa54df10786e1
parent 495414 58ff6fcaae528bfd650028472f360f4c7a44a5a3
child 495416 45bdfc88d33eaeb5fb2e555148d29a2b18a6362d
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1494158, 13210, 758074, 1242765, 594195
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1494158 [wpt PR 13210] - Forms: Fix 'autocomplete' IDL attribute getter., a=testonly Automatic update from web-platform-testsForms: Fix 'autocomplete' IDL attribute getter. This CL implements 'IDL-exposed autofill value' in the algorithm [1] for 'autocomplete' IDL attribute getters of INPUT, TEXTAREA, and SELECT. The new behavior is interoperable with Firefox and Safari. [1] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-processing-model Bug: 758074 Change-Id: I44e081f50903204d3041cfe7a938ba4a4695e625 Reviewed-on: https://chromium-review.googlesource.com/1242765 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#594195} -- wpt-commits: b36d5b1d3284a1e28611d041ac6ba497442000c0 wpt-pr: 13210
testing/web-platform/tests/html/semantics/forms/the-form-element/form-autocomplete.html
--- a/testing/web-platform/tests/html/semantics/forms/the-form-element/form-autocomplete.html
+++ b/testing/web-platform/tests/html/semantics/forms/the-form-element/form-autocomplete.html
@@ -53,9 +53,64 @@
     test(function(){
       var input = document.createElement("input");
       // Include whitespace to test splitting tokens on whitespace.
       // Convert to uppercase to ensure that the tokens are normalized to lowercase.
       input.setAttribute("autocomplete", " " + keyword.toUpperCase() + "\t");
       assert_equals(input.autocomplete, keyword);
     }, keyword + " is an allowed autocomplete field name");
   });
+
+
+test(() => {
+  const select = document.createElement("select");
+  select.setAttribute("autocomplete", "  \n");
+  assert_equals(select.autocomplete, "");
+}, "Test whitespace-only attribute value");
+
+test(() => {
+  const select = document.createElement("select");
+
+  select.setAttribute("autocomplete", "foo off");
+  assert_equals(select.autocomplete, "");
+
+  // Normal category; max=3
+  select.setAttribute("autocomplete", "foo section-foo billing name");
+  assert_equals(select.autocomplete, "");
+
+  // Contact category; max=4
+  select.setAttribute("autocomplete", "foo section-bar billing work name");
+  assert_equals(select.autocomplete, "");
+}, "Test maximum number of tokens");
+
+test(() => {
+  const textarea = document.createElement("textarea");
+
+  textarea.setAttribute("autocomplete", "call-sign");
+  assert_equals(textarea.autocomplete, "");
+}, "Unknown field");
+
+test(() => {
+  const hidden = document.createElement("input");
+  hidden.type = "hidden";
+  hidden.setAttribute("autocomplete", "on");
+  assert_equals(hidden.autocomplete, "");
+  hidden.setAttribute("autocomplete", "off");
+  assert_equals(hidden.autocomplete, "");
+}, "Test 'wearing the autofill anchor mantle' with off/on");
+
+test(() => {
+  const textarea = document.createElement("textarea");
+
+  textarea.setAttribute("autocomplete", " HOME\ntel");
+  assert_equals(textarea.autocomplete, "home tel");
+
+  textarea.setAttribute("autocomplete", "shipping   country");
+  assert_equals(textarea.autocomplete, "shipping country");
+
+  textarea.setAttribute("autocomplete", "billing  work  email");
+  assert_equals(textarea.autocomplete, "billing work email");
+
+  textarea.setAttribute("autocomplete", "  section-FOO  bday");
+  assert_equals(textarea.autocomplete, "section-foo bday");
+}, "Serialize combinations of section, mode, contact, and field");
+
 </script>