Skip to content

Commit 3d27842

Browse files
authored
Merge pull request #1136 from MaitreManuel/fix-title-dsfr-pagination-dsfr-share
DsfrPagination & DsfrShare corrections sur les attributs title
2 parents 800e4a7 + d650f6e commit 3d27842

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

src/components/DsfrPagination/DsfrPagination.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ describe('DsfrPagination', () => {
88
it('should render a list of links to give quick access to several pages', async () => {
99
// Given
1010
const pages = [
11-
{ label: '1', href: '/#', title: 'Page 1' },
12-
{ label: '2', href: '/#', title: 'Page 2' },
13-
{ label: '3', href: '/#', title: 'Page 3' },
14-
{ label: '4', href: '/#', title: 'Page 4' },
15-
{ label: '5', href: '/#', title: 'Page 5' },
11+
{ label: '1', href: '/#' },
12+
{ label: '2', href: '/#' },
13+
{ label: '3', href: '/#' },
14+
{ label: '4', href: '/#' },
15+
{ label: '5', href: '/#' },
1616
]
1717
const currentPage = 1
1818

1919
// When
20-
const { getByTitle, emitted } = render(Pagination, {
20+
const { getByText, emitted } = render(Pagination, {
2121
global: {
2222
components: {
2323
VIcon,
@@ -29,7 +29,7 @@ describe('DsfrPagination', () => {
2929
},
3030
})
3131

32-
const thirdLink = getByTitle('Page 3')
32+
const thirdLink = getByText('3')
3333
await fireEvent.click(thirdLink)
3434

3535
// Then

src/components/DsfrPagination/DsfrPagination.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
4848
:href="pages[0]?.href"
4949
class="fr-pagination__link fr-pagination__link--first"
5050
:class="{ 'fr-pagination__link--disabled': currentPage === 0 }"
51-
:title="firstPageTitle"
5251
:aria-disabled="currentPage === 0 ? true : undefined"
5352
@click.prevent="currentPage === 0 ? null : tofirstPage()"
5453
>
@@ -60,7 +59,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
6059
:href="pages[Math.max(currentPage - 1, 0)]?.href"
6160
class="fr-pagination__link fr-pagination__link--prev fr-pagination__link--lg-label"
6261
:class="{ 'fr-pagination__link--disabled': currentPage === 0 }"
63-
:title="prevPageTitle"
6462
:aria-disabled="currentPage === 0 ? true : undefined"
6563
@click.prevent="currentPage === 0 ? null : toPreviousPage()"
6664
>{{ prevPageTitle }}</a>
@@ -72,7 +70,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
7270
<a
7371
:href="page?.href"
7472
class="fr-pagination__link fr-unhidden-lg"
75-
:title="page.title"
7673
:aria-current="isCurrentPage(page) ? 'page' : undefined"
7774
@click.prevent="toPage(pages.indexOf(page))"
7875
>
@@ -86,7 +83,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
8683
:href="pages[Math.min(currentPage + 1, pages.length - 1)]?.href"
8784
class="fr-pagination__link fr-pagination__link--next fr-pagination__link--lg-label"
8885
:class="{ 'fr-pagination__link--disabled': currentPage === pages.length - 1 }"
89-
:title="nextPageTitle"
9086
:disabled="currentPage === pages.length - 1 ? true : undefined"
9187
:aria-disabled="currentPage === pages.length - 1 ? true : undefined"
9288
@click.prevent="currentPage === pages.length - 1 ? null : toNextPage()"
@@ -97,7 +93,6 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
9793
:href="pages.at(-1)?.href"
9894
class="fr-pagination__link fr-pagination__link--last"
9995
:class="{ 'fr-pagination__link--disabled': currentPage === pages.length - 1 }"
100-
:title="lastPageTitle"
10196
:disabled="currentPage === pages.length - 1 ? true : undefined"
10297
:aria-disabled="currentPage === pages.length - 1 ? true : undefined"
10398
@click.prevent="currentPage === pages.length - 1 ? null : toLastPage()"
@@ -112,7 +107,7 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
112107
<style scoped>
113108
.fr-pagination__link:hover {
114109
background-image: linear-gradient(
115-
deg, rgba(224,224,224,0.5), rgba(224,224,224,0.5));
110+
deg, rgba(224,224,224,0.5), rgba(224,224,224,0.5));
116111
}
117112
.fr-pagination__link--disabled {
118113
color: currentColor;

src/components/DsfrShare/DsfrShare.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('DsfrShare', () => {
88
const copyLabel = 'Label de la copie dans le presse-papier'
99
const mail = {
1010
to: 'mailto:?subject=[À MODIFIER - objet du mail]&body=[À MODIFIER - titre ou texte descriptif de la page] [À MODIFIER - url de la page]',
11-
label: 'Partager par mail personnalisé',
11+
label: 'Partager par mail personnalisé - nouvelle fenêtre',
1212
}
1313
const networks = [
1414
{
@@ -47,7 +47,7 @@ describe('DsfrShare', () => {
4747
}
4848

4949
const mailToLinkElement = getByText(mail.label)
50-
expect(mailToLinkElement).toHaveAttribute('title', mail.label)
50+
expect(mailToLinkElement).toHaveAttribute('title', `${mail.label} - nouvelle fenêtre`)
5151
expect(mailToLinkElement).toHaveAttribute('href', mail.to)
5252

5353
const copyButtonElement = getByText(copyLabel)

src/components/DsfrShare/DsfrShare.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const openWindow = ({ url, label }: { url: string, label: string }) => {
4949
<a
5050
class="fr-btn fr-btn--mail"
5151
:href="mail.to"
52-
:title="mail.label"
52+
:title="`${mail.label} - nouvelle fenêtre`"
5353
target="_blank"
5454
rel="noopener noreferrer"
5555
>

0 commit comments

Comments
 (0)