Skip to content

Commit 7c8463c

Browse files
committed
fix: 🐛 ajoute condition pour affichage div.fr-footer__bottom-copy
Désormais il faut que la prop licenceText ne soit pas falsy (chaîne vide) pour que le texte de la licence s’affiche
1 parent d1d262d commit 7c8463c

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

src/components/DsfrFooter/DsfrFooter.spec.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
})

src/components/DsfrFooter/DsfrFooter.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ const aLicenceHref = computed(() => {
204204
</RouterLink>
205205
</li>
206206
</ul>
207-
<div class="fr-footer__bottom-copy">
207+
<div
208+
v-if="licenceText"
209+
class="fr-footer__bottom-copy"
210+
>
208211
<p>
209212
{{ licenceText }}
210213
<component

0 commit comments

Comments
 (0)