From e22d30bcd53f5bd02dd5eac1304d205c6dfa2672 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Thu, 18 Jan 2024 13:35:34 -0500 Subject: [PATCH 1/3] feat(NotificationBadge): refactor to use status buttons for penta --- .../NotificationBadge/NotificationBadge.tsx | 19 ++++++++------- .../__tests__/NotificationBadge.test.tsx | 8 +++---- .../NotificationBadge.test.tsx.snap | 24 ++++++++----------- .../examples/NotificationBadge.md | 1 - .../examples/NotificationBadgeBasic.tsx | 4 ++-- .../examples/NotificationBadgeWithCount.tsx | 4 ++-- .../examples/notificationBadge.css | 4 ---- 7 files changed, 28 insertions(+), 36 deletions(-) delete mode 100644 packages/react-core/src/components/NotificationBadge/examples/notificationBadge.css diff --git a/packages/react-core/src/components/NotificationBadge/NotificationBadge.tsx b/packages/react-core/src/components/NotificationBadge/NotificationBadge.tsx index 34d00d83357..4a0dd12c30d 100644 --- a/packages/react-core/src/components/NotificationBadge/NotificationBadge.tsx +++ b/packages/react-core/src/components/NotificationBadge/NotificationBadge.tsx @@ -1,7 +1,5 @@ import * as React from 'react'; import { Button, ButtonVariant, ButtonProps } from '../Button'; -import { css } from '@patternfly/react-styles'; -import styles from '@patternfly/react-styles/css/components/NotificationBadge/notification-badge'; import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon'; import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon'; @@ -49,13 +47,16 @@ export const NotificationBadge: React.FunctionComponent notificationChild = attentionIcon; } return ( - ); }; diff --git a/packages/react-core/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx b/packages/react-core/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx index 9090d062955..d94a1c45ff6 100644 --- a/packages/react-core/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx +++ b/packages/react-core/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx @@ -30,14 +30,14 @@ test('Renders with aria-expanded="true" when isExpanded is passed in.', () => { expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true'); }); -test('Does not render with .pf-m-expanded when isExpanded is not passed in.', () => { +test('Does not render with .pf-m-clicked when isExpanded is not passed in.', () => { render(); - expect(screen.getByRole('button').firstChild).not.toHaveClass('pf-m-expanded'); + expect(screen.getByRole('button')).not.toHaveClass('pf-m-clicked'); }); -test('Renders with .pf-m-expanded when isExpanded is passed in.', () => { +test('Renders with .pf-m-clicked when isExpanded is passed in.', () => { render(); - expect(screen.getByRole('button').firstChild).toHaveClass('pf-m-expanded'); + expect(screen.getByRole('button')).toHaveClass('pf-m-clicked'); }); diff --git a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap index 4b10037ed99..c877c284637 100644 --- a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +++ b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap @@ -5,14 +5,14 @@ exports[`NotificationBadge count 1`] = ` `; @@ -42,14 +38,14 @@ exports[`false NotificationBadge needs attention 1`] = ` ); }; diff --git a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap index c877c284637..861ea96ea4a 100644 --- a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +++ b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap @@ -44,11 +44,7 @@ exports[`false NotificationBadge needs attention 1`] = ` data-ouia-safe="true" type="button" > - - does not need attention Badge - + does not need attention Badge `; @@ -64,11 +60,7 @@ exports[`true NotificationBadge needs attention 1`] = ` data-ouia-safe="true" type="button" > - - needs attention Badge - + needs attention Badge `;