Skip to content

Commit 8a72bde

Browse files
Merge f5758b3 into 001c99b
2 parents 001c99b + f5758b3 commit 8a72bde

3 files changed

Lines changed: 40 additions & 3 deletions

File tree

source/NVDAObjects/IAccessible/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ def normalizeIA2TextFormatField(formatField):
8585
except KeyError:
8686
invalid=None
8787
if invalid:
88-
invalid=invalid.lower()
89-
if invalid=="spelling":
88+
# aria-invalid can contain multiple values separated by a comma.
89+
invalidList = [x.lower().strip() for x in invalid.split(',')]
90+
if "spelling" in invalidList:
9091
formatField["invalid-spelling"]=True
91-
elif invalid=="grammar":
92+
if "grammar" in invalidList:
9293
formatField["invalid-grammar"]=True
9394
color=formatField.get('color')
9495
if color:

tests/system/robot/chromeTests.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,39 @@ def test_ariaTreeGrid_browseMode():
290290
)
291291

292292

293+
def ARIAInvalid_spellingAndGrammar():
294+
"""
295+
Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
296+
Please note that although IAccessible2 allows multiple values for invalid,
297+
multiple values to aria-invalid is not yet standard.
298+
And even if it were, they would be separated by space, not comma
299+
thus the html for this test would need to change,
300+
but the expected output shouldn't need to.
301+
"""
302+
_chrome.prepareChrome(
303+
r"""
304+
r"<p>Big <span aria-invalid="spelling">caat</span> meos</p>"
305+
<p>Small <span aria-invalid="grammar">a dog</span> woofs</p>
306+
<p>Fat <span aria-invalid="grammar, spelling">a ffrog</span> crokes</p>
307+
"""
308+
)
309+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
310+
_asserts.strings_match(
311+
actualSpeech,
312+
"Big spelling error caat meos"
313+
)
314+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
315+
_asserts.strings_match(
316+
actualSpeech,
317+
"Small grammar error a dog woofs"
318+
)
319+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
320+
_asserts.strings_match(
321+
actualSpeech,
322+
"Fat spelling error grammar error a ffrog crokes"
323+
)
324+
325+
293326
def test_ariaCheckbox_browseMode():
294327
"""
295328
Navigate to an unchecked checkbox in reading mode.

tests/system/robot/chromeTests.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ ARIA treegrid
4040
[Documentation] Ensure that ARIA treegrids are accessible as a standard table in browse mode.
4141
# Excluded due to regular failures.
4242
test_ariaTreeGrid_browseMode
43+
ARIA invalid spelling and grammar
44+
[Documentation] Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
45+
ARIAInvalid_spellingAndGrammar
4346
ARIA checkbox
4447
[Documentation] Navigate to an unchecked checkbox in reading mode.
4548
[Tags] aria-at

0 commit comments

Comments
 (0)