@@ -199,8 +199,8 @@ const detachedElement = document.createElement('div')
199
199
200
200
expect (htmlElement).toBeInTheDocument ()
201
201
expect (svgElement).toBeInTheDocument ()
202
- expect (detacthedElement).not .toBeInTheDocument ()
203
202
expect (nonExistantElement).not .toBeInTheDocument ()
203
+ expect (detachedElement).not .toBeInTheDocument ()
204
204
` ` `
205
205
206
206
##### Using dom-testing-library
@@ -579,16 +579,16 @@ expected properties applied, not just some of them.
579
579
##### Using document.querySelector
580
580
581
581
` ` ` javascript
582
- const input = document .querySelector ([' data-testid="delete-button"' )
582
+ const button = document .querySelector ([' data-testid="delete-button"' )
583
583
584
584
expect (button).toHaveStyle (' display: none' )
585
585
expect (button).toHaveStyle (`
586
586
color: red;
587
587
display: none;
588
588
` )
589
589
expect (button).not .toHaveStyle (`
590
- display: none;
591
590
color: blue;
591
+ display: none;
592
592
` )
593
593
` ` `
594
594
@@ -603,8 +603,8 @@ expect(button).toHaveStyle(`
603
603
display: none;
604
604
` )
605
605
expect (button).not .toHaveStyle (`
606
- display: none;
607
606
color: blue;
607
+ display: none;
608
608
` )
609
609
` ` `
610
610
@@ -631,21 +631,21 @@ This API allows you to check whether the given element has a text content or not
631
631
##### Using document.querySelector
632
632
633
633
` ` ` javascript
634
- const button = document .querySelector (' [data-testid="count-value"]' )
634
+ const element = document .querySelector (' [data-testid="count-value"]' )
635
635
636
- expect (content ).toHaveTextContent (' 2' )
637
- expect (content ).toHaveTextContent (/ ^ 2$ / )
638
- expect (content ).not .toHaveTextContent (' 21' )
636
+ expect (element ).toHaveTextContent (' 2' )
637
+ expect (element ).toHaveTextContent (/ ^ 2$ / )
638
+ expect (element ).not .toHaveTextContent (' 21' )
639
639
` ` `
640
640
641
641
##### Using dom-testing-library
642
642
643
643
` ` ` javascript
644
- const content = getByTestId (container, ' count-value' )
644
+ const element = getByTestId (container, ' count-value' )
645
645
646
- expect (content ).toHaveTextContent (' 2' )
647
- expect (content ).toHaveTextContent (/ ^ 2$ / )
648
- expect (content ).not .toHaveTextContent (' 21' )
646
+ expect (element ).toHaveTextContent (' 2' )
647
+ expect (element ).toHaveTextContent (/ ^ 2$ / )
648
+ expect (element ).not .toHaveTextContent (' 21' )
649
649
` ` `
650
650
651
651
<hr />
0 commit comments