2024-07-24 09:40:24 -04:00
|
|
|
import '../../helpers/bootstrap-3'
|
2023-01-05 05:17:57 -05:00
|
|
|
import { Modal } from 'react-bootstrap'
|
|
|
|
import AccessibleModal from '../../../../frontend/js/shared/components/accessible-modal'
|
|
|
|
|
|
|
|
describe('AccessibleModal', function () {
|
|
|
|
it('renders a visible modal', function () {
|
|
|
|
const handleHide = cy.stub()
|
|
|
|
|
|
|
|
cy.mount(
|
|
|
|
<AccessibleModal onHide={handleHide} show>
|
|
|
|
<Modal.Header closeButton>
|
|
|
|
<Modal.Title>Test</Modal.Title>
|
|
|
|
</Modal.Header>
|
|
|
|
|
|
|
|
<Modal.Body>Some content</Modal.Body>
|
|
|
|
</AccessibleModal>
|
|
|
|
)
|
|
|
|
|
|
|
|
cy.findByRole('dialog').should('have.length', 1)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('does not render a hidden modal', function () {
|
|
|
|
const handleHide = cy.stub()
|
|
|
|
|
|
|
|
cy.mount(
|
|
|
|
<AccessibleModal onHide={handleHide}>
|
|
|
|
<Modal.Header closeButton>
|
|
|
|
<Modal.Title>Test</Modal.Title>
|
|
|
|
</Modal.Header>
|
|
|
|
|
|
|
|
<Modal.Body>Some content</Modal.Body>
|
|
|
|
</AccessibleModal>
|
|
|
|
)
|
|
|
|
|
|
|
|
cy.findByRole('dialog', { hidden: true }).should('have.length', 0)
|
|
|
|
})
|
|
|
|
})
|