Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DSFR): migration des pages fiches service public #6277

Merged
merged 37 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5f973f2
feat(DSFR): migration des pages fiches service public
carolineBda Nov 12, 2024
b1201b3
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
carolineBda Nov 14, 2024
214c28e
implement rest of it
carolineBda Nov 14, 2024
8805627
ts
carolineBda Nov 14, 2024
1263598
add types
carolineBda Nov 19, 2024
7bbcd7b
more typing
carolineBda Nov 19, 2024
c6ec94e
add tests
carolineBda Nov 19, 2024
0c2f531
update types
carolineBda Nov 19, 2024
3c5a189
fix test
carolineBda Nov 19, 2024
db6bcab
fix spec
carolineBda Nov 19, 2024
5d89d64
prise en compte des retours suite à la réu design
carolineBda Nov 25, 2024
e2048a2
ne pas afficher de sous accordéons à partir du 3eme niveau
carolineBda Nov 25, 2024
4db2633
fix
carolineBda Nov 25, 2024
cb36953
clean
carolineBda Nov 25, 2024
3744e0f
clean
carolineBda Nov 25, 2024
dc63452
do not show accordion for BlocCas (broken with AccordionWithAnchor)
carolineBda Nov 26, 2024
4b760c7
fix test + put back canonical
carolineBda Nov 28, 2024
c53d2d6
clean up
carolineBda Nov 28, 2024
ce3e9d5
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
m-maillot Dec 3, 2024
41a28b9
duplicate Builder to avoid conflicts with old code
m-maillot Dec 3, 2024
81eb58c
fix types
m-maillot Dec 5, 2024
91859c7
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
m-maillot Dec 5, 2024
7677801
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
carolineBda Dec 9, 2024
130e63d
fix accordion group
carolineBda Dec 10, 2024
c971bad
fix accordion
carolineBda Dec 10, 2024
cec076f
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
carolineBda Dec 12, 2024
b217376
fix refs
carolineBda Dec 12, 2024
356a6cf
fix padding list
carolineBda Dec 12, 2024
7e14b10
fix test
carolineBda Dec 12, 2024
ae36367
fix accordion in tabs
carolineBda Dec 12, 2024
35f1e89
fix fix
carolineBda Dec 12, 2024
8bd3e8c
Merge branch 'dev' into carolineBda/dsfr-fiche-SP
carolineBda Dec 16, 2024
3db36f8
fix accordion with id
carolineBda Dec 16, 2024
754c199
add more test
carolineBda Dec 16, 2024
d4a6390
update margins
carolineBda Dec 16, 2024
48b72df
remove use client
carolineBda Dec 17, 2024
711f16f
update test
carolineBda Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import { notFound } from "next/navigation";
import { DsfrLayout } from "../../../src/modules/layout";
import { fetchFicheSP } from "../../../src/modules/fiche-service-public/queries";
import { fetchRelatedItems } from "../../../src/modules/documents";
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
import { getRouteBySource, SOURCES } from "@socialgouv/cdtn-utils";
import { FicheServicePublicContainer } from "../../../src/modules/fiche-service-public/FicheServicePublicContainer";

export async function generateMetadata({ params }) {
const { title, description } = await getFiche(params.slug);

return generateDefaultMetadata({
title: title,
description: description,
path: `/${getRouteBySource(SOURCES.SHEET_SP)}/${params.slug}`,
});
}

async function Fiche({ params }) {
const {
_id,
breadcrumbs,
date,
description,
raw,
referencedTexts,
title,
url,
} = await getFiche(params.slug);
const relatedItems = await fetchRelatedItems({ _id }, params.slug);

return (
<DsfrLayout>
<FicheServicePublicContainer
title={title}
relatedItems={relatedItems}
date={date}
url={url}
metaDescription={description}
raw={raw}
breadcrumbs={breadcrumbs}
referencedTexts={referencedTexts}
/>
</DsfrLayout>
);
}

const getFiche = async (slug: string) => {
const fiche = await fetchFicheSP(slug);

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

export default Fiche;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe("Fiche Service public", () => {
it("je vois une page fiche service public", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages");
cy.findAllByRole("heading", { level: 1 }).should(
"have.text",
"Salaire, primes et avantages"
);
cy.contains("a", "Fiche service-public.fr")
.should("have.attr", "href")
.and(
"contain",
"https://www.service-public.fr/particuliers/vosdroits/F2301"
);
cy.get("body").should("contain", "01/11/2024");
cy.get("h2").first().should("contain", "Salaire");
});

it("je vois une fiche service public avec un accordéon ouvert", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h2").get('[aria-expanded="true"]').should("contain", "Salaire");
});
});
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
describe("Landing pages", () => {
it("je vois une page fiche service public", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h1").should("contain", "Salaire, primes et avantages");
cy.get("body").should("contain", "Source: Fiche service-public.fr");
cy.get("h2").first().should("contain", "Salaire");
});

it("je vois une fiche service public avec un accordéon ouvert", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h1").should("have.text", "Salaire, primes et avantages");
cy.get('[aria-expanded="true"]').find("h2").should("contain", "Salaire");
});

it("je vois une page convention collective", () => {
cy.visit(
"/convention-collective/1686-commerces-et-services-de-laudiovisuel-de-lelectronique-et-de-lequipemen"
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import React from "react";

import { FicheServicePublic } from "..";
import ficheDataMock from "./ficheData.mock.json";
import { FicheSPData } from "../type";

describe("<FicheServicePublic />", () => {
it("should render", () => {
const { container } = render(
<FicheServicePublic data={ficheDataMock.children} />
<FicheServicePublic data={ficheDataMock.children as FicheSPData[]} />
);
expect(container).toMatchSnapshot();
});
Expand Down
Loading
Loading