-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #625 from dnum-mi/develop
Develop
- Loading branch information
Showing
10 changed files
with
244 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { render } from '@testing-library/vue' | ||
import DsfrBackToTop from './DsfrBackToTop.vue' | ||
|
||
describe('DsfrBackToTop', () => { | ||
it('should render a success BackToTop', async () => { | ||
const label = 'Haut de page' | ||
const expectClass = 'fr-link fr-icon-arrow-up-fill' | ||
const position = 'left' | ||
|
||
const { getByText } = render(DsfrBackToTop, { | ||
props: { | ||
label, | ||
position, | ||
}, | ||
}) | ||
|
||
const anchorElement = getByText(label) | ||
expect(anchorElement).toBeDefined() | ||
// Verifier si a possède la class attendu | ||
expect(anchorElement).toHaveClass(expectClass) | ||
expect(anchorElement).toHaveClass(`fr-link--icon-${position}`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import DsfrBackToTop from './DsfrBackToTop.vue' | ||
|
||
/** | ||
* [Voir quand l’utiliser sur la documentation du DSFR](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/retour-en-haut-de-page/) | ||
*/ | ||
export default { | ||
component: DsfrBackToTop, | ||
title: 'Composants/DsfrBackToTop', | ||
argTypes: { | ||
label: { | ||
control: 'text', | ||
description: 'Titre (texte)', | ||
}, | ||
position: { | ||
options: ['left', 'right'], | ||
control: 'select', | ||
description: '(Optionnel) **Position** de la fleche îcone : `left` (à gauche), `right` (à droite)', | ||
}, | ||
}, | ||
} | ||
|
||
export const BackToTop = (args) => ({ | ||
components: { | ||
DsfrBackToTop, | ||
}, | ||
data () { | ||
return args | ||
}, | ||
template: ` | ||
<DsfrBackToTop :label="label" :position="position"/> | ||
`, | ||
}) | ||
BackToTop.args = { | ||
position: 'left', | ||
label: 'Haut de page', | ||
} | ||
|
||
export const TousLesBacktoTop = (args) => ({ | ||
components: { | ||
DsfrBackToTop, | ||
}, | ||
data () { | ||
return args | ||
}, | ||
template: ` | ||
<p> | ||
<DsfrBackToTop label="Haut de page" position="left"/> | ||
</p> | ||
<p> | ||
<DsfrBackToTop label="Haut de page" position="right"/> | ||
</p> | ||
<p> | ||
<DsfrBackToTop label="Haut" position="right"/> | ||
</p> | ||
`, | ||
}) | ||
TousLesBacktoTop.args = { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script setup lang="ts"> | ||
withDefaults(defineProps<{ | ||
label?: string | ||
position?: 'right' | 'left' | ||
}>(), { | ||
position: 'right', | ||
label: 'Haut de page', | ||
}) | ||
</script> | ||
|
||
<template> | ||
<a | ||
class="fr-link fr-icon-arrow-up-fill" | ||
:class="`fr-link--icon-${position}`" | ||
href="#top" | ||
> | ||
{{ label }} | ||
</a> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.