From da7cc6095c405ec142bec90a05b23c98e463e416 Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Wed, 10 May 2023 14:12:10 -0400 Subject: [PATCH] Updated tests --- .../components/Card/__tests__/Card.test.tsx | 18 +++++++++++------- .../__snapshots__/CardHeader.test.tsx.snap | 4 +--- .../__snapshots__/ToggleGroup.test.tsx.snap | 8 ++++---- .../src/components/demos/CardDemo/CardDemo.tsx | 3 ++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/react-core/src/components/Card/__tests__/Card.test.tsx b/packages/react-core/src/components/Card/__tests__/Card.test.tsx index b5a1eaef6d7..2c6e5f94d92 100644 --- a/packages/react-core/src/components/Card/__tests__/Card.test.tsx +++ b/packages/react-core/src/components/Card/__tests__/Card.test.tsx @@ -33,7 +33,7 @@ describe('Card', () => { test('allows passing in a React Component as the component', () => { const Component = () =>
im a div
; - render(); + render(); expect(screen.getByText('im a div')).toBeInTheDocument(); }); @@ -47,16 +47,18 @@ describe('Card', () => { const card = screen.getByText('selectable card'); expect(card).toHaveClass('pf-m-selectable'); - expect(card).toHaveAttribute('tabindex', '0'); }); test('card with isSelectable and isSelected applied ', () => { - render(selected and selectable card); + render( + + selected and selectable card + + ); const card = screen.getByText('selected and selectable card'); expect(card).toHaveClass('pf-m-selectable'); expect(card).toHaveClass('pf-m-selected'); - expect(card).toHaveAttribute('tabindex', '0'); }); test('card with only isSelected applied - not change', () => { @@ -81,7 +83,11 @@ describe('Card', () => { }); test('card with isSelectableRaised and isSelected applied ', () => { - render(raised selected card); + render( + + raised selected card + + ); const card = screen.getByText('raised selected card'); expect(card).toHaveClass('pf-m-selectable-raised'); @@ -154,7 +160,6 @@ describe('Card', () => { }); test('card applies the supplied card title as the aria label of the hidden input', () => { - // this component is used to mock the CardTitle's title registry behavior to keep this a pure unit test const MockCardTitle = ({ children }) => { const { registerTitleId } = React.useContext(CardContext); @@ -179,7 +184,6 @@ describe('Card', () => { }); test('card prioritizes selectableInputAriaLabel over card title labelling via card title', () => { - // this component is used to mock the CardTitle's title registry behavior to keep this a pure unit test const MockCardTitle = ({ children }) => { const { registerTitleId } = React.useContext(CardContext); diff --git a/packages/react-core/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap b/packages/react-core/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap index 43ec39e21a4..2e23b19d96b 100644 --- a/packages/react-core/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +++ b/packages/react-core/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap @@ -7,9 +7,7 @@ exports[`CardHeader actions are rendered 1`] = ` >
- -
+ /> `; diff --git a/packages/react-core/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap b/packages/react-core/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap index 0374d1bcee1..1bd5a0bc446 100644 --- a/packages/react-core/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +++ b/packages/react-core/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap @@ -134,19 +134,19 @@ exports[`ToggleGroup should render non-ToggleGroupItem children 1`] = `