From 777bc1ed7b835a94767a16d03e5be3ac8257d7d3 Mon Sep 17 00:00:00 2001 From: adamviktora Date: Mon, 8 Apr 2024 12:02:02 +0200 Subject: [PATCH 1/3] feat(Button): isDisabled won't set aria-disabled and pf-m-disabled class on ); - 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', () => { From 16c555fba5702cebe46a97a1b62e7e751a1c52c7 Mon Sep 17 00:00:00 2001 From: adamviktora Date: Mon, 8 Apr 2024 12:26:15 +0200 Subject: [PATCH 3/3] test: update snapshots --- .../__snapshots__/Button.test.tsx.snap | 2 +- .../DualListSelector.test.tsx.snap | 72 +++---- .../__snapshots__/FileUpload.test.tsx.snap | 4 +- .../__snapshots__/NumberInput.test.tsx.snap | 16 +- .../__snapshots__/Pagination.test.tsx.snap | 184 +++++++++--------- .../WizardFooterInternal.test.tsx.snap | 4 +- .../__snapshots__/Wizard.test.tsx.snap | 12 +- 7 files changed, 147 insertions(+), 147 deletions(-) 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" >