-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show setup button when pod provider url is not configured
- Loading branch information
Showing
4 changed files
with
74 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import { MessageType } from '../messages'; | ||
import { sendMessage } from './sendMessage'; | ||
import { SetupButton } from './SetupButton'; | ||
|
||
jest.mock('./sendMessage'); | ||
|
||
describe('SetupButton', () => { | ||
it('triggers open option page message and calls close when clicked', () => { | ||
const close = jest.fn(); | ||
render(<SetupButton close={close} />); | ||
const button = screen.getByText('Get started'); | ||
fireEvent.click(button); | ||
expect(sendMessage).toHaveBeenCalledWith({ | ||
type: MessageType.OPEN_OPTIONS, | ||
}); | ||
expect(close).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { Button } from '../components/Button'; | ||
import { MessageType } from '../messages'; | ||
import { sendMessage } from './sendMessage'; | ||
|
||
interface Props { | ||
close: () => void; | ||
} | ||
|
||
export const SetupButton = ({ close }: Props) => { | ||
return ( | ||
<Button | ||
loading={false} | ||
loadingLabel="Please wait" | ||
onClick={async () => { | ||
close(); | ||
await sendMessage({ type: MessageType.OPEN_OPTIONS }); | ||
}} | ||
> | ||
Get started | ||
</Button> | ||
); | ||
}; |