File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -561,7 +561,9 @@ test('can fill in the form after loaded', async () => {
561
561
562
562
// wait until the callback does not throw an error. In this case, that means
563
563
// it'll wait until the element with the text that says "loading..." is gone.
564
- await wait (() => expect (queryByText (/ loading\.\.\. / i ).not .toBeInTheDOM ()))
564
+ await wait (() =>
565
+ expect (queryByText (/ loading\.\.\. / i ).not .toBeInTheDocument ()),
566
+ )
565
567
getByLabelText (' username' ).value = ' chucknorris'
566
568
// continue doing stuff
567
569
})
@@ -658,7 +660,7 @@ import {render} from 'react-testing-library'
658
660
const {queryAllByText } = render (<Forms />)
659
661
const submitButtons = queryAllByText (' submit' )
660
662
expect (submitButtons ).toHaveLength (3 ) // expect 3 elements
661
- expect (submitButtons [0 ]).toBeInTheDOM ()
663
+ expect (submitButtons [0 ]).toBeInTheDocument ()
662
664
` ` `
663
665
664
666
## Examples
Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ test('works great with react portals', () => {
43
43
}
44
44
45
45
const { unmount, getByTestId, getByText} = render ( < MyPortal /> )
46
- expect ( getByText ( 'Hello World' ) ) . toBeInTheDOM ( )
46
+ expect ( getByText ( 'Hello World' ) ) . toBeInTheDocument ( )
47
47
const portalNode = getByTestId ( 'my-portal' )
48
- expect ( document . body . contains ( portalNode ) ) . toBe ( true )
48
+ expect ( portalNode ) . toBeInTheDocument ( )
49
49
unmount ( )
50
- expect ( document . body . contains ( portalNode ) ) . toBe ( false )
50
+ expect ( portalNode ) . not . toBeInTheDocument ( )
51
51
} )
52
52
53
53
test ( 'returns baseElement which defaults to document.body' , ( ) => {
You can’t perform that action at this time.
0 commit comments