Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test(site): make loading snapshots more predictable#14564

Merged
BrunoQuaresma merged 3 commits intomainfrom
bq/determinate-loading-on-storybook
Sep 4, 2024
Merged

test(site): make loading snapshots more predictable#14564
BrunoQuaresma merged 3 commits intomainfrom
bq/determinate-loading-on-storybook

Conversation

@BrunoQuaresma
Copy link
Contributor

@BrunoQuaresma BrunoQuaresma commented Sep 4, 2024

Abstracts the Spinner component to control the display of the CircularProgress component. This allows us to make it static during Chromatic tests, making loading tests easier to visualize.

Before:
Screenshot 2024-09-04 at 14 00 44

After:
Screenshot 2024-09-04 at 14 00 49

Abstracts the Spinner component to control the display of the CircularProgress component. This allows us to make it static during Chromatic tests, making loading tests easier to visualize.
@BrunoQuaresma BrunoQuaresma self-assigned this Sep 4, 2024
@BrunoQuaresma BrunoQuaresma requested review from a team and Kira-Pilot and removed request for a team September 4, 2024 17:01
{...attrs}
>
<CircularProgress size={size} />
<Spinner aria-label="Loading..." size={size} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be misunderstanding but it seems we have a Loader component wrapping a Spinner component wrapping a CircularProgress component. Is there a reason to have 3 levels nesting here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! The purpose of the 'Loader' is to act as a container that centrally positions the loading spinner on the page or within a section, with some padding around it. Meanwhile, the 'Spinner' can be utilized in other components, such as loading buttons. Perhaps 'Loader' is not the most suitable name, but I can't think of anything better at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, makes sense! Loader works for me :)

@Kira-Pilot
Copy link
Member

Kira-Pilot commented Sep 4, 2024

One suggestion: we could stick the aria on the actual component so the Spinner is always labeled correctly. Then consumers of the component could pass in a more specific label and override the default, e.g. "Loading the Workspaces Page".

*/
if (isChromatic()) {
props.variant = "determinate";
props.value = 75;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@BrunoQuaresma
Copy link
Contributor Author

One suggestion: we could stick the aria on the actual component so the Spinner is always labeled correctly. Then consumers of the component could pass in a more specific label and override the default, e.g. "Loading the Workspaces Page".

I like the idea! 👍

@BrunoQuaresma BrunoQuaresma merged commit c3f0db3 into main Sep 4, 2024
@BrunoQuaresma BrunoQuaresma deleted the bq/determinate-loading-on-storybook branch September 4, 2024 18:20
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants