1
1
import { beforeEach , describe , it , jest } from '@jest/globals' ;
2
- import { within } from '@testing-library/dom' ;
2
+ import { fireEvent , screen , within } from '@testing-library/dom' ;
3
3
import { mocked } from 'jest-mock' ;
4
4
import { html } from 'lit' ;
5
- // TODO: Switch back to standard @testing -library/dom https://github.com/testing-library/dom-testing-library/issues/413
6
- import { fireEvent , screen } from 'testing-library__dom' ;
7
5
import { fixture } from '../../__tests__/helpers/fixtures' ;
8
6
import { openVideoDialog } from '../store/ui/actions' ;
9
7
import { aboutBlock } from '../utils/data' ;
@@ -23,14 +21,16 @@ describe('about-block', () => {
23
21
} ) ;
24
22
25
23
it ( 'renders details' , async ( ) => {
26
- await fixture ( html `< about-block > </ about-block > ` ) ;
27
-
28
- expect ( screen . getByText ( aboutBlock . title ) ) . toBeInTheDocument ( ) ;
29
- expect (
30
- screen . getByText ( aboutBlock . callToAction . featuredSessions . description )
31
- ) . toBeInTheDocument ( ) ;
32
- expect ( screen . getByText ( aboutBlock . statisticsBlock . attendees . number ) ) . toBeInTheDocument ( ) ;
33
- expect ( screen . getByText ( aboutBlock . statisticsBlock . attendees . label ) ) . toBeInTheDocument ( ) ;
24
+ const { shadowRootForWithin } = await fixture (
25
+ html `< about-block data-testid ="block "> </ about-block > `
26
+ ) ;
27
+ const { getByText } = within ( shadowRootForWithin ) ;
28
+
29
+ expect ( screen . getByTestId ( 'block' ) ) . toBeInTheDocument ( ) ;
30
+ expect ( getByText ( aboutBlock . title ) ) . toBeInTheDocument ( ) ;
31
+ expect ( getByText ( aboutBlock . callToAction . featuredSessions . description ) ) . toBeInTheDocument ( ) ;
32
+ expect ( getByText ( aboutBlock . statisticsBlock . attendees . number ) ) . toBeInTheDocument ( ) ;
33
+ expect ( getByText ( aboutBlock . statisticsBlock . attendees . label ) ) . toBeInTheDocument ( ) ;
34
34
} ) ;
35
35
36
36
it ( 'plays the video' , async ( ) => {
0 commit comments