From db3de2d78b54eb5b0b64a9dd2d89da63c936df2e Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Wed, 5 Nov 2025 11:52:01 -0500 Subject: [PATCH 1/5] chore(Compass): added tests for new variants --- .../src/components/DataList/__tests__/DataList.test.tsx | 6 ++++++ .../src/components/Table/__tests__/Table.test.tsx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/react-core/src/components/DataList/__tests__/DataList.test.tsx b/packages/react-core/src/components/DataList/__tests__/DataList.test.tsx index bdb5b8263f4..90e337a01a8 100644 --- a/packages/react-core/src/components/DataList/__tests__/DataList.test.tsx +++ b/packages/react-core/src/components/DataList/__tests__/DataList.test.tsx @@ -71,6 +71,12 @@ test('Renders custom class when passed', () => { expect(screen.getByLabelText('list')).toHaveClass('data-list-custom'); }); +test(`Renders with class ${styles.modifiers.plain} when isPlain is true`, () => { + render(); + + expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.plain); +}); + test('Renders with a hidden input to improve a11y when onSelectableRowChange is passed', () => { render( {}}> diff --git a/packages/react-table/src/components/Table/__tests__/Table.test.tsx b/packages/react-table/src/components/Table/__tests__/Table.test.tsx index 6ab0daccf47..3e7af5c9cd5 100644 --- a/packages/react-table/src/components/Table/__tests__/Table.test.tsx +++ b/packages/react-table/src/components/Table/__tests__/Table.test.tsx @@ -150,3 +150,9 @@ test('Renders expandable toggle button in Th with pf-m-small class when variant expect(button).toHaveClass('pf-m-small'); }); }); + +test(`Renders with class ${styles.modifiers.plain} when isPlain is true`, () => { + render(); + + expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.plain); +}); From 2fa989f51b75ef04ad20f1e0d46d92caee94e6db Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Wed, 5 Nov 2025 12:02:36 -0500 Subject: [PATCH 2/5] Added Tabs isNav tests --- .../components/Tabs/__tests__/Tabs.test.tsx | 60 +++++++++++++++++++ .../__snapshots__/Tabs.test.tsx.snap | 26 ++++---- 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/packages/react-core/src/components/Tabs/__tests__/Tabs.test.tsx b/packages/react-core/src/components/Tabs/__tests__/Tabs.test.tsx index d668e1c77ab..5fd3a88b11c 100644 --- a/packages/react-core/src/components/Tabs/__tests__/Tabs.test.tsx +++ b/packages/react-core/src/components/Tabs/__tests__/Tabs.test.tsx @@ -166,6 +166,66 @@ test(`Does not render with class ${styles.modifiers.initializingAccent} when unc expect(screen.getByRole('region')).not.toHaveClass(styles.modifiers.initializingAccent); }); +test(`Renders with class ${styles.modifiers.nav} when isNav is true`, () => { + render( + + + Tab Content + + + ); + + expect(screen.getByRole('region')).toHaveClass(styles.modifiers.nav); +}); + +test(`Renders with div wrapper by default`, () => { + render( + + + Tab Content + + + ); + + expect(screen.queryByRole('navigation')).not.toBeInTheDocument(); +}); + +test(`Renders with nav wrapper when component="nav"`, () => { + render( + + + Tab Content + + + ); + + expect(screen.getByRole('navigation')).toBeInTheDocument(); +}); + +test(`Renders with nav wrapper when isNav is true`, () => { + render( + + + Tab Content + + + ); + + expect(screen.getByRole('navigation')).toBeInTheDocument(); +}); + +test(`Overrides isNav nav wrapper when component="div" is passed`, () => { + render( + + + Tab Content + + + ); + + expect(screen.queryByRole('navigation')).not.toBeInTheDocument(); +}); + test('should render simple tabs', () => { const { asFragment } = render( diff --git a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap index c20a358a503..7a0666e5962 100644 --- a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +++ b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap @@ -5,7 +5,7 @@ exports[`should render accessible tabs 1`] = `