Install ReUI (MCP, skill, @reui registry, Tailwind v4, shadcn base-nova) and move the shared UI onto it: Button, Tag, Check, Input/Textarea, Segmented, Alert, Panel, Dialog, Tooltip, Menu and Select (Popover), Toast (sonner), the Table frame (DataGrid), the Dashboard KPI strip, the shnt Ops palette, Geist and the type scale. Design only: behaviour, texts and roles are unchanged. Tests that asserted the old DOM were updated; the tests now format numbers in English wherever they run. docs/reui-migration-plan.md records the plan and its decisions. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { render, screen } from '@testing-library/react'
|
|
import userEvent from '@testing-library/user-event'
|
|
import { Notifier } from './Notifier'
|
|
|
|
/*
|
|
The air it leaves beneath is measured in the browser, not here: jsdom does not lay
|
|
out. What it can answer is the contract, which is what fifty places were writing by
|
|
hand (and out of that came four distances for the same thing).
|
|
*/
|
|
describe('Notifier', () => {
|
|
it('with no alert it draws nothing', () => {
|
|
const { container } = render(<Notifier notice={null} onClose={() => {}} />)
|
|
expect(container).toBeEmptyDOMElement()
|
|
})
|
|
|
|
it('with an alert it draws title, text and the close button', async () => {
|
|
const close = vi.fn()
|
|
render(
|
|
<Notifier
|
|
notice={{ type: 'danger', title: 'Error!', text: 'Zone not found.' }}
|
|
onClose={close}
|
|
/>,
|
|
)
|
|
expect(screen.getByText('Error!')).toBeInTheDocument()
|
|
expect(screen.getByText('Zone not found.')).toBeInTheDocument()
|
|
await userEvent.click(screen.getByRole('button'))
|
|
expect(close).toHaveBeenCalledOnce()
|
|
})
|
|
})
|