-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e76de0
commit 33b1812
Showing
6 changed files
with
57 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { cleanup, render, screen, waitFor } from '@testing-library/react/pure' | ||
import { axe } from 'vitest-axe' | ||
import { Carousel, carouselAnatomy } from '.' | ||
import { getExports, getParts } from '../../setup-test' | ||
import { Basic as ComponentUnderTest } from './examples/basic' | ||
|
||
describe('Carousel / Parts & Exports', () => { | ||
afterAll(() => { | ||
cleanup() | ||
}) | ||
|
||
render(<ComponentUnderTest />) | ||
|
||
it.each(getParts(carouselAnatomy))('should render part %s', async (part) => { | ||
expect(document.querySelector(part)).toBeInTheDocument() | ||
}) | ||
|
||
it.each(getExports(carouselAnatomy))('should export %s', async (part) => { | ||
expect(Carousel[part]).toBeDefined() | ||
}) | ||
}) | ||
|
||
describe('Carousel', () => { | ||
afterEach(() => { | ||
cleanup() | ||
}) | ||
|
||
it('should have no a11y violations', async () => { | ||
const { container } = render(<ComponentUnderTest />) | ||
const results = await axe(container) | ||
|
||
expect(results).toHaveNoViolations() | ||
}) | ||
|
||
it('should have the correct disabled / enabled states for control buttons', async () => { | ||
render(<ComponentUnderTest />) | ||
const prevButton = screen.getByRole('button', { name: 'Previous slide' }) | ||
const nextButton = screen.getByRole('button', { name: 'Next slide' }) | ||
|
||
await waitFor(() => expect(prevButton).toBeDisabled()) | ||
await waitFor(() => expect(nextButton).toBeEnabled()) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
71 changes: 0 additions & 71 deletions
71
packages/react/src/components/carousel/tests/carousel.test.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters