Skip to content

Commit

Permalink
fix: navigation principale toujours visible
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Apr 3, 2024
1 parent 9ae5d32 commit 00163f1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 37 deletions.
9 changes: 6 additions & 3 deletions src/components/MainHeader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ describe("MainHeader", () => {
const wrapper = mount(MainHeader)

expect(wrapper.find('.tool-username').exists()).toEqual(false)
expect(wrapper.find('.fr-header__tools').text()).toEqual('Connexion')
expect(wrapper.find('.fr-header__tools').text()).toEqual('Connexion À propos')
expect(wrapper.find('[role="navigation"]').text()).toEqual('Grand public Agriculteur·ice')
})

test("with a warning header", async () => {
Expand Down Expand Up @@ -50,7 +51,7 @@ describe("MainHeader", () => {
})

expect(wrapper.find('.tool-username').exists()).toEqual(false)
expect(wrapper.find('.fr-header__tools').text()).toEqual('Accès professionnel')
expect(wrapper.find('.fr-header__tools').text()).toEqual('Connexion À propos')
expect(wrapper.find('[role="navigation"] a[target="_blank"]').exists()).toEqual(false)
})

Expand All @@ -61,6 +62,7 @@ describe("MainHeader", () => {
await flushPromises()

expect(wrapper.find('.tool-username a').classes('fr-icon-medal-fill')).toEqual(true)
expect(wrapper.find('[role="navigation"]').text()).toEqual('Exploitations Centre d\'aide Déconnexion')
expect(wrapper.find('[role="navigation"] a').attributes('href')).toEqual('/certification/exploitations')
expect(wrapper.find('[role="navigation"] a[target="_blank"]').attributes('href')).toEqual('https://docs-cartobio.agencebio.org/organisme-certification')

Expand All @@ -75,6 +77,7 @@ describe("MainHeader", () => {
await flushPromises()

expect(wrapper.find('.tool-username a').classes('fr-icon-plant-fill')).toEqual(true)
expect(wrapper.find('[role="navigation"]').text()).toEqual('Exploitations Centre d\'aide Déconnexion')
expect(wrapper.find('[role="navigation"] a').attributes('href')).toEqual('/exploitations')
expect(wrapper.find('[role="navigation"] a[target="_blank"]').attributes('href')).toEqual('https://docs-cartobio.agencebio.org/agriculteurs.trices')
})
Expand All @@ -86,6 +89,6 @@ describe("MainHeader", () => {
await flushPromises()

expect(wrapper.find('.tool-username a').classes('fr-icon-account-circle-fill')).toEqual(true)
expect(wrapper.find('[role="navigation"]').exists()).toEqual(false)
expect(wrapper.find('[role="navigation"]').text()).toEqual('Exploitations Centre d\'aide Déconnexion')
})
})
49 changes: 16 additions & 33 deletions src/components/MainHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>

<div class="fr-header__service">
<router-link to="/" rel="home">
<router-link :to="startPage" rel="home">
<p class="fr-header__service-title">
CartoBio <span class="fr-badge fr-badge--sm fr-badge--green-emeraude">beta</span>
</p>
Expand All @@ -27,7 +27,7 @@
</div>
</div>

<div class="fr-hidden fr-unhidden-lg fr-header__tools">
<div class="fr-header__tools">
<div class="fr-header__tools-links">
<ul class="fr-btns-group" v-if="isLogged">
<li class="tool-username" aria-hidden="true">
Expand All @@ -43,27 +43,27 @@
</router-link>
</li>
</ul>
<ul class="fr-btn-group" v-else>
<li v-if="$route.meta.generalAudience">
<router-link to="/pro" class="fr-btn fr-icon-account-circle-fill fr-btn--icon-left" aria-role="button">
Accès professionnel
</router-link>
</li>
<li v-else>
<ul class="fr-btns-group" v-else>
<li>
<router-link to="/login" class="fr-btn fr-icon-account-circle-fill fr-btn--icon-left" aria-role="button">
Connexion
</router-link>
</li>
<li>
<router-link to="/projet" class="fr-btn fr-icon-question-line fr-btn--icon-left">
À propos
</router-link>
</li>
</ul>
</div>
</div>
</div>
</div>

<div class="fr-header__menu" v-if="isLogged && userStore.isOc">
<div class="fr-header__menu">
<div class="fr-container">
<nav class="fr-nav" role="navigation" aria-label="Menu principal">
<ul class="fr-nav__list">
<ul class="fr-nav__list" v-if="isLogged">
<li class="fr-nav__item">
<router-link :to="startPage" class="fr-nav__link">
Exploitations
Expand All @@ -72,9 +72,6 @@
<li class="fr-nav__item">
<a :href="documentationPage" target="_blank" rel="noopener" class="fr-nav__link">Centre d'aide</a>
</li>
<li class="fr-nav__item">
<router-link to="/projet" class="fr-nav__link">À propos de CartoBio</router-link>
</li>
<li class="fr-nav__item fr-hidden-lg">
<router-link to="/logout" custom v-slot="{ href }">
<a :href="href" @click.prevent="logout" class="fr-nav__link" aria-role="button">
Expand All @@ -83,29 +80,15 @@
</router-link>
</li>
</ul>
</nav>
</div>
</div>
<div class="fr-header__menu" v-else-if="(isLogged && userStore.isAgri)">
<div class="fr-container">
<nav class="fr-nav" role="navigation" aria-label="Menu principal">
<ul class="fr-nav__list">
<ul class="fr-nav__list" v-else>
<li class="fr-nav__item">
<router-link :to="startPage" class="fr-nav__link">
Mes exploitations
<router-link to="/" class="fr-nav__link">
Grand public
</router-link>
</li>
<li class="fr-nav__item">
<a :href="documentationPage" target="_blank" rel="noopener" class="fr-nav__link">Centre d'aide</a>
</li>
<li class="fr-nav__item">
<router-link to="/projet" class="fr-nav__link">À propos de CartoBio</router-link>
</li>
<li class="fr-nav__item fr-hidden-lg">
<router-link to="/logout" custom v-slot="{ href }">
<a :href="href" @click.prevent="logout" class="fr-nav__link" aria-role="button">
Déconnexion
</a>
<router-link to="/pro" class="fr-nav__link">
Agriculteur·ice
</router-link>
</li>
</ul>
Expand Down
1 change: 0 additions & 1 deletion src/pages/projet.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<route lang="yaml">
meta:
generalAudience: true
seo:
title: Stratégie et historique du projet CartoBio
</route>
Expand Down

0 comments on commit 00163f1

Please sign in to comment.