11import { render } from '@testing-library/vue'
2+ import { describe , expect , it } from 'vitest'
23
34import VIcon from '../VIcon/VIcon.vue'
45
5- // import '@gouvfr/dsfr/dist/core/core.module.js'
6-
76import DsfrCallout from './DsfrCallout.vue'
87
98describe ( 'DsfrCallout' , ( ) => {
10- it ( 'should display a callout without a button ' , ( ) => {
9+ it ( 'should display a callout' , ( ) => {
1110 const title = 'Titre de la mise en avant'
1211 const content = 'Lorem ipsum dolor sit amet, consectetur adipiscing, incididunt, ut labore et dol'
12+ const accent = 'orange-terre-battue'
13+ const icon = 'fr-icon-alarm-warning-line'
14+ const button = { label : 'label bouton' }
1315
14- const { getByText } = render ( DsfrCallout , {
16+ const { getByText, container } = render ( DsfrCallout , {
1517 global : {
1618 components : {
1719 VIcon,
@@ -20,13 +22,21 @@ describe('DsfrCallout', () => {
2022 props : {
2123 title,
2224 content,
25+ accent,
26+ icon,
27+ button,
2328 } ,
2429 } )
2530
31+ const calloutEl = container . querySelector ( '.fr-callout' )
2632 const titleEl = getByText ( title )
2733 const contentEl = getByText ( content )
34+ const buttonEl = container . querySelector ( '.fr-btn' )
2835
29- expect ( titleEl ) . toHaveClass ( 'fr-callout__title' )
30- expect ( contentEl ) . toHaveClass ( 'fr-callout__text' )
36+ expect ( calloutEl ?. className ) . toContain ( `fr-callout--${ accent } ` )
37+ expect ( calloutEl ?. className ) . toContain ( icon )
38+ expect ( titleEl . className ) . toContain ( 'fr-callout__title' )
39+ expect ( contentEl . className ) . toContain ( 'fr-callout__text' )
40+ expect ( buttonEl ?. innerHTML ) . toContain ( button . label )
3141 } )
3242} )
0 commit comments