Skip to content
Merged
7 changes: 4 additions & 3 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ def normalizeIA2TextFormatField(formatField):
except KeyError:
invalid=None
if invalid:
invalid=invalid.lower()
if invalid=="spelling":
# aria-invalid can contain multiple values separated by a comma.
invalidList = [x.lower().strip() for x in invalid.split(',')]
if "spelling" in invalidList:
formatField["invalid-spelling"]=True
elif invalid=="grammar":
if "grammar" in invalidList:
formatField["invalid-grammar"]=True
color=formatField.get('color')
if color:
Expand Down
33 changes: 33 additions & 0 deletions tests/system/robot/chromeTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,39 @@ def test_ariaTreeGrid_browseMode():
)


def ARIAInvalid_spellingAndGrammar():
"""
Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
Please note that although IAccessible2 allows multiple values for invalid,
multiple values to aria-invalid is not yet standard.
And even if it were, they would be separated by space, not comma
thus the html for this test would need to change,
but the expected output shouldn't need to.
"""
_chrome.prepareChrome(
r"""
<p>Big <span aria-invalid="spelling">caat</span> meos</p>
<p>Small <span aria-invalid="grammar">a dog</span> woofs</p>
<p>Fat <span aria-invalid="grammar, spelling">a ffrog</span> crokes</p>
"""
)
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
_asserts.strings_match(
actualSpeech,
"Big spelling error caat meos"
)
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
_asserts.strings_match(
actualSpeech,
"Small grammar error a dog woofs"
)
actualSpeech = _chrome.getSpeechAfterKey("downArrow")
_asserts.strings_match(
actualSpeech,
"Fat spelling error grammar error a ffrog crokes"
)


def test_ariaCheckbox_browseMode():
"""
Navigate to an unchecked checkbox in reading mode.
Expand Down
3 changes: 3 additions & 0 deletions tests/system/robot/chromeTests.robot
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ ARIA treegrid
[Documentation] Ensure that ARIA treegrids are accessible as a standard table in browse mode.
# Excluded due to regular failures.
test_ariaTreeGrid_browseMode
ARIA invalid spelling and grammar
[Documentation] Tests ARIA invalid values of "spelling", "grammar" and "spelling, grammar".
ARIAInvalid_spellingAndGrammar
ARIA checkbox
[Documentation] Navigate to an unchecked checkbox in reading mode.
[Tags] aria-at
Expand Down