Skip to content

Commit

Permalink
Update dependency @testing-library/dom to v8.13.0 (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] committed May 25, 2022
1 parent 4145ced commit d36f234
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .changeset/purple-bags-add.md
@@ -0,0 +1,14 @@
---
'pleasantest': minor
---

Update dependency `@testing-library/dom` to `v8.13.0`.

This adds support to filtering `ByRole` queries by description:

```ts
// Select by accessible role and description
await screen.getByRole('button', {
description: /^items in the trash will be/i,
});
```
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -19,7 +19,7 @@
"@rollup/plugin-alias": "3.1.9",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-node-resolve": "13.3.0",
"@testing-library/dom": "8.12.0",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.15.1",
"@types/jest": "27.5.1",
"@types/node": "12.20.52",
Expand Down
16 changes: 15 additions & 1 deletion tests/testing-library-queries/ByRole.test.ts
Expand Up @@ -8,12 +8,21 @@ test(
<div>hello</div>
<div role="button">butt1</div>
<div role="button">butt2</div>
<button aria-describedby="trash-desc">Move to trash</button>
<p id="trash-desc">Items in the trash will be permanently removed after 30 days.</p>
`);

// Finds just one
await screen.getByRole('heading');
// Alternate syntax

// Select by accessible name
await screen.getByRole('button', { name: /butt2/ });

// Select by accessible role and description
await screen.getByRole('button', {
description: /^items in the trash will be/i,
});

// Doesn't find any
await expect(screen.getByRole('banner')).rejects
.toThrowErrorMatchingInlineSnapshot(`
Expand Down Expand Up @@ -41,6 +50,9 @@ test(
Name \\"butt2\\":
<div role=\\"button\\">butt2</div>
Name \\"Move to trash\\":
<button aria-describedby=\\"trash-desc\\">Move to trash</button>
--------------------------------------------------
Within: #document"
Expand All @@ -56,6 +68,8 @@ test(
<div role=\\"button\\">butt2</div>
<button aria-describedby=\\"trash-desc\\">Move to trash</button>
(If this is intentional, then use the \`*AllBy*\` variant of the query (like \`queryAllByText\`, \`getAllByText\`, or \`findAllByText\`)).
Within: #document"
Expand Down

0 comments on commit d36f234

Please sign in to comment.