-
Notifications
You must be signed in to change notification settings - Fork 7
Add loading support to Button #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 2fe3e17 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c87236c
to
9f9053c
Compare
() => html`<glide-core-button | ||
label="Label" | ||
aria-description="Description" | ||
></glide-core-button>`, | ||
() => | ||
html`<glide-core-button | ||
label="Label" | ||
aria-description="Description" | ||
></glide-core-button>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter made me do it.
`); | ||
}); | ||
|
||
test('loading', { tag: '@accessibility' }, async ({ page }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loading=${true}
would also work, but we don't need to test loading=${false}
, as it's redundant with disabled=${false}
above.
Did the same for the visual tests. It's probably not ideal, but it beats running an almost identical visual test for every variant with both themes and for every story.
9f9053c
to
ac18cd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the addition of loading
, it complicated our visual tests quite a bit, as I wanted to test each variant when loading
. The existing tests had variant
tests mixed in across different states. And while I could have added a describe()
block and then tested each variant in there, I also wanted to ensure the focus and hover states when loading
were correct. So that complicated things quite a bit.
What I ended up doing here is looping over each Button variant
, as you can see starting on line 10. I then had to move things around a bit to ensure we maintain the existing coverage, while also including the loading
additions.
This way, we can test each variant and other potential visual states - whether it's attributes, focus states, hover states, or anything else. I think this will serve us well from now on.
The diff is gnarly, so it may be best to view the file directly instead.
.changeset/cute-mirrors-cover.md
Outdated
'@crowdstrike/glide-core': patch | ||
--- | ||
|
||
Button now supports a `loading` attribute that will render a Spinner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning that loading
will also prevent click events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe, more generally, that loading
effectively disables Button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh?
2fe3e17 ✅
33efb64
to
2fe3e17
Compare
🚀 Description
Adds a Spinner component to Button via the
loading
attribute.📋 Checklist
🔬 Manual Testing