-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [M3-7544, M3-7552] - ErrorState and FileUploader v7 stories (…
…#9982) * converted stories and added test * moving around a lot of stuff for better organization?? * update imports * stories * tests * changeset, additional comments * feedback pass 1 * feedback round 2
- Loading branch information
1 parent
1bde70b
commit 83eab63
Showing
24 changed files
with
284 additions
and
229 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9981-tech-stories-1702058586434.md
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,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
ErrorState and FileUploader v7 storybook migrations ([#9981](https://github.com/linode/manager/pull/9981)) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
packages/manager/src/components/ErrorState/ErrorState.stories.mdx
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/manager/src/components/ErrorState/ErrorState.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,23 @@ | ||
import * as React from 'react'; | ||
|
||
import { ErrorState } from './ErrorState'; | ||
|
||
import type { ErrorStateProps } from './ErrorState'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
export const Default: StoryObj<ErrorStateProps> = { | ||
args: { | ||
compact: false, | ||
errorText: 'An error has occurred.', | ||
}, | ||
render: (args) => { | ||
return <ErrorState {...args} />; | ||
}, | ||
}; | ||
|
||
const meta: Meta<ErrorStateProps> = { | ||
component: ErrorState, | ||
title: 'Components/Error State', | ||
}; | ||
|
||
export default meta; |
40 changes: 40 additions & 0 deletions
40
packages/manager/src/components/ErrorState/ErrorState.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,40 @@ | ||
import * as React from 'react'; | ||
|
||
import PendingIcon from 'src/assets/icons/pending.svg'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { ErrorState } from './ErrorState'; | ||
|
||
const errorText = 'Some error text here'; | ||
const props = { | ||
CustomIcon: PendingIcon, | ||
errorText, | ||
}; | ||
|
||
describe('Removable Selections List', () => { | ||
it('renders the ErrorState with specified text properly', () => { | ||
const screen = renderWithTheme(<ErrorState errorText={props.errorText} />); | ||
expect(screen.getByText(errorText)).toBeVisible(); | ||
expect(screen.getByTestId('ErrorOutlineIcon')).toBeVisible(); | ||
}); | ||
|
||
it('renders the ErrorState with a custom icon image', () => { | ||
const screen = renderWithTheme(<ErrorState {...props} />); | ||
expect(screen.getByText(errorText)).toBeVisible(); | ||
expect(screen.queryByTestId('ErrorOutlineIcon')).not.toBeInTheDocument(); | ||
|
||
const icon = screen.container.querySelector('[data-qa-error-icon="true"]'); | ||
expect(icon).toBeVisible(); | ||
expect(icon?.getAttribute('style')).toBe(null); | ||
}); | ||
|
||
it('renders the ErrorState with a custom icon and custom icon styling', () => { | ||
const screen = renderWithTheme( | ||
<ErrorState {...props} CustomIconStyles={{ height: 72, width: 72 }} /> | ||
); | ||
|
||
const icon = screen.container.querySelector('[data-qa-error-icon="true"]'); | ||
expect(icon).toBeVisible(); | ||
expect(icon?.getAttribute('style')).toBe('height: 72px; width: 72px;'); | ||
}); | ||
}); |
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
148 changes: 0 additions & 148 deletions
148
packages/manager/src/components/FileUploader/FileUploader.stories.mdx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
27 changes: 27 additions & 0 deletions
27
packages/manager/src/components/Uploaders/ImageUploader/ImageUploader.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,27 @@ | ||
import * as React from 'react'; | ||
|
||
import { ImageUploader } from './ImageUploader'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
/** | ||
* This component enables users to attach and upload custom Images. | ||
*/ | ||
export const _ImageUploader: StoryObj<typeof ImageUploader> = { | ||
args: { | ||
description: 'My Ubuntu Image for Production', | ||
dropzoneDisabled: false, | ||
label: 'file upload', | ||
region: 'us-east-1', | ||
}, | ||
render: (args) => { | ||
return <ImageUploader {...args} />; | ||
}, | ||
}; | ||
|
||
const meta: Meta<typeof ImageUploader> = { | ||
component: ImageUploader, | ||
title: 'Components/File Uploaders/Image Uploader', | ||
}; | ||
|
||
export default meta; |
File renamed without changes.
Oops, something went wrong.