Closed ddehart closed 3 years ago
Testing Playground does not respect the level option of getByRole.
On https://develop.testing-playground.com:
undefined
screen.getByRole('heading', {level: 1})
Array
screen.getAllByRole('heading', {level: 1})
undefined using screen.getByRole('heading', {level: 1})
Array with two elements returned using screen.getAllByRole('heading', {level: 1})
<h1> This is a level-1 heading </h1>
<h1>
The level option was added in dom-testing-library v7.23.0. It looks like testing-playground is using v7.22.5.
level
Thanks! Are you willing / able to submit a PR?
@smeijer I'll give it a shot!
Bug Report 🐛
Testing Playground does not respect the level option of getByRole.
On https://develop.testing-playground.com:
undefined
usingscreen.getByRole('heading', {level: 1})
Array
with two elements returned usingscreen.getAllByRole('heading', {level: 1})
To Reproduce ✔️
undefined
usingscreen.getByRole('heading', {level: 1})
Array
with two elements returned usingscreen.getAllByRole('heading', {level: 1})
Expected behavior 🤔
undefined
case: I expected the query to return<h1> This is a level-1 heading </h1>
Array
case: I expected the query to return an array with only the<h1>
elementSuggested solution 🔦
The
level
option was added in dom-testing-library v7.23.0. It looks like testing-playground is using v7.22.5.Your Environment 💻