Skip to content

feat(dom): toHaveAccessibleDescription#174

Open
JDOM10 wants to merge 8 commits into
mainfrom
feat/dom-to-have-accessible-description
Open

feat(dom): toHaveAccessibleDescription#174
JDOM10 wants to merge 8 commits into
mainfrom
feat/dom-to-have-accessible-description

Conversation

@JDOM10

@JDOM10 JDOM10 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Added to Have Accessible Description.

@JDOM10 JDOM10 self-assigned this Jun 30, 2026
@JDOM10 JDOM10 added the enhancement New feature or request label Jun 30, 2026
@JDOM10 JDOM10 requested review from KeylaMunnoz and suany0805 and removed request for suany0805 June 30, 2026 15:51
Comment on lines +331 to +333
const expectation = expectedDescription instanceof RegExp
? `matching ${expectedDescription}`
: `"${expectedDescription}"`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"`
  : "";

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@@ -327,25 +328,24 @@ export class ElementAssertion<T extends Element> extends Assertion<T> {
: desc === expectedDescription;
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sounds good!

@JDOM10 JDOM10 requested a review from KeylaMunnoz July 7, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants