From 0d2aee63d2c5f1bfc632fa893108ccf06775414d Mon Sep 17 00:00:00 2001 From: Benjamin Arias Date: Sat, 18 Mar 2023 18:31:36 +0100 Subject: [PATCH] fix: Tests --- .../integration/mon-entreprise/simulateur-salarie.ts | 10 +++++----- site/source/design-system/popover/Popover.tsx | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/site/cypress/integration/mon-entreprise/simulateur-salarie.ts b/site/cypress/integration/mon-entreprise/simulateur-salarie.ts index ed6ec1a41..693e2c550 100644 --- a/site/cypress/integration/mon-entreprise/simulateur-salarie.ts +++ b/site/cypress/integration/mon-entreprise/simulateur-salarie.ts @@ -9,17 +9,17 @@ describe('Simulateur salarié : part time contract', function () { cy.visit(encodeURI('/simulateurs/salaire-brut-net')) cy.get('button').contains('SMIC').click() cy.contains('Modifier mes réponses').click() - cy.get('div[role="dialog"]') + cy.get('div[title="modal"]') .eq(0) .contains('Temps partiel') .next() .find('button') .click() - cy.get('div[role="dialog"]').eq(1).contains('Fermer') - cy.get('div[role="dialog"]').eq(1).contains('Oui').click() - cy.get('div[role="dialog"]').eq(1).contains('Continuer').click() - cy.get('div[role="dialog"]').eq(0).contains('Fermer').click() + cy.get('div[title="modal"]').eq(1).contains('Fermer') + cy.get('div[title="modal"]').eq(1).contains('Oui').click() + cy.get('div[title="modal"]').eq(1).contains('Continuer').click() + cy.get('div[title="modal"]').eq(0).contains('Fermer').click() }) it('should permit selecting the smic before part-time contrat', function () { diff --git a/site/source/design-system/popover/Popover.tsx b/site/source/design-system/popover/Popover.tsx index 25528a1d0..dd4668c3d 100644 --- a/site/source/design-system/popover/Popover.tsx +++ b/site/source/design-system/popover/Popover.tsx @@ -16,6 +16,7 @@ import React, { useRef, useState, } from 'react' +import { useTranslation } from 'react-i18next' import styled, { css, keyframes } from 'styled-components' import { Grid } from '@/design-system/layout' @@ -61,6 +62,8 @@ export default function Popover( titleProps: titlePropsFromProps, } = props + const { t } = useTranslation() + // Handle interacting outside the dialog and pressing // the Escape key to close the modal. const ref = useRef(null) @@ -89,7 +92,11 @@ export default function Popover( } return ( - + {props.isDismissable && (