-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dsfr): ajout des liens d'évitement
- Loading branch information
Showing
11 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/code-du-travail-frontend/cypress/integration/light/header.spec.ts
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 @@ | ||
describe("Header", () => { | ||
it("doit afficher les liens d'évitement", () => { | ||
cy.visit("/mentions-legales"); | ||
cy.get("[id^=fr-skiplinks]").as("skipLink").should("not.be.visible"); | ||
cy.window().focus().realPress("Tab"); | ||
cy.get("@skipLink").should("be.visible"); | ||
cy.focused().should("have.attr", "href", "#main"); | ||
cy.realPress("Tab"); | ||
cy.focused().should("have.attr", "href", "#fr-header-main-navigation"); | ||
cy.realPress("Tab"); | ||
cy.focused().should("have.attr", "href", "#fr-header-search-input"); | ||
cy.realPress("Tab"); | ||
cy.focused().should("have.attr", "href", "#more-info"); | ||
cy.realPress("Enter"); | ||
cy.get("@skipLink").should("not.have.focus").and("not.be.visible"); | ||
cy.realPress("Tab"); | ||
cy.focused().should("have.text", "Trouver les services près de chez moi"); | ||
}); | ||
}); |
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
24 changes: 24 additions & 0 deletions
24
packages/code-du-travail-frontend/src/modules/layout/SkipLinks.tsx
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,24 @@ | ||
import { SkipLinks as DsfrSkipLinks } from "@codegouvfr/react-dsfr/SkipLinks"; | ||
|
||
export const SkipLinks = () => ( | ||
<DsfrSkipLinks | ||
links={[ | ||
{ | ||
anchor: "#main", | ||
label: "Contenu", | ||
}, | ||
{ | ||
anchor: "#fr-header-main-navigation", | ||
label: "Menu", | ||
}, | ||
{ | ||
anchor: "#fr-header-search-input", | ||
label: "Recherche", | ||
}, | ||
{ | ||
anchor: "#more-info", | ||
label: "Pied de page", | ||
}, | ||
]} | ||
/> | ||
); |
10 changes: 10 additions & 0 deletions
10
packages/code-du-travail-frontend/src/modules/layout/__tests__/SkipLinks.test.tsx
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,10 @@ | ||
import { render } from "@testing-library/react"; | ||
import React from "react"; | ||
import { SkipLinks } from "../SkipLinks"; | ||
|
||
describe("<SkipLinks />", () => { | ||
it("should match snapshot", () => { | ||
const { container } = render(<SkipLinks />); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ export const Header = () => { | |
/> | ||
)} | ||
onSearchButtonClick={onSearchSubmit} | ||
|
||
/> | ||
); | ||
}; |
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