fix: sidebar + autocomplete (#88)
Release / release (push) Successful in 50s

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

---------

Co-authored-by: admin malio <malio@yuno.malio.fr>
Co-authored-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr>
Reviewed-on: #88
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #88.
This commit is contained in:
2026-06-25 08:44:17 +00:00
committed by Autin
parent 28705c8285
commit b5bebe3a3c
9 changed files with 241 additions and 11 deletions
+49 -7
View File
@@ -107,19 +107,24 @@ describe('MalioSidebar', () => {
expect(links[2].attributes('href')).toBe('/fournisseurs')
})
it('hover : fond + couleur + semi-bold tous portés par le <li> (texte non figé sur le <a>)', () => {
it('hover : fond + couleur + semi-bold portés par le <li>', () => {
const wrapper = mountComponent({sections})
const li = wrapper.find('li')
expect(li.classes()).toContain('hover:bg-m-primary/10')
expect(li.classes()).toContain('hover:text-m-primary')
expect(li.classes()).toContain('hover:font-semibold')
expect(li.classes()).toContain('text-black')
expect(li.classes()).toContain('pt-1')
expect(li.classes()).toContain('pb-1')
// Le <a> ne fige PAS sa couleur (sinon le texte resterait noir sur les bandes
// pt-1/pb-1 hors du <a> alors que le fond du <li> est bleu).
expect(wrapper.find('a').classes()).not.toContain('text-black')
expect(wrapper.find('a').classes()).not.toContain('hover:text-m-primary')
})
it('zone cliquable : le padding vertical est sur le <a>, pas sur le <li> (pas de bande morte au survol)', () => {
const wrapper = mountComponent({sections})
// Le padding vertical doit appartenir à la cible de clic (<a>) pour que toute
// la bande survolée soit cliquable — sinon pt-1/pb-1 sur le <li> crée une
// bande colorée mais non cliquable en haut et en bas du lien.
const li = wrapper.find('li')
expect(li.classes()).not.toContain('pt-1')
expect(li.classes()).not.toContain('pb-1')
expect(wrapper.find('a').classes()).toContain('py-1')
})
it('actif : route exacte → lien en primary + semi-bold, sans fond', () => {
@@ -239,6 +244,43 @@ describe('MalioSidebar', () => {
expect(wrapper.find('img[alt="M"]').exists()).toBe(true)
})
it('renders footer slot when expanded', () => {
const wrapper = mountComponent({sections}, {
footer: '<a href="/logout">Déconnexion</a>',
})
expect(wrapper.find('a[href="/logout"]').exists()).toBe(true)
expect(wrapper.text()).toContain('Déconnexion')
})
it('renders footer-collapsed slot when collapsed', async () => {
const wrapper = mountComponent({sections}, {
'footer-collapsed': '<span>FC</span>',
})
await wrapper.find('button').trigger('click')
expect(wrapper.text()).toContain('FC')
})
it('footer is rendered after the nav (pushed to the bottom)', () => {
const wrapper = mountComponent({sections}, {
footer: '<span class="ft">Footer</span>',
})
const children = wrapper.find('aside').element.children
const navIndex = Array.from(children).findIndex(el => el.tagName === 'NAV')
const footerEl = wrapper.find('.ft').element
const footerWrapperIndex = Array.from(children).findIndex(el => el.contains(footerEl))
expect(footerWrapperIndex).toBeGreaterThan(navIndex)
})
it('does not render a footer container when no footer slot is provided', () => {
const wrapper = mountComponent({sections})
// Seuls le bloc logo et le <nav> sont des conteneurs (+ le bouton toggle).
// Aucun div de footer ne doit apparaître après le <nav>.
const children = Array.from(wrapper.find('aside').element.children)
const navIndex = children.findIndex(el => el.tagName === 'NAV')
const after = children.slice(navIndex + 1)
expect(after.some(el => el.tagName === 'DIV')).toBe(false)
})
it('uses custom id when provided', () => {
const wrapper = mountComponent({sections, id: 'my-sidebar'})
expect(wrapper.find('aside').attributes('id')).toBe('my-sidebar')