Every component is rebuilt on @base-ui/react with a single prop API, token-only colours and dark mode, and 28 new components are added. Components - New: Field, FeaturedTextArea, NumberInput, Combobox, CheckboxGroup, Slider, ToggleGroup/Toggle, IconButton, Dialog/Modal, AlertDialog, Drawer/Sheet, Popover, InfoTip, DropdownMenu, Tabs, Breadcrumb, Pagination, Toast (Toaster, useToast), Progress, Meter, Skeleton, CountBadge, Avatar/AvatarGroup, Kbd, Separator, Table - Rewritten: Button, Input, FeaturedInput, TextArea, Select, FeaturedSelect (real ARIA combobox), NativeSelect, Checkbox, Radio, Switch, Tooltip, Accordion, Alert, Spinner, Badge, Card - Removed TextField (use Input) and sonner (use Toast) Foundations - Semantic tokens (surfaces, text, borders, status ramps) in src/styles/tokens.css, with class-based dark mode - Visible focus rings, linked labels/descriptions/errors, alert roles by severity, keyboard support from Base UI - Fixed the Classic Blue ramp; Emerald, Amber and Teal 500 steps now carry white text at AA - Library build (per-component ES modules, types, tokens.css, exports) Quality - Vitest, Testing Library and axe tests for every component (289 tests) - scripts/check-stories.mjs renders every story in Chrome and fails on errors or axe violations, including contrast; all 423 stories pass in light and dark mode and in all seven palettes - Storybook: controls for every prop, open states for every popup, light/dark toolbar, Introduction guides, docs/CONVENTIONS.md BREAKING CHANGE: component props changed across the kit; see CHANGELOG.md.
26 lines
960 B
TypeScript
26 lines
960 B
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { expectNoA11yViolations } from '../test/a11y'
|
|
import { Spinner } from './Spinner'
|
|
|
|
describe('Spinner', () => {
|
|
it('is a status named "Loading" by default', () => {
|
|
render(<Spinner />)
|
|
const status = screen.getByRole('status', { name: 'Loading' })
|
|
expect(status).toHaveAttribute('aria-label', 'Loading')
|
|
// One accessible name, no duplicate visually hidden text.
|
|
expect(status).toHaveTextContent('')
|
|
expect(status.querySelector('svg')).toHaveAttribute('aria-hidden', 'true')
|
|
})
|
|
|
|
it('uses a custom label', () => {
|
|
render(<Spinner label="Saving invoice" size="xl" color="success" />)
|
|
expect(screen.getByRole('status', { name: 'Saving invoice' })).toBeInTheDocument()
|
|
})
|
|
|
|
it('has no axe violations', async () => {
|
|
const { container } = render(<Spinner />)
|
|
await expectNoA11yViolations(container)
|
|
})
|
|
})
|