File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,7 @@ screen.getByText('Submit').closest('button'); // chaining with Testing Library m
14
14
15
15
``` js
16
16
const buttons = screen .getAllByRole (' button' );
17
- const buttonA = buttons[1 ]; // getting the element directly from the array
18
-
19
- expect (buttonA .lastChild ).toBeInTheDocument ();
17
+ expect (buttons[1 ].lastChild ).toBeInTheDocument ();
20
18
```
21
19
22
20
``` js
@@ -31,8 +29,8 @@ document.getElementById('submit-btn').closest('button');
31
29
Examples of ** correct** code for this rule:
32
30
33
31
``` js
34
- const buttonText = screen .getByRole (' button' );
35
- expect (buttonText . textContent ). toBe ( ' Submit ' );
32
+ const button = screen .getByRole (' button' );
33
+ expect (button). toHaveTextContent ( ' submit ' );
36
34
```
37
35
38
36
## Further Reading
You can’t perform that action at this time.
0 commit comments