Skip to content

Commit 2f4fdc3

Browse files
Merge addd5d9 into 2d7d298
2 parents 2d7d298 + addd5d9 commit 2f4fdc3

3 files changed

Lines changed: 34 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: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,30 @@ def test_ariaTreeGrid_browseMode():
288288
"level 1 Treegrids are awesome Want to learn how to use them? aaron at thegoogle dot rocks expanded",
289289
])
290290
)
291+
292+
def ARIAInvalid_spellingAndGrammar():
293+
"""
294+
Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
295+
"""
296+
_chrome.prepareChrome(
297+
r"""
298+
<p>Big <span aria-invalid="spelling">caat</span> meos</p>
299+
<p>Small <span aria-invalid="grammar">a dog</span> woofs</p>
300+
<p>Fat <span aria-invalid="grammar, spelling">a ffrog</span> crokes</p>
301+
"""
302+
)
303+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
304+
_asserts.strings_match(
305+
actualSpeech,
306+
"Big spelling error caat meos"
307+
)
308+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
309+
_asserts.strings_match(
310+
actualSpeech,
311+
"Small grammar error a dog woofs"
312+
)
313+
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
314+
_asserts.strings_match(
315+
actualSpeech,
316+
"Fat spelling error grammar error a ffrog crokes"
317+
)

tests/system/robot/chromeTests.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ ARIA treegrid
3939
[Documentation] Ensure that ARIA treegrids are accessible as a standard table in browse mode.
4040
# Excluded due to regular failures.
4141
test_ariaTreeGrid_browseMode
42+
ARIA invalid spelling and grammar
43+
[Documentation] Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
44+
ARIAInvalid_spellingAndGrammar

0 commit comments

Comments
 (0)