Bug 1774088 [wpt PR 34410] - [webauthn] WPT for autocomplete="webauthn", a=testonly

Automatic update from web-platform-tests
[webauthn] WPT for autocomplete="webauthn"

Add a web platform test for the "webauthn" autocomplete detail token.

Drive-by fix to the "contact category" bit of the test. The test
intended to exceed the maximum number of tokens for an autofill field
type of category "contact" [1], but used the field name "name" which
is of category "normal". Change "name" to "tel" which actually is of
category "contact".

See https://github.com/whatwg/html/pull/8006

[1] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-processing-model

Bug: 1171985
Change-Id: Idfdee8447c5eaa6b4d5ab34249dee2c46b82ecec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3704319
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014943}

--

wpt-commits: 57933a8edb4f01c8b63435d7f08cbd8ba4efd32b
wpt-pr: 34410
This commit is contained in:
Nina Satragno 2022-06-21 09:57:10 +00:00 committed by moz-wptsync-bot
parent cc10fabd52
commit 7dc7e961c9

View File

@ -47,7 +47,7 @@
autocompletetest(document.forms.autocomplete_off, ["off", "", "on", "off", ""], "form autocomplete attribute off");
autocompletetest(document.forms.autocomplete_invalid, ["on", "", "on", "off", ""], "form autocomplete attribute invalid");
var keywords = [ "on", "off", "name", "honorific-prefix", "given-name", "additional-name", "family-name", "honorific-suffix", "nickname", "username", "new-password", "current-password", "one-time-code", "organization-title", "organization", "street-address", "address-line1", "address-line2", "address-line3", "address-level4", "address-level3", "address-level2", "address-level1", "country", "country-name", "postal-code", "cc-name", "cc-given-name", "cc-additional-name", "cc-family-name", "cc-number", "cc-exp", "cc-exp-month", "cc-exp-year", "cc-csc", "cc-type", "transaction-currency", "transaction-amount", "language", "bday", "bday-day", "bday-month", "bday-year", "sex", "url", "photo", "tel", "tel-country-code", "tel-national", "tel-area-code", "tel-local", "tel-local-prefix", "tel-local-suffix", "tel-extension", "email", "impp" ];
var keywords = [ "on", "off", "name", "honorific-prefix", "given-name", "additional-name", "family-name", "honorific-suffix", "nickname", "username", "new-password", "current-password", "one-time-code", "organization-title", "organization", "street-address", "address-line1", "address-line2", "address-line3", "address-level4", "address-level3", "address-level2", "address-level1", "country", "country-name", "postal-code", "cc-name", "cc-given-name", "cc-additional-name", "cc-family-name", "cc-number", "cc-exp", "cc-exp-month", "cc-exp-year", "cc-csc", "cc-type", "transaction-currency", "transaction-amount", "language", "bday", "bday-day", "bday-month", "bday-year", "sex", "url", "photo", "tel", "tel-country-code", "tel-national", "tel-area-code", "tel-local", "tel-local-prefix", "tel-local-suffix", "tel-extension", "email", "impp", "webauthn" ];
keywords.forEach(function(keyword) {
test(function(){
@ -77,7 +77,11 @@ test(() => {
assert_equals(select.autocomplete, "");
// Contact category; max=4
select.setAttribute("autocomplete", "foo section-bar billing work name");
select.setAttribute("autocomplete", "foo section-bar billing work tel");
assert_equals(select.autocomplete, "");
// Credential category; max=5
select.setAttribute("autocomplete", "foo section-bar billing work tel webauthn");
assert_equals(select.autocomplete, "");
}, "Test maximum number of tokens");
@ -113,4 +117,14 @@ test(() => {
assert_equals(textarea.autocomplete, "section-foo bday");
}, "Serialize combinations of section, mode, contact, and field");
test(() => {
const textarea = document.createElement("textarea");
textarea.setAttribute("autocomplete", "\tusername webauthn");
assert_equals(textarea.autocomplete, "username webauthn");
textarea.setAttribute("autocomplete", " section-LOGIN shipping work tel webauthn ");
assert_equals(textarea.autocomplete, "section-login shipping work tel webauthn");
}, "Serialize combinations of section, mode, contact, field, and credential");
</script>