fix: Tests

pull/2573/head
Benjamin Arias 2023-03-18 18:31:36 +01:00 committed by Jérémy Rialland
parent 83d82b7e99
commit 0d2aee63d2
2 changed files with 15 additions and 7 deletions

View File

@ -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 () {

View File

@ -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 (
<OverlayContainer aria-modal={true} role="dialog">
<OverlayContainer
aria-modal={true}
role="dialog"
aria-label={t('Fond de la boite de dialogue')}
>
<Underlay {...underlayProps} $offsetTop={offsetTop}>
<Container>
<Grid
@ -113,7 +120,8 @@ export default function Popover(
{...overlayProps}
$offsetTop={offsetTop}
ref={ref}
aria-label={title}
aria-label={title || t('Boite de dialogue')}
title="modal"
>
{props.isDismissable && (
<CloseButtonContainer>