feat: add RGPD info popup with header trigger button
This commit is contained in:
1 parent
e5220a4c4e
commit
7655cb5b69
4 files changed
+86
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import RgpdInfo from './RgpdInfo'
|
||||
|
||||
describe('RgpdInfo', () => {
|
||||
it('renders nothing when closed', () => {
|
||||
const { container } = render(<RgpdInfo open={false} onClose={vi.fn()} />)
|
||||
|
||||
expect(container).toBeEmptyDOMElement()
|
||||
})
|
||||
|
||||
it('renders the GDPR information when open', () => {
|
||||
render(<RgpdInfo open onClose={vi.fn()} />)
|
||||
|
||||
expect(screen.getByRole('dialog', { name: 'Protection des données (RGPD)' })).toBeInTheDocument()
|
||||
expect(screen.getByText('localStorage', { exact: false })).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByText(/ne sont jamais partagées avec des tiers/i),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.getByText(/aucune transmission vers un serveur externe/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('calls onClose when the close button is clicked', () => {
|
||||
const onClose = vi.fn()
|
||||
render(<RgpdInfo open onClose={onClose} />)
|
||||
|
||||
screen.getByRole('button', { name: 'Fermer' }).click()
|
||||
|
||||
expect(onClose).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user