@@ -8,13 +8,21 @@ test('renders an accesible and closable Callout', async () => {
88 const handleCloseSpy = jest . fn ( ) ;
99 render (
1010 < ThemeContextProvider theme = { makeTheme ( ) } >
11- < Callout title = "some title" description = "some description" onClose = { handleCloseSpy } />
11+ < Callout
12+ aria-label = "some label"
13+ title = { { text : 'some title' , 'aria-label' : 'some title aria label' } }
14+ description = "some description"
15+ onClose = { handleCloseSpy }
16+ />
1217 </ ThemeContextProvider >
1318 ) ;
1419
15- const callout = screen . getByRole ( 'region' ) ;
20+ const callout = screen . getByRole ( 'region' , { name : 'some label' } ) ;
1621 expect ( callout ) . toBeInTheDocument ( ) ;
1722
23+ const title = within ( callout ) . getByRole ( 'heading' , { name : 'some title aria label' } ) ;
24+ expect ( title ) . toBeInTheDocument ( ) ;
25+
1826 const closeButton = within ( callout ) . getByRole ( 'button' , { name : 'Cerrar' } ) ;
1927 expect ( closeButton ) . toBeInTheDocument ( ) ;
2028
@@ -28,6 +36,7 @@ test('renders an accesible and closable Callout with custom close button label',
2836 render (
2937 < ThemeContextProvider theme = { makeTheme ( ) } >
3038 < Callout
39+ aria-label = "some label"
3140 title = "some title"
3241 description = "some description"
3342 onClose = { handleCloseSpy }
@@ -36,7 +45,7 @@ test('renders an accesible and closable Callout with custom close button label',
3645 </ ThemeContextProvider >
3746 ) ;
3847
39- const callout = screen . getByRole ( 'region' ) ;
48+ const callout = screen . getByRole ( 'region' , { name : 'some label' } ) ;
4049 expect ( callout ) . toBeInTheDocument ( ) ;
4150
4251 const closeButton = within ( callout ) . getByRole ( 'button' , { name : 'custom close label' } ) ;
0 commit comments