Uh oh!
There was an error while loading. Please reload this page.
feat: expect(locator).toHaveAccessibleErrorMessage - #33904
feat: expect(locator).toHaveAccessibleErrorMessage#33904Dmitry Gozman (dgozman) merged 20 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
e68009a to
cccdd97Compare
This comment has been minimized.
This comment has been minimized.
cccdd97 to
6623a77Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
95d0978 to
0a4ee89Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0a4ee89 to
c963a6dCompare
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c963a6d to
2195194Compare
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
f764780 to
139b5ddCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Dmitry Gozman (dgozman)
left a comment
There was a problem hiding this comment.
This looks very good! Just a few comments about aria spec/semantics, and this will be good to do.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
3c01c81 to
41921edCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Dmitry Gozman (dgozman)
left a comment
There was a problem hiding this comment.
Thank you for the PR, looks very good!
| export const kInputValidityAttributes = ['required', 'pattern', 'min', 'max', 'minlength', 'maxlength', 'step', 'type', 'value']; | ||
| export function hasValidationAttributes(element: Element): boolean { | ||
| if (!(element instanceof HTMLInputElement)) |
There was a problem hiding this comment.
validity is defined for a lot of elements, e.g. <select>, <textarea>, <object>, <button>, <fieldset>, probably more. I'd drop this check, and assume that element.validity?.valid === false means it is invalid.
| const role = getAriaRole(element) || ''; | ||
| if (!role || !kAriaInvalidRoles.includes(role)) | ||
| return 'false'; | ||
| if (element instanceof HTMLInputElement && hasValidationAttributes(element) && element.validity) |
There was a problem hiding this comment.
Perhaps check both aria-invalid and element.validity?.valid === false, and consider the element invalid when either of the indicators is present?
There was a problem hiding this comment.
I understood it as being asked to remove hasValidationAttributes and evaluate only with
element.validity?.valid === falsewithout assessing thekAriaInvalidRoles attributes. Would that be correct? :)According to the spec, it seems that the return values of the
getAriaInvalidfunction should be'false' | 'true' | 'grammar' | 'spelling'.
Rather than evaluatingvaliditywithin this function, I think it would be better to separate it into a dedicated function, such asgetValidityInvalid. I look forward to your feedback on this! :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
41921ed to
9378431Compare
This comment has been minimized.
This comment has been minimized.
9378431 to
b28ad83Compare
This comment has been minimized.
This comment has been minimized.
b28ad83 to
cab504bCompareTest results for "tests 1"8 flaky37461 passed, 650 skipped Merge workflow run. |
Dmitry Gozman (dgozman)
left a comment
There was a problem hiding this comment.
This looks great! Thank you for the PR! and following through the review process. Merging in.
Closes#31249
toHaveAccessibleErrorMessagematcher forexpect(locator).Looking forward to teams feedback. Thanks! :)