Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/chip/__tests__/chip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ test('renders as a <button> element', () => {
expect(screen.getByRole('button', { name: 'Label' })).toBeVisible()
})

test('calls `onClick`', () => {
const handleClick = vi.fn()
render(
<Chip onClick={handleClick} variant="filter">
Label
</Chip>,
)
fireEvent.click(screen.getByRole('button', { name: 'Label' }))
expect(handleClick).toHaveBeenCalled()
})

test('filter chip has `data-variant="filter"` attribute', () => {
render(<Chip variant="filter">Label</Chip>)
expect(screen.getByRole('button', { name: 'Label' })).toHaveAttribute('data-variant', 'filter')
Expand Down
6 changes: 6 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ export default defineConfig({
'src/tests',
'src/tokens',
'src/types',
// Note: We don't want to report coverage for:
// - barrel files
'**/index.ts',
// - our tests themselves
'**/*.test.*',
// - our stories
'**/*.stories.*',
// - any type declaration files
'**/*.d.ts',
],
include: ['src/**/*.ts', 'src/**/*.tsx'],
Expand Down