From dbd10c90c6f6ff6fa242590c3a8669d475fef07b Mon Sep 17 00:00:00 2001 From: adamviktora Date: Thu, 9 Mar 2023 16:25:19 +0100 Subject: [PATCH] fix(Alert): remove deprecated titleHeadingLevel prop --- packages/react-core/src/components/Alert/Alert.tsx | 11 +---------- .../src/components/Alert/__tests__/Alert.test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/react-core/src/components/Alert/Alert.tsx b/packages/react-core/src/components/Alert/Alert.tsx index 8cf94023222..7b2b65bee76 100644 --- a/packages/react-core/src/components/Alert/Alert.tsx +++ b/packages/react-core/src/components/Alert/Alert.tsx @@ -55,8 +55,6 @@ export interface AlertProps extends Omit, 'actio timeoutAnimation?: number; /** Title of the alert. */ title: React.ReactNode; - /** @deprecated Sets the heading level to use for the alert title. Default is h4. */ - titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; /** Sets the element to use as the alert title. Default is h4. */ component?: keyof JSX.IntrinsicElements; /** Adds accessible text to the alert toggle. */ @@ -98,7 +96,6 @@ export const Alert: React.FunctionComponent = ({ actionClose, actionLinks, title, - titleHeadingLevel, component = 'h4', children = '', className = '', @@ -126,13 +123,7 @@ export const Alert: React.FunctionComponent = ({ ); const titleRef = React.useRef(null); - const TitleComponent = (titleHeadingLevel || component) as any; - if (titleHeadingLevel !== undefined) { - // eslint-disable-next-line no-console - console.warn( - 'Alert: titleHeadingLevel is deprecated, please use the newer component prop instead to set the alert title element.' - ); - } + const TitleComponent = component as any; const divRef = React.useRef(); const [isTooltipVisible, setIsTooltipVisible] = useState(false); diff --git a/packages/react-core/src/components/Alert/__tests__/Alert.test.tsx b/packages/react-core/src/components/Alert/__tests__/Alert.test.tsx index 994ef3b231f..ef148f3cfe1 100644 --- a/packages/react-core/src/components/Alert/__tests__/Alert.test.tsx +++ b/packages/react-core/src/components/Alert/__tests__/Alert.test.tsx @@ -179,9 +179,9 @@ test('Renders the title as an h4 by default', () => { expect(screen.getByRole('heading', { level: 4, name: 'Default alert: Some title' })).toBeVisible(); }); -test('Renders the title as other heading levels when one is passed using titleHeadingLevel', () => { +test('Renders the title as other heading levels when one is passed using component', () => { render( - + Some alert );