Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getByRole("group") can't match address tag #1277

Closed
Tarektouati opened this issue Nov 15, 2023 · 1 comment
Closed

getByRole("group") can't match address tag #1277

Tarektouati opened this issue Nov 15, 2023 · 1 comment

Comments

@Tarektouati
Copy link

  • @testing-library/dom version: 9.3.3
  • Testing Framework and version: @testing-library/react@14.0.0
  • DOM Environment: vitest: 0.34.6 with jsdom 22.1.0

What you did:

I have React component that contains address tag :

// component.jsx
const Component = () => {
   return (
    <address>
          <span>street Name</span>
          <span>postal code and city</span>
          <span>country</span>
     </address>
    )
}

All i wanted is to test that component in spec file :

// component.test.jsx
within(screen.getByRole("group")).getByText("street Name");

What happened:

I was unable to match that address with role group

Problem description:

Following W3C address tag has role group, still I was unable to match it.

@timdeschryver
Copy link
Member

To find the elements we make use of aria-query.
The current version that we use (5.1.3) doesn't include the address field.

Upgrading aria-query to v5.3.0 solves this problem.
This is included in our v10.0.0-alpha release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants