-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): add Deck configuration page component (#13784)
* feat(app): add Deck configuration page component
- Loading branch information
Showing
16 changed files
with
446 additions
and
53 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 |
---|---|---|
|
@@ -160,4 +160,4 @@ opentrons-robot-app.tar.gz | |
*.swp | ||
|
||
# asdf versions file | ||
*.tool-versions | ||
.tool-versions |
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
73 changes: 73 additions & 0 deletions
73
app/src/organisms/ChildNavigation/__tests__/ChildNavigation.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,73 @@ | ||
import * as React from 'react' | ||
|
||
import { renderWithProviders } from '@opentrons/components' | ||
import { SmallButton } from '../../../atoms/buttons' | ||
import { ChildNavigation } from '..' | ||
|
||
const render = (props: React.ComponentProps<typeof ChildNavigation>) => | ||
renderWithProviders(<ChildNavigation {...props} />) | ||
|
||
const mockOnClickBack = jest.fn() | ||
const mockOnClickButton = jest.fn() | ||
const mockOnClickSecondaryButton = jest.fn() | ||
|
||
const mockSecondaryButtonProps: React.ComponentProps<typeof SmallButton> = { | ||
onClick: mockOnClickSecondaryButton, | ||
buttonText: 'Setup Instructions', | ||
buttonType: 'tertiaryLowLight', | ||
iconName: 'information', | ||
iconPlacement: 'startIcon', | ||
} | ||
|
||
describe('ChildNavigation', () => { | ||
let props: React.ComponentProps<typeof ChildNavigation> | ||
|
||
beforeEach(() => { | ||
props = { | ||
header: 'mock header', | ||
onClickBack: mockOnClickBack, | ||
} | ||
}) | ||
|
||
it('should render text and back button', () => { | ||
const [{ getByText, getByTestId }] = render(props) | ||
getByText('mock header') | ||
getByTestId('ChildNavigation_Back_Button') | ||
}) | ||
|
||
it('should call a mock function when tapping the back button', () => { | ||
const [{ getByTestId }] = render(props) | ||
getByTestId('ChildNavigation_Back_Button').click() | ||
expect(mockOnClickBack).toHaveBeenCalled() | ||
}) | ||
|
||
it('should render text, back button and small button', () => { | ||
props = { | ||
...props, | ||
buttonText: 'mock button', | ||
onClickButton: mockOnClickButton, | ||
} | ||
const [{ getByText, getByTestId }] = render(props) | ||
getByText('mock header') | ||
getByTestId('ChildNavigation_Back_Button') | ||
const mockButton = getByText('mock button') | ||
mockButton.click() | ||
expect(mockOnClickButton).toHaveBeenCalled() | ||
}) | ||
|
||
it('should render text, back button and 2 buttons', () => { | ||
props = { | ||
...props, | ||
buttonText: 'mock button', | ||
onClickButton: mockOnClickButton, | ||
secondaryButtonProps: mockSecondaryButtonProps, | ||
} | ||
const [{ getByText, getByTestId }] = render(props) | ||
getByText('mock header') | ||
getByTestId('ChildNavigation_Back_Button') | ||
getByText('mock button') | ||
const secondaryButton = getByText('Setup Instructions') | ||
secondaryButton.click() | ||
expect(mockOnClickSecondaryButton).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
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.