Skip to content
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

Button disabled #1876

Merged
merged 5 commits into from
May 12, 2022
Merged

Button disabled #1876

merged 5 commits into from
May 12, 2022

Conversation

jacoblogan
Copy link
Contributor

Description of changes

This PR is to add the disabled class to Button primitives when the disabled attribute is present

Description of how you validated changes

Validated on docs site with the pagination primitive which uses an as={Button} that strips out the isDisabled property

Checklist

  • PR description included
  • yarn test passes
  • Tests are updated
  • No side effects or sideEffects field updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot
Copy link

changeset-bot bot commented May 11, 2022

🦋 Changeset detected

Latest commit: f1e959c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/ui-react Patch

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

@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 18:37 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 18:37 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 18:37 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 18:37 Inactive
@@ -25,6 +25,20 @@ describe('Button test suite', () => {
expect(link.classList).toContain('amplify-button--link');
});

it('should add the disabled class with the disabled attribute', async () => {
render(
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: <div> seems redundant for a single button


const disabled = await screen.findByTestId('disabled');

expect(disabled.classList).toContain('amplify-button--disabled');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
expect(disabled.classList).toContain('amplify-button--disabled');
expect(disabled).toHaveClass('amplify-button--disabled');

@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:12 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:12 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:12 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:12 Inactive
@@ -25,6 +25,18 @@ describe('Button test suite', () => {
expect(link.classList).toContain('amplify-button--link');
});

it('should add the disabled class with the disabled attribute', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a test that FieldGroupIconButton works correctly now?

@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:45 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:45 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:45 Inactive
@jacoblogan jacoblogan temporarily deployed to ci May 11, 2022 23:45 Inactive
@jacoblogan jacoblogan merged commit 542dc14 into main May 12, 2022
@jacoblogan jacoblogan deleted the button-disabled branch May 12, 2022 04:28
@github-actions github-actions bot mentioned this pull request May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants