import '@testing-library/jest-dom'
import { render, screen } from '@testing-library/react'
import { axe, toHaveNoViolations } from 'jest-axe'
import { createRef } from 'react'
import { PktStep } from './Step'
import { PktStepper } from './Stepper'
expect.extend(toHaveNoViolations)
describe('PktStepper', () => {
test('renders without errors', () => {
render(
content
content
content
,
)
// Assert that the Stepper component renders without throwing any errors
})
test('ref works correctly', () => {
const ref = createRef()
const { unmount } = render(
content
,
)
expect(ref.current).toBeInstanceOf(HTMLOListElement)
unmount()
expect(ref.current).toBe(null)
})
test('renders children', () => {
render(
Content 1
Content 2
,
)
// Assert that the Step component renders its children correctly
expect(screen.getByText('Title 1')).toBeInTheDocument()
expect(screen.getByText('Content 1')).toBeInTheDocument()
expect(screen.getByText('Title 2')).toBeInTheDocument()
expect(screen.getByText('Content 2')).toBeInTheDocument()
})
test('applies orientation and status correctly ', () => {
render(
<>
Content
>,
)
// Assert that the Accordion component applies the props correctly
expect(screen.getByTestId('pkt-stepper')).toHaveClass('pkt-stepper--horizontal')
expect(screen.getByTestId('pkt-step')).toHaveClass('pkt-step--current')
})
describe('accessibility', () => {
it('renders with no wcag errors with axe', async () => {
const { container } = render(
Content 1
Content 2
,
)
const results = await axe(container)
expect(results).toHaveNoViolations()
})
})
})