-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vincent T <vtaylor@microsoft.com>
- Loading branch information
Showing
57 changed files
with
6,855 additions
and
2,124 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
frontend/src/components/common/__snapshots__/NamespacesAutocomplete.Some.stories.storyshot
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
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
94 changes: 94 additions & 0 deletions
94
frontend/src/components/namespace/CreateNamespaceButton.stories.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,94 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { expect, userEvent, waitFor } from '@storybook/test'; | ||
import { screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { TestContext } from '../../test'; | ||
import CreateNamespaceButton from './CreateNamespaceButton'; | ||
|
||
const meta: Meta<typeof CreateNamespaceButton> = { | ||
title: 'Namespace/CreateNamespaceButton', | ||
component: CreateNamespaceButton, | ||
decorators: [ | ||
Story => { | ||
return ( | ||
<TestContext> | ||
<Story /> | ||
</TestContext> | ||
); | ||
}, | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof CreateNamespaceButton>; | ||
|
||
export const OkayName: Story = { | ||
play: async () => { | ||
await userEvent.click(screen.getByLabelText('Create')); | ||
|
||
await waitFor(() => expect(screen.getByLabelText('Dialog')).toBeVisible()); | ||
|
||
await waitFor(() => userEvent.type(screen.getByRole('textbox'), 'okay-name'), { | ||
timeout: 5000, | ||
}); | ||
|
||
const button = await screen.findByRole('button', { name: 'Create' }); | ||
|
||
expect(button).toBeEnabled(); | ||
}, | ||
}; | ||
|
||
export const EmptyName: Story = { | ||
play: async () => { | ||
await userEvent.click(screen.getByLabelText('Create')); | ||
|
||
await waitFor(() => expect(screen.getByLabelText('Dialog')).toBeVisible()); | ||
|
||
await waitFor(() => userEvent.type(screen.getByRole('textbox'), ' '), { timeout: 5000 }); | ||
|
||
const button = await screen.findByRole('button', { name: 'Create' }); | ||
const errorMessage = await screen.findByText( | ||
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character." | ||
); | ||
|
||
expect(errorMessage).toBeVisible(); | ||
expect(button).not.toBeEnabled(); | ||
}, | ||
}; | ||
|
||
export const NotValidName: Story = { | ||
play: async () => { | ||
await userEvent.click(screen.getByLabelText('Create')); | ||
|
||
await waitFor(() => expect(screen.getByLabelText('Dialog')).toBeVisible()); | ||
|
||
await waitFor(() => userEvent.type(screen.getByRole('textbox'), 'not-valid-name-'), { | ||
timeout: 5000, | ||
}); | ||
|
||
const button = await screen.findByRole('button', { name: 'Create' }); | ||
const errorMessage = await screen.findByText( | ||
"Namespaces must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character." | ||
); | ||
|
||
expect(errorMessage).toBeVisible(); | ||
expect(button).not.toBeEnabled(); | ||
}, | ||
}; | ||
|
||
export const NotValidNameLong: Story = { | ||
play: async () => { | ||
const longName = 'w'.repeat(64); | ||
await userEvent.click(screen.getByLabelText('Create')); | ||
|
||
await waitFor(() => expect(screen.getByLabelText('Dialog')).toBeVisible()); | ||
|
||
await waitFor(() => userEvent.type(screen.getByRole('textbox'), longName), { timeout: 10000 }); | ||
|
||
const button = await screen.findByRole('button', { name: 'Create' }); | ||
const errorMessage = await screen.findByText('Namespaces must be under 64 characters.'); | ||
|
||
expect(errorMessage).toBeVisible(); | ||
expect(button).not.toBeEnabled(); | ||
}, | ||
}; |
Oops, something went wrong.