From 311b967adcc680325329837539c1802937e2bb75 Mon Sep 17 00:00:00 2001 From: Caroline <4971715+carolineBda@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:14:29 +0100 Subject: [PATCH] =?UTF-8?q?feat(contrib):=20affichage=20de=20la=20r=C3=A9p?= =?UTF-8?q?onse=20CDT=20d=C3=A8s=20le=20d=C3=A9but=20pour=20essayer=20d'am?= =?UTF-8?q?=C3=A9liorer=20le=20SEO=20(#5442)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/contributions/ContributionGeneric.tsx | 64 ++----------------- .../__tests__/ContributionGeneric.test.tsx | 50 +-------------- 2 files changed, 5 insertions(+), 109 deletions(-) diff --git a/packages/code-du-travail-frontend/src/contributions/ContributionGeneric.tsx b/packages/code-du-travail-frontend/src/contributions/ContributionGeneric.tsx index 6acc6d3a4f..571d77f793 100644 --- a/packages/code-du-travail-frontend/src/contributions/ContributionGeneric.tsx +++ b/packages/code-du-travail-frontend/src/contributions/ContributionGeneric.tsx @@ -48,7 +48,6 @@ const ContributionGeneric = ({ answers, content, slug }) => { const hasConventionAnswers = answers.conventions && answers.conventions.length > 0; - const [showAnswer, setShowAnswer] = useState(false); const [hasNoEnterpriseSelected, setHasNoEnterpriseSelected] = useState(false); const [entreprise, setEnterprise] = useState(); @@ -97,9 +96,6 @@ const ContributionGeneric = ({ answers, content, slug }) => { setConvention(agreement); setEnterprise(enterprise); - if (agreementTreated) { - setShowAnswer(false); - } }; const CC_NOT_SUPPORTED = ( @@ -107,14 +103,7 @@ const ContributionGeneric = ({ answers, content, slug }) => { Nous n’avons pas de réponse pour cette convention collective - {showAnswer ? ( -

Vous pouvez consulter les informations générales ci-dessous.

- ) : ( -

- Vous pouvez tout de même poursuivre pour obtenir les informations - générales. -

- )} +

Vous pouvez consulter les informations générales ci-dessous.

); @@ -215,7 +204,7 @@ const ContributionGeneric = ({ answers, content, slug }) => { )}
- {isSupported(convention) ? ( + {isSupported(convention) && ( - ) : ( - <> - {(!showAnswer || convention) && ( - - )} - )}
- - {!showAnswer && !convention && ( -

- -

- )} )} - + Que dit le code du travail ? @@ -355,7 +299,7 @@ const HideOnMobile = styled.span` } `; const SectionHidden = styled(Section)` - display: ${({ show }) => (show ? "block" : "none")}; + display: block; `; const Div = styled.div` text-align: center; diff --git a/packages/code-du-travail-frontend/src/contributions/__tests__/ContributionGeneric.test.tsx b/packages/code-du-travail-frontend/src/contributions/__tests__/ContributionGeneric.test.tsx index cfb9699b0c..2a3fc924b4 100644 --- a/packages/code-du-travail-frontend/src/contributions/__tests__/ContributionGeneric.test.tsx +++ b/packages/code-du-travail-frontend/src/contributions/__tests__/ContributionGeneric.test.tsx @@ -111,7 +111,7 @@ describe("", () => { expect(ui.agreement1351.searchResult.query()).toBeInTheDocument() ); fireEvent.click(ui.agreement1351.searchResult.get()); - expect(byText(/Afficher les informations/).get()).toBeInTheDocument(); + expect(byText(/Afficher les informations/).query()).not.toBeInTheDocument(); expect(matopush).toHaveBeenCalledTimes(4); // @ts-ignore expect(matopush.mock.calls).toEqual([ @@ -134,14 +134,6 @@ describe("", () => { [["trackEvent", "cc_select_p1", "/contribution/my-contrib", "idcc1351"]], [["trackEvent", "outil", "cc_select_non_traitée", 1351]], ]); - fireEvent.click(byText("Afficher les informations générales").get()); - expect(matopush).toHaveBeenCalledTimes(5); - expect(matopush).toHaveBeenLastCalledWith([ - "trackEvent", - "contribution", - "click_afficher_les_informations_générales", - "/contribution/my-contrib", - ]); expect(router.push).toHaveBeenCalledTimes(0); }); it("je ne connais pas ma CC", async () => { @@ -198,44 +190,4 @@ describe("", () => { [["trackEvent", "outil", "cc_select_non_traitée", 2216]], ]); }); - it("afficher les infos - sans CC", async () => { - expect(matopush).toHaveBeenCalledTimes(0); - - render( - - ); - expect(byText(/Afficher les informations/).get()).toBeInTheDocument(); - fireEvent.click(byText("Afficher les informations").get()); - expect(matopush).toHaveBeenCalledTimes(1); - expect(matopush).toHaveBeenLastCalledWith([ - "trackEvent", - "contribution", - "click_afficher_les_informations_sans_CC", - "/contribution/my-contrib", - ]); - expect(router.push).toHaveBeenCalledTimes(0); - }); - - it("voir les infos générales", () => { - expect(matopush).toHaveBeenCalledTimes(0); - - render( - - ); - - fireEvent.click( - byText( - "Accéder aux informations générales sans renseigner ma convention collective" - ).get() - ); - - expect(matopush).toHaveBeenCalledTimes(1); - expect(matopush).toHaveBeenCalledWith([ - "trackEvent", - "cc_search_type_of_users", - "click_p3", - "/contribution/my-contrib", - ]); - expect(router.push).toHaveBeenCalledTimes(0); - }); });