Skip to content

Commit

Permalink
feat(contribution): passage au DSFR (#6428)
Browse files Browse the repository at this point in the history
* chore(dsfr): mise à jour de la version DSFR

* fix(dsfr): ignore les exceptions d'hydratation

* feat(tests): ajout du module de testing (#6096)

* fix: tests

* fix: tests

* fix: command

* fix: merge date

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix(dsfr): ignore les exceptions d'hydratation

* fix: readme

* feat(DSFR): migration de la page article du code du travail (#6099)

* feat: 6093 dsfr page politique de confidentialit (#6094)

* feat: implémentation page politique confidentialité dsfr

* chore: clean

* fix: iframe dark mode

* chore: refacto + e2e test

* feat: convert a to Link

* chore: review

* chore: rename test

---------

Co-authored-by: victor <[email protected]>

* feat(dsfr): ajout des liens d'évitement (#6120)

* feat(dsfr): migration de la page plan du site (#6097)

* feat(dsfr): mise à jour des snapshots

* feat(dsfr): mise à jour des snapshots

* chore(dsfr): mise à jour de la lib DSFR

* feat(dsfr): ajout du composant "Avez-vous trouvé une réponse à votre question" (#6121)

* fix: merge date

* fix: satisfaction

* fix: retours preavis

* fix: retours preavis

* fix: tests

* move feedback component to the page articleCodeDuTravail.tsx

* clean-up css

* fix: feedback

* fix: feedback

* fix: tests

* fix: tests

* feat(dsfr): création du composant "Besoin de plus d'information" (#6135)

* fix: ui

* fix: composant

---------

Co-authored-by: carolineBda <[email protected]>
Co-authored-by: Martial Maillot <[email protected]>

* fix: retours

* fix: tests

* feat: nouvelle API pour les articles du code du travail (#6132)

Co-authored-by: carolineBda <[email protected]>

* fix(spec) : fix de la spec article-code-du-travail.spec.ts

* fix(dsfr): ajout de la config pour supprimer le `insafe-inline` des `scripts` dans les `csp` (#6151)

* feat(dsfr): ajout de matomo pour tracker les events (#6157)

* fix: matomo

* fix: matomo

---------

Co-authored-by: Martial Maillot <[email protected]>

* fix(feedback): ajout d'une logique de caractères restants (#6156)

* fix: tests

* feat: limiter à 500 caractères la saisie

* feat: limiter à 500 caractères la saisie

---------

Co-authored-by: Martial Maillot <[email protected]>

* feat(dsfr): ajout du nouveau logo (#6159)

* feat(dsfr): ajout des pages d'erreurs (404 + 500) (#6146)

* fix: pages

* fix: 404

* fix: tests

* fix: tests

* fix: tests

* fix: lint

* test error

* fix errors

* Fix spec

* add button to test error page

* feat: force error 500 for testing purpose

* feat: revert errors

---------

Co-authored-by: carolineBda <[email protected]>
Co-authored-by: Martial Maillot <[email protected]>

* feat: séparation des anciennes API et des nouvelles (#6183)

* fix(article code du travail): retrait du tag Code du travail (#6182)

* feat(config): correction de `husky`, ajout de `prettier` pour le formattage et de `lint-staged` pour runner le formattage au `precommit` (#6192)

* fix: prettier

* fix: prettier

* fix: readme

* fix: readme

* fix: bug

* fix: prettier

* fix: prettier

* fix: tests

* fix: tests

* fix: prettier

* fix: prettier

* fix: branch

* merge dev

* feat: implémentation simulateur brut net

* chore: fix ts

* chore: snap

* chore: clean

* chore: clean

* chore: clean

* chore: review

* feat: update responsive

* Revert "Merge branch 'dev' into simulateur-brut-net-dsfr"

This reverts commit 0748928, reversing
changes made to cd15bc7.

* chore: clean

* feat: chore clean

* chore: clean

* chore: remove undesired files

* chore: remove undesired files

* chore: clean

* feat: implementation page convention collective

* feat: update button link

* fix: meta description share

* feat: switch simu brut net couleur par defaut

* feat: ajout de l'icone

* feat: update svg

* fix: ts

* fix: bug load

* chore: review

* fix: mobile display

* chore: review

* chore: review

* chore: review

* feat: implémentation trouver cc

* feat: implementation trouver CC

* chore: common style

* feat: add error alert entreprise search

* feat: disable card

* feat: ajout TU + fix

* chore: clean

* fix: e2e tests

* chore: clean

* feat: implementation contribution dsfr

* fix: widget

* fix: error

* feat: info bulle

* fix: widget

* fix: home fetch agreement

* feat: add postmessage searchCC

* fix: home cc

* feat: change contenu lié search cc

* fix: related items

* fix: message erreur lors de la recherche

* fix: error message

* fix: relatedItems

* chore: add TU

* refactor: move files to folders

* fix: build

* chore: review

* chore: clean

* fix: ajout des canonicals

* fix: input info

* fix: canonicals

* feat: ajout d'un spinner

* fix: tests

* chore: review

* feat: add spinner to enterprise search

* feat: contribution search cc

* refactor: queries

* fix: load on select item autocomplete

* fix: bug widget selection entreprise

* feat: implement alert message

* fix: disabled rule

* feat: localstorage

* chore: review

* chore: review

* chore: review

* chore: review

* chore: review

* chore: review

* feat: implement content

* chore: review

* fix: garder la recherche entrerprise au click precedent

* chore: review

* chore: review

* fix: TU + some styles

* fix: e2e

* refactor

* fix: TU

* fix: TU

* chore: review

* chore: review

* chore: review

* chore: review postalcode

* chore: review

* chore: review

* fix: cypress test

* chore: add widgetMode TU

* chore: fix test

* fix: cypress test

* fix: cypress test

* feat: implement

* chore: cy

* chore: fix cy

* refactor

* refactor

* chore: review

* chore: clean

* chore: review

* fix: largeur champs recherche entreprise

* feat: ajout d'un message d'erreur pour les codes naf

* feat: update design

* chore: clean

* feat: implement

* chore: design review

* chore: review

* chore: test noindex

* chore: nbsp

* chore: review

* chore: review

* chore: fix test e2e

* fix: previous

* feat: implement input CC search form

* fix: design

* chore: clean

* feat: ajout du localstorage

* fix: bug recherche cc selectionne

* fix: don't set cc for enterprise form

* fix: localstorage wrong load

* feat: add alert on CC select

* fix: localstorage preload

* fix: wrong slug

* fix: goBack not removing cc

* chore: review

* chore: review

* chore: TU

* feat: add fiche SP

* fix: design

* feat: tracking

* chore: TU fix

* fix: cc entreprise select

* feat: add tracking on radio agreement select

* chore: tracking p1 et p2

* fix: doublon tracking

* chore: snap

* chore: review

* fix: tracking event enterprise

* fix: TU

* fix: emit tracking enterprise recherche CC

* chore: add TU tracking

* feat: mise à jour design

* fix(contributions): affichage du nom de la CC dans le H1 des contribs personnalisées (#6399)

* fix: CC non traité message

* fix: merge

* refactor: contribution generic specific (#6421)

* fix: texte CC non traité

* refactor: division en plusieurs fichiers

* refactor: typage

* feat: ajout cas tests & correction message erreur cc non traité no CDT

* chore: rename TU

* feat: add TU non treated info description

* fix: bug display 0 in middle of contribution

* fix: design

* chore: TU on 3239

* fix: TU

* chore: review

* fix: accordion collapse on anchor

* fix: id no string

* fix: broken link

* fix: message warning non-treated agreement

* fix: TU

* fix: cc e2e tests

* fix: accordion id

* chore: review

* chore: review

* fix: regression number cc search

* fix: localstorage

* fix: review

* refactor: isAgreementValid

* chore: revert e2e deleted

* refactor: clean

---------

Co-authored-by: victor <[email protected]>

* clean

* clean

* fix: add TU contribution content

* fix: localstorage for enterprise search & noCdt description

* refactor: localstorage

* fix: margin references

* fix: tracking on display button click

* fix: radio unchecked by default

* fix: localstorage should select radio

* fix: design

* fix: date mise à jour fiche SP

* chore: add localstorage tests

* refactor: localstorage should not send events

* chore: snap

* fix: review metier

* fix: review code

* fix: review code

* refactor: use common link

* chore: snap

* clean up

* fix url widget

* lint

* remove text when no CDT

* fix related items

* clean up types

* try to fix spec

* fix spec

* fix snapshot

* fix lien widget !

* add rules that are now valid

* fix

* feat: scroll to enterprise on selection

* fix: TU

* fix: scroll agreement modify

* fix: list bullet truncate

* fix: TU

---------

Co-authored-by: Martial Maillot <[email protected]>
Co-authored-by: Maxime Golfier <[email protected]>
Co-authored-by: Victor Zeinstra <[email protected]>
Co-authored-by: victor <[email protected]>
  • Loading branch information
5 people committed Feb 3, 2025
1 parent aacfbb9 commit 423d249
Show file tree
Hide file tree
Showing 60 changed files with 4,327 additions and 498 deletions.
58 changes: 0 additions & 58 deletions packages/code-du-travail-frontend/__tests__/contributions.test.tsx

This file was deleted.

39 changes: 39 additions & 0 deletions packages/code-du-travail-frontend/app/contribution/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import { DsfrLayout } from "../../../src/modules/layout";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
import { fetchRelatedItems } from "../../../src/modules/documents";
import {
ContributionLayout,
fetchContributionBySlug,
} from "../../../src/modules/contributions";

export async function generateMetadata({ params }) {
const { metas } = await getContribution(params.slug);

return generateDefaultMetadata({
title: metas.title,
description: metas.description,
path: `/contribution/${params.slug}`,
});
}

async function Contribution({ params }) {
const contribution = await getContribution(params.slug);
return (
<DsfrLayout>
<ContributionLayout contribution={contribution} />
</DsfrLayout>
);
}

const getContribution = async (slug: string) => {
const contribution = await fetchContributionBySlug(slug);

if (!contribution) {
return notFound();
}
return contribution;
};

export default Contribution;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../../src/modules/outils/type";
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
import { EnterpriseAgreementSelectionLink } from "../../../../../src/modules/enterprise";
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
import { agreementRelatedItems } from "../../../../../src/modules/convention-collective/agreementRelatedItems";
import { SITE_URL } from "../../../../../src/config";
Expand Down Expand Up @@ -38,7 +38,7 @@ async function AgreementSelectionPage({ params }) {
relatedItems={agreementRelatedItems}
description={tool.description}
>
<EnterpriseAgreementSelection enterprise={enterprise} />
<EnterpriseAgreementSelectionLink enterprise={enterprise} />
</FindAgreementLayout>
</DsfrLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../../src/modules/outils/type";
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
import { EnterpriseAgreementSelectionLink } from "../../../../../src/modules/enterprise";
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
import { SITE_URL } from "../../../../../src/config";

Expand All @@ -27,7 +27,7 @@ async function AgreementSelectionPage({ params }) {
});
return (
<FindAgreementWidgetLayout>
<EnterpriseAgreementSelection enterprise={enterprise} widgetMode />
<EnterpriseAgreementSelectionLink enterprise={enterprise} widgetMode />
</FindAgreementWidgetLayout>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const localConfig: ConfigData = {
"aria-label-misuse": "off",
"long-title": "off",
"script-type": "off",
"no-dup-id": "off",
"wcag/h63": "off",
"wcag/h32": "off",
"no-redundant-role": "off",
"no-missing-references": "off",
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,8 @@ describe("Contributions", () => {
"La période d’essai peut-elle être renouvelée ?"
);

cy.get("div > p > span")
.invoke("text")
.should("match", /Mis à jour le/);
cy.get("div > p > span")
.invoke("text")
.should("match", /\d\d\/\d\d\/\d\d\d\d/);

cy.contains(
"Accéder aux informations générales sans renseigner ma convention collective"
"Afficher les informations sans sélectionner une convention collective"
).click();
cy.get("body").should("contain", "Que dit le code du travail");
cy.get("body").should(
Expand All @@ -45,18 +38,17 @@ describe("Contributions", () => {
);
cy.get("body").should("contain", "Références");
cy.get("body").should("contain", "L1221-21");
cy.get("body").should("contain", "Pour aller plus loin");
});

it("je vois une page contribution pour une CC", () => {
cy.visit("/contribution/675-la-periode-dessai-peut-elle-etre-renouvelee");
cy.get("h1").should(
"have.text",
"La période d’essai peut-elle être renouvelée ?"
"La période d’essai peut-elle être renouvelée ? Maisons à succursales de vente au détail d'habillement"
);
cy.get("h2").should(
"contain",
"Votre convention collective est Maisons à succursales de vente au détail d'habillement (IDCC 0675)"
"Maisons à succursales de vente au détail d'habillement (IDCC 0675)"
);

cy.get("body").should(
Expand All @@ -65,16 +57,14 @@ describe("Contributions", () => {
);

cy.get("a")
.contains(
"la convention collective Maisons à succursales de vente au détail d'habillement"
)
.contains("Maisons à succursales de vente au détail d'habillement")
.should(
"have.attr",
"href",
"/convention-collective/675-maisons-a-succursales-de-vente-au-detail-dhabillement"
);
cy.get("h2").should("contain", "Pour aller plus loin");
cy.get("h3").should(

cy.get("a").should(
"contain",
"Demande d’accord du salarié pour le renouvellement d’une période d’essai"
);
Expand All @@ -86,8 +76,8 @@ describe("Contributions", () => {
);
cy.get("h1").should(
"have.text",
"Combien de fois le contrat de travail peut-il être renouvelé ?"
"Combien de fois le contrat de travail peut-il être renouvelé ? Métallurgie"
);
cy.get('[aria-expanded="true"]').find("h3").should("contain", "CDD");
cy.get('[aria-expanded="true"]').should("contain", "CDD");
});
});
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
describe("Conventions collectives", () => {
it("je vois la liste de toutes les cc", () => {
cy.visit("/");
cy.findByRole("heading", { level: 1 })
.should("have.text", "Bienvenue sur le Code du travail numérique")
.click();
cy.get("#fr-header-main-navigation")
cy.findByRole("heading", { level: 1 }).should(
"have.text",
"Bienvenue sur le Code du travail numérique"
);

cy.get("#fr-header-main-navigation a")
.contains("Votre convention collective")
.click();

cy.urlEqual("/convention-collective");

cy.findByRole("heading", { level: 1 })
.should("have.text", "Votre convention collective")
.click();
cy.findByRole("heading", { level: 1 }).should(
"have.text",
"Votre convention collective"
);
cy.get("body").should(
"contain",
"Les conventions collectives présentées sont les plus représentatives en termes de nombre de salariés"
);
cy.get("#content a").should("have.length", 49);

cy.get("#content a").first().click();

cy.urlEqual(
"/convention-collective/2941-aide-accompagnement-soins-et-services-a-domicile-bad"
);
cy.get('[data-accordion-component="Accordion"]')
.eq(0)
.find('[data-accordion-component="AccordionItemButton"]')
.should("have.length", 6);

cy.get('[data-accordion-component="Accordion"]')
.eq(0)
.find('[data-accordion-component="AccordionItemButton"]')
Expand Down Expand Up @@ -71,9 +78,14 @@ describe("Conventions collectives", () => {
.find('[data-accordion-component="AccordionItemButton"]')
.first()
.click();
cy.get('[data-accordion-component="AccordionItem"] a').first().click();
cy.get('[data-accordion-component="AccordionItem"] a')
.first()
.contains(
"Quelles sont les conditions d’indemnisation pendant le congé de maternité"
)
.click();
cy.urlEqual(
"/convention-collective/2941-aide-accompagnement-soins-et-services-a-domicile-bad"
"/contribution/2941-quelles-sont-les-conditions-dindemnisation-pendant-le-conge-de-maternite"
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Outil - Trouver sa convention collective", () => {
cy.canonicalUrlEqual("/outils/convention-collective");
cy.contains("BOUILLON PIGALLE").click();

cy.contains("1 convention collective trouvée pour :");
cy.contains("1 convention collective trouvée :");

cy.contains("Précédent").click();
cy.selectByLabel("Nom de votre entreprise ou numéro Siren/Siret")
Expand All @@ -54,7 +54,7 @@ describe("Outil - Trouver sa convention collective", () => {
cy.selectByLabel("Code postal ou Ville (optionnel)").clear();
cy.get('button[type="submit"]').last().click();
cy.contains("CARREFOUR BANQUE").click();
cy.contains("2 conventions collectives trouvées pour :");
cy.contains("2 conventions collectives trouvées :");
cy.contains("Banque")
.should("have.prop", "href")
.and(
Expand Down
66 changes: 0 additions & 66 deletions packages/code-du-travail-frontend/pages/contribution/[slug].tsx

This file was deleted.

5 changes: 5 additions & 0 deletions packages/code-du-travail-frontend/panda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export default defineConfig({
},
},
},
globalCss: {
".fr-table__content table, .fr-table__content table *": {
whiteSpace: "normal",
},
},
outdir: "src/styled-system",
outExtension: "js",
importMap: "@styled-system",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render } from "@testing-library/react";
import DisplayContentContribution from "../DisplayContentContribution";
import { ReferencesJuridiques } from "../References";

describe("ReferencesJuridiques", () => {
Expand Down
Loading

0 comments on commit 423d249

Please sign in to comment.