-
Notifications
You must be signed in to change notification settings - Fork 0
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
8703994
commit 2827604
Showing
37 changed files
with
614 additions
and
88 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
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 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 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 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,2 @@ | ||
export { default } from './CaList' | ||
export * from './CaList' |
52 changes: 52 additions & 0 deletions
52
src/components/Templates/FullPageWizard/FullPageWizard.test.tsx
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,52 @@ | ||
import React from 'react' | ||
import { render, fireEvent } from '@testing-library/react' | ||
import FullPageWizard from './FullPageWizard' | ||
|
||
describe('FullPageWizard', () => { | ||
const props = { | ||
activeStep: 0, | ||
steps: [ | ||
{ name: 'Step 1', description: 'Description 1' }, | ||
{ name: 'Step 2', description: 'Description 2' }, | ||
{ name: 'Step 3', description: 'Description 3' }, | ||
], | ||
onStepChange: () => {}, | ||
title: 'Test Title', | ||
} | ||
|
||
it('renders without crashing', () => { | ||
const { container, asFragment } = render(<FullPageWizard {...props} />) | ||
expect(container.firstChild).toBeInTheDocument() | ||
expect(asFragment()).toMatchSnapshot() | ||
}) | ||
|
||
it('renders the correct number of steps', () => { | ||
const { getAllByRole } = render(<FullPageWizard {...props} />) | ||
const steps = getAllByRole('listitem') | ||
expect(steps.length).toBe(props.steps.length) | ||
}) | ||
|
||
it('calls onStepChange when a step is clicked', () => { | ||
const mockOnStepChange = jest.fn() | ||
const { getAllByRole } = render(<FullPageWizard {...props} activeStep={1} onStepChange={mockOnStepChange} visitedStep={0} />) | ||
const steps = getAllByRole('link') | ||
fireEvent.click(steps[0]) | ||
expect(mockOnStepChange).toHaveBeenCalledWith(0) | ||
}) | ||
|
||
it('does not call onStepChange when a non-visited step is clicked', () => { | ||
const mockOnStepChange = jest.fn() | ||
const { getAllByRole } = render(<FullPageWizard {...props} onStepChange={mockOnStepChange} visitedStep={0} />) | ||
const steps = getAllByRole('link') | ||
fireEvent.click(steps[1]) | ||
expect(mockOnStepChange).not.toHaveBeenCalled() | ||
}) | ||
|
||
it('calls onClose when close button is clicked', () => { | ||
const mockOnClose = jest.fn() | ||
const { getByRole } = render(<FullPageWizard {...props} onClose={mockOnClose} />) | ||
const closeButton = getByRole('button') | ||
fireEvent.click(closeButton) | ||
expect(mockOnClose).toHaveBeenCalled() | ||
}) | ||
}) |
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 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
Oops, something went wrong.