-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add text to loading state cluster details (#1510)
* Update the ChecksResultOverview * Add test for refactored Spinner component * Add Spinner story * Enrich CHeckResultsOverview test
- Loading branch information
Showing
5 changed files
with
63 additions
and
9 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
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 Spinner from './Spinner'; | ||
|
||
export default { | ||
title: 'Spinner', | ||
component: Spinner, | ||
}; | ||
|
||
export const Default = { | ||
argTypes: { | ||
className: { | ||
control: 'text', | ||
description: 'Add padding or margin', | ||
table: { | ||
type: { summary: 'string' }, | ||
}, | ||
}, | ||
size: { | ||
control: { type: 'radio' }, | ||
options: ['xs', 's', 'base', 'm', 'l', 'xl', 'xxl', 'xxxl'], | ||
description: 'How big should be the spinner?', | ||
table: { | ||
type: { summary: 'string' }, | ||
defaultValue: { summary: 'm' }, | ||
}, | ||
}, | ||
}, | ||
}; |
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 { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import Spinner from './Spinner'; | ||
|
||
describe('Spinner', () => { | ||
it('renders the spinner component with default props', () => { | ||
render(<Spinner />); | ||
const spinnerElement = screen.getByRole('alert'); | ||
expect(spinnerElement).toBeInTheDocument(); | ||
expect(spinnerElement).toHaveAttribute('aria-label', 'Loading'); | ||
expect(spinnerElement.firstChild).toHaveClass('fill-jungle-green-500'); | ||
}); | ||
|
||
it('renders the spinner component with custom props', () => { | ||
render(<Spinner className="pt-12" size="xl" />); | ||
const spinnerElement = screen.getByRole('alert'); | ||
expect(spinnerElement).toBeInTheDocument(); | ||
expect(spinnerElement).toHaveAttribute('aria-label', 'Loading'); | ||
expect(spinnerElement).toHaveClass('pt-12'); | ||
expect(spinnerElement.firstChild).toHaveAttribute('width', '32'); | ||
}); | ||
}); |