This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teleport Connect: Add dropdown for database name (#757)
* Add required prop to MenuLogin This will be needed for the db name dropdown, where the value is optional. * Update proto files * Include targetSubresourceName when creating a gateway * Set better title for gateway tab * Fix long document titles breaking connection tracker's UI
- Loading branch information
Showing
22 changed files
with
238 additions
and
38 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,47 @@ | ||
import React from 'react'; | ||
import { render, fireEvent, waitFor } from 'design/utils/testing'; | ||
import { MenuLogin } from './MenuLogin'; | ||
|
||
test('does not accept an empty value when required is set to true', async () => { | ||
const onSelect = jest.fn(); | ||
const { findByText, findByPlaceholderText } = render( | ||
<MenuLogin | ||
placeholder="MenuLogin input" | ||
required={true} | ||
getLoginItems={() => []} | ||
onSelect={() => onSelect()} | ||
/> | ||
); | ||
|
||
fireEvent.click(await findByText('CONNECT')); | ||
await waitFor(async () => | ||
fireEvent.keyPress(await findByPlaceholderText('MenuLogin input'), { | ||
key: 'Enter', | ||
keyCode: 13, | ||
}) | ||
); | ||
|
||
expect(onSelect).toHaveBeenCalledTimes(0); | ||
}); | ||
|
||
test('accepts an empty value when required is set to false', async () => { | ||
const onSelect = jest.fn(); | ||
const { findByText, findByPlaceholderText } = render( | ||
<MenuLogin | ||
placeholder="MenuLogin input" | ||
required={false} | ||
getLoginItems={() => []} | ||
onSelect={() => onSelect()} | ||
/> | ||
); | ||
|
||
fireEvent.click(await findByText('CONNECT')); | ||
await waitFor(async () => | ||
fireEvent.keyPress(await findByPlaceholderText('MenuLogin input'), { | ||
key: 'Enter', | ||
keyCode: 13, | ||
}) | ||
); | ||
|
||
expect(onSelect).toHaveBeenCalledTimes(1); | ||
}); |
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
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
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.