diff --git a/packages/react-core/src/components/Button/Button.tsx b/packages/react-core/src/components/Button/Button.tsx index 6966811e045..16f4f4559d4 100644 --- a/packages/react-core/src/components/Button/Button.tsx +++ b/packages/react-core/src/components/Button/Button.tsx @@ -161,13 +161,13 @@ const ButtonBase: React.FunctionComponent = ({ { expect(screen.getByRole('button')).toHaveClass('pf-m-clicked'); }); -test('Renders with class pf-m-disabled when isDisabled = true', () => { +test('Does not render with class pf-m-disabled by default when isDisabled = true', () => { render(); - expect(screen.getByRole('button')).toHaveClass('pf-m-disabled'); + expect(screen.getByRole('button')).not.toHaveClass('pf-m-disabled'); +}); + +test('aria-disabled is set to false when isDisabled = true', () => { + render(); + expect(screen.getByRole('button')).toHaveAttribute('aria-disabled', 'false'); +}); + +test('Renders with class pf-m-disabled when isDisabled = true and component is not a button', () => { + render( + + ); + expect(screen.getByText('Disabled Anchor Button')).toHaveClass('pf-m-disabled'); }); test('Renders with class pf-m-aria-disabled when isAriaDisabled = true', () => { @@ -208,7 +222,9 @@ test('aria-disabled is set to true and tabIndex to -1 if component is not a butt Disabled Anchor Button ); - expect(screen.getByText('Disabled Anchor Button')).toHaveAttribute('tabindex', '-1'); + const anchor = screen.getByText('Disabled Anchor Button'); + expect(anchor).toHaveAttribute('tabindex', '-1'); + expect(anchor).toHaveAttribute('aria-disabled', 'true'); }); test('setting tab index through props', () => { diff --git a/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap b/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap index 0818c970d3f..c17d7386cc1 100644 --- a/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +++ b/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap @@ -6,7 +6,7 @@ exports[`Renders basic button 1`] = ` aria-disabled="false" aria-label="basic button" class="pf-v6-c-button pf-m-primary" - data-ouia-component-id="OUIA-Generated-Button-primary-28" + data-ouia-component-id="OUIA-Generated-Button-primary-30" data-ouia-component-type="PF6/Button" data-ouia-safe="true" type="button" diff --git a/packages/react-core/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap b/packages/react-core/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap index 2f713966de5..7c28575d55c 100644 --- a/packages/react-core/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap +++ b/packages/react-core/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap @@ -106,9 +106,9 @@ exports[`DualListSelector basic 1`] = ` class="pf-v6-c-dual-list-selector__controls-item" >