Skip to content

Commit 3943f45

Browse files
author
Mateus Felix
committed
docs(no-container): add incorrect use cases
1 parent 4eb5381 commit 3943f45

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/rules/no-container.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ const { container: alias } = render(<Example />);
2020
const button = alias.querySelector('.btn-primary');
2121
```
2222

23+
```js
24+
const button = screen.container.querySelector('.btn-primary');
25+
```
26+
27+
```js
28+
const view = render(<Example />);
29+
const button = view.container.querySelector('.btn-primary');
30+
```
31+
2332
Examples of **correct** code for this rule:
2433

2534
```js
@@ -30,7 +39,7 @@ screen.getByRole('button', { name: /click me/i });
3039
If you use [custom render functions](https://testing-library.com/docs/example-react-redux) then you can set a config option in your `.eslintrc` to look for these.
3140

3241
```
33-
"testing-library/no-container": ["error", {"renderFunctions":["renderWithRedux", "renderWithRouter"]}],
42+
"testing-library/no-container": ["error", {"renderFunctions":["renderWithRedux", "renderWithRouter"]}],
3443
```
3544

3645
## Further Reading

0 commit comments

Comments
 (0)