-
Notifications
You must be signed in to change notification settings - Fork 779
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(label-content-name-mismatch): better dismiss and wysiwyg symbolic text characters #4402
Merged
gaiety-deque
merged 5 commits into
develop
from
agw--label-content-name-mismatch-exceptions
Apr 15, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c215a9d
fix(label-content-name-mismatch): better dismiss and wysiwyg symbolic…
gaiety-deque 0cd9d71
fix(label-content-name-mismatch): fewer blocklists, handle all single…
gaiety-deque 9ed16e6
fix(label-content-name-mismatch): refactor isHumanInterpretable, test…
gaiety-deque 30d8388
fix(label-content-name-mismatch): 0 for all single char, cjk & x test…
gaiety-deque c4aa062
fix(label-content-name-mismatch): simpler non-digit check, test added
gaiety-deque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 () { | ||
gaiety-deque marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to think about this for a while, but I think I agree with your changes here. I think this creates 2 (but really 1) behavior changes:
accText
is not interpretable andvisibleText
is emptyincomplete
, nowpass
label-content-name-mismatch-matches
filters out cases without visible textaccText
is interpretable,visibleText
is not intepretable, andvisibleText
is contained inaccText
pass
, nowincomplete
<button aria-label="bold">B</button>
Previously I think that case would pass (return
true
) - with this change, I think it incompletes (returnsundefined
). I think it's more consistent with the change (I don't think it makes sense for a visible "x" button to give different results for labels "close" vs "exit").