@@ -118,6 +118,7 @@ describe('DsfrFooter', () => {
118118 it ( 'should mount DsfrFooter with right content' , async ( ) => {
119119 // Given
120120 const testIdMentionsLegales = '/mentions-legales'
121+ const licenceText = 'Licence ouverte'
121122
122123 // When
123124 const { container, getByTestId } = render ( DsfrFooter , {
@@ -129,15 +130,78 @@ describe('DsfrFooter', () => {
129130 } ,
130131 props : {
131132 a11yCompliance : 'totalement conforme' ,
133+ licenceText,
132134 } ,
133135 } )
134136
135137 await router . isReady ( )
136138
137139 const ecosystemLinksLis = container . querySelectorAll ( '.fr-footer__content-list .fr-footer__content-link' )
140+ const licenceEl = container . querySelector ( '.fr-footer__bottom-copy' )
138141
139142 // Then
140143 expect ( ecosystemLinksLis ) . toHaveLength ( 4 )
144+ expect ( licenceEl ) . not . toBeNull ( )
145+ expect ( getByTestId ( testIdMentionsLegales ) ) . toHaveClass ( 'fr-footer__bottom-link' )
146+ } )
147+
148+ it ( 'should not display div.fr-footer__bottom-copy if licenceText is empty string' , async ( ) => {
149+ // Given
150+ const testIdMentionsLegales = '/mentions-legales'
151+ const licenceText = ''
152+
153+ // When
154+ const { container, getByTestId } = render ( DsfrFooter , {
155+ global : {
156+ plugins : [ router ] ,
157+ components : {
158+ VIcon,
159+ } ,
160+ } ,
161+ props : {
162+ a11yCompliance : 'totalement conforme' ,
163+ licenceText,
164+ } ,
165+ } )
166+
167+ await router . isReady ( )
168+
169+ const ecosystemLinksLis = container . querySelectorAll ( '.fr-footer__content-list .fr-footer__content-link' )
170+ const licenceEl = container . querySelector ( '.fr-footer__bottom-copy' )
171+
172+ // Then
173+ expect ( ecosystemLinksLis ) . toHaveLength ( 4 )
174+ expect ( licenceEl ) . toBeNull ( )
175+ expect ( getByTestId ( testIdMentionsLegales ) ) . toHaveClass ( 'fr-footer__bottom-link' )
176+ } )
177+
178+ it ( 'should not display div.fr-footer__bottom-copy if licenceText is null' , async ( ) => {
179+ // Given
180+ const testIdMentionsLegales = '/mentions-legales'
181+ const licenceText = null
182+
183+ // When
184+ const { container, getByTestId } = render ( DsfrFooter , {
185+ global : {
186+ plugins : [ router ] ,
187+ components : {
188+ VIcon,
189+ } ,
190+ } ,
191+ props : {
192+ a11yCompliance : 'totalement conforme' ,
193+ licenceText,
194+ } ,
195+ } )
196+
197+ await router . isReady ( )
198+
199+ const ecosystemLinksLis = container . querySelectorAll ( '.fr-footer__content-list .fr-footer__content-link' )
200+ const licenceEl = container . querySelector ( '.fr-footer__bottom-copy' )
201+
202+ // Then
203+ expect ( ecosystemLinksLis ) . toHaveLength ( 4 )
204+ expect ( licenceEl ) . toBeNull ( )
141205 expect ( getByTestId ( testIdMentionsLegales ) ) . toHaveClass ( 'fr-footer__bottom-link' )
142206 } )
143207} )
0 commit comments