feat(dom): toHaveAccessibleDescription#174
Open
JDOM10 wants to merge 8 commits into
Open
Conversation
…json and yarn.lock
…n and update related tests
…ion and normalizeText helper
KeylaMunnoz
reviewed
Jul 7, 2026
Comment on lines
+331
to
+333
| const expectation = expectedDescription instanceof RegExp | ||
| ? `matching ${expectedDescription}` | ||
| : `"${expectedDescription}"`; |
Collaborator
There was a problem hiding this comment.
A minor suggestion here, to consider only constructing expectation when hasExpectedValue is true. Otherwise, it evaluates to the string "undefined" when no argument is passed, which isn't currently exposed but could be misleading or cause issues if this code changes later.
const expectation = hasExpectedValue
? expectedDescription instanceof RegExp
? `matching ${expectedDescription}`
: `"${expectedDescription}"`
: "";
| @@ -327,25 +328,24 @@ export class ElementAssertion<T extends Element> extends Assertion<T> { | |||
| : desc === expectedDescription; | |||
| }; | |||
|
|
|||
Collaborator
There was a problem hiding this comment.
Non-blocking suggestion: this helper is clear as is, but it might be worth extracting it into helpers/accessibility.ts as we would end up adding other matchers in the future (e.g. toHaveAccessibleName) that could reuse the same matching logic 😸 let me know what you think !
Collaborator
Author
There was a problem hiding this comment.
Thanks, sounds good!
…proved accessibility checks
…mproved expectation descriptions
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added to Have Accessible Description.