diff --git a/.changeset/ten-bats-trade.md b/.changeset/ten-bats-trade.md new file mode 100644 index 00000000000..10e19fccad0 --- /dev/null +++ b/.changeset/ten-bats-trade.md @@ -0,0 +1,5 @@ +--- +"@aws-amplify/ui-react": patch +--- + +chore(react): update tests for disabled Fieldset diff --git a/packages/react/src/primitives/Button/__tests__/Button.test.tsx b/packages/react/src/primitives/Button/__tests__/Button.test.tsx index f75d30284f6..5ac42e0f0be 100644 --- a/packages/react/src/primitives/Button/__tests__/Button.test.tsx +++ b/packages/react/src/primitives/Button/__tests__/Button.test.tsx @@ -3,6 +3,7 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { Button } from '../Button'; +import { Fieldset } from '../../Fieldset'; import { ButtonColorTheme } from '../../types'; import { ComponentClassNames } from '../../shared'; @@ -238,6 +239,20 @@ describe('Button test suite', () => { expect(button).toBeDisabled(); }); + it('should always be disabled if parent Fieldset isDisabled', async () => { + render( +
+
+ ); + + const button = await screen.findByTestId('button'); + const buttonDisabled = await screen.findByTestId('buttonWithDisabledProp'); + expect(button).toHaveAttribute('disabled'); + expect(buttonDisabled).toHaveAttribute('disabled'); + }); + it('should set loading state correctly if isLoading is set to true', async () => { render(