Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(autocomplete-appropriate): pass for autocomplete=username and type=email #2896

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/checks/forms/autocomplete-appropriate-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function autocompleteAppropriateEvaluate(node, options, virtualNode) {
const allowedTypesMap = {
bday: ['text', 'search', 'date'],
email: ['text', 'search', 'email'],
username: ['text', 'search', 'email'],
'street-address': ['text'], // Issue: https://github.com/dequelabs/axe-core/issues/1161
tel: ['text', 'search', 'tel'],
'tel-country-code': ['text', 'search', 'tel'],
Expand Down
6 changes: 6 additions & 0 deletions test/checks/forms/autocomplete-appropriate.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ describe('autocomplete-appropriate', function() {
assert.isTrue(evaluate.apply(checkContext, params));
});

it('returns true if the input type is email and the term is username', function() {
var options = {};
var params = autocompleteCheckParams('username', 'email', options);
assert.isTrue(evaluate.apply(checkContext, params));
});

it('returns false if the input type is text and the term maps to an empty array', function() {
var options = { foo: [] };
var params = autocompleteCheckParams('foo', 'text', options);
Expand Down
2 changes: 1 addition & 1 deletion test/commons/text/is-valid-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('text.isValidAutocomplete', function() {
);
});

it('returns true if "home", "work", "mobile", "fax" or "pager" is used before aqualifier', function() {
it('returns true if "home", "work", "mobile", "fax" or "pager" is used before a qualifier', function() {
['home', 'work', 'mobile', 'fax', 'pager'].forEach(function(qualifier) {
assert.isTrue(
isValidAutocomplete(qualifier + ' qualified-term', options),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<input autocomplete="work tel-local-suffix" id="pass60" />
<input autocomplete="SECTION-foo mobile tel-extension" id="pass61" />
<input autocomplete="fax email" id="pass62" />
<input type="username" autocomplete="email" id="pass83" />
<input autocomplete="pager impp" id="pass63" />
<input
autocomplete="off"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
["#pass79"],
["#pass80"],
["#pass81"],
["#pass82"]
["#pass82"],
["#pass83"]
]
}