-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(label-content-name-mismatch): better dismiss and wysiwyg symbolic…
… text characters (#4402) adds exceptions for (dismiss) `×`, wysiwyg characters `b`, `aA`, `abc` fix: #4386 --- This does _not_ handle all potential use cases. Potential shortcomings worth discussing and opening further issues for are as follows: - Considering other languages, such as [this example in German including "UT", "AD" or "DGS"](w3c/wcag#3304) - The original issue #4386 mentioned this being handled as a character limit, but it's unclear if that's a valid option. Consider [the WCAG `ABC` example](https://www.w3.org/WAI/WCAG21/Understanding/images-of-text-no-exception#examples) - **EDIT**: Does not specifically have test cases for [math expressions and formulae](https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html#mathematical-expressions-and-formulae)
- Loading branch information
Showing
6 changed files
with
84 additions
and
41 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
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
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
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 |
---|---|---|
@@ -1,63 +1,76 @@ | ||
describe('text.isHumanInterpretable', function () { | ||
it('returns 0 when given string is empty', function () { | ||
var actual = axe.commons.text.isHumanInterpretable(''); | ||
const actual = axe.commons.text.isHumanInterpretable(''); | ||
assert.equal(actual, 0); | ||
}); | ||
|
||
it('returns 0 when given string is a single character that is blacklisted as icon', function () { | ||
var blacklistedIcons = ['x', 'i']; | ||
blacklistedIcons.forEach(function (iconText) { | ||
var actual = axe.commons.text.isHumanInterpretable(iconText); | ||
it('returns 0 when given string is a single alpha character', function () { | ||
const singleCharacterExamples = ['i', 'x', 'X', '×', '']; | ||
singleCharacterExamples.forEach(function (characterExample) { | ||
const actual = axe.commons.text.isHumanInterpretable(characterExample); | ||
assert.equal(actual, 0); | ||
}); | ||
}); | ||
|
||
it('returns 0 when given string is in the symbolic text characters set (blocklist)', function () { | ||
const blocklistedSymbols = ['aA', 'Aa', 'abc', 'ABC']; | ||
blocklistedSymbols.forEach(function (symbolicText) { | ||
const actual = axe.commons.text.isHumanInterpretable(symbolicText); | ||
assert.equal(actual, 0); | ||
}); | ||
}); | ||
|
||
it('returns 0 when given string is only punctuations', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('?!!!,.'); | ||
const actual = axe.commons.text.isHumanInterpretable('?!!!,.'); | ||
assert.equal(actual, 0); | ||
}); | ||
|
||
it('returns 1 when given string that has a number', function () { | ||
const actual = axe.commons.text.isHumanInterpretable('7'); | ||
assert.equal(actual, 1); | ||
}); | ||
|
||
it('returns 1 when given string has emoji as a part of the sentence', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('I like 🏀'); | ||
const actual = axe.commons.text.isHumanInterpretable('I like 🏀'); | ||
assert.equal(actual, 1); | ||
}); | ||
|
||
it('returns 1 when given string has non BMP character (eg: windings font) as part of the sentence', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('I ✂ my hair'); | ||
const actual = axe.commons.text.isHumanInterpretable('I ✂ my hair'); | ||
assert.equal(actual, 1); | ||
}); | ||
|
||
it('returns 1 when given string has both non BMP character, and emoji as part of the sentence', function () { | ||
var actual = axe.commons.text.isHumanInterpretable( | ||
const actual = axe.commons.text.isHumanInterpretable( | ||
'I ✂ my hair, and I like 🏀' | ||
); | ||
assert.equal(actual, 1); | ||
}); | ||
|
||
it('returns 0 when given string has only emoji', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('🏀🍔🍉🎅'); | ||
const actual = axe.commons.text.isHumanInterpretable('🏀🍔🍉🎅'); | ||
assert.equal(actual, 0); | ||
}); | ||
|
||
it('returns 0 when given string has only non BNP characters', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('⌛👓'); | ||
const actual = axe.commons.text.isHumanInterpretable('⌛👓'); | ||
assert.equal(actual, 0); | ||
}); | ||
|
||
it('returns 0 when given string has combination of only non BNP characters and emojis', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('⌛👓🏀🍔🍉🎅'); | ||
const actual = axe.commons.text.isHumanInterpretable('⌛👓🏀🍔🍉🎅'); | ||
assert.equal(actual, 0); | ||
}); | ||
|
||
it('returns 1 when given string is a punctuated sentence', function () { | ||
var actual = axe.commons.text.isHumanInterpretable( | ||
const actual = axe.commons.text.isHumanInterpretable( | ||
"I like football, but I prefer basketball; although I can't play either very well." | ||
); | ||
assert.equal(actual, 1); | ||
}); | ||
|
||
it('returns 1 for a sentence without emoji or punctuations', function () { | ||
var actual = axe.commons.text.isHumanInterpretable('Earth is round'); | ||
const actual = axe.commons.text.isHumanInterpretable('Earth is round'); | ||
assert.equal(actual, 1); | ||
}); | ||
}); |
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
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