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]>
20 lines
807 B
TypeScript
20 lines
807 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { visibleSections, type Section } from './sections'
|
|
|
|
const P = (canView: boolean) => ({ canView, canModify: false, canDelete: false })
|
|
|
|
const LIST: Section[] = [
|
|
{ id: 'one', label: 'One', permission: 'One' },
|
|
{ id: 'any', label: 'Any', permission: ['A', 'B'] },
|
|
{ id: 'free', label: 'Free', permission: null },
|
|
]
|
|
|
|
describe('visibleSections', () => {
|
|
it('a list of permissions means any of them', () => {
|
|
const ids = (p: Parameters<typeof visibleSections>[0]) => visibleSections(p, LIST).map((s) => s.id)
|
|
expect(ids({ One: P(true), A: P(false), B: P(true) })).toEqual(['one', 'any', 'free'])
|
|
expect(ids({ One: P(false), A: P(false), B: P(false) })).toEqual(['free'])
|
|
expect(ids(undefined)).toEqual(['one', 'any', 'free'])
|
|
})
|
|
})
|