From 249dcb397db8b766982423bbb6e4722f5d6a0c04 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Thu, 27 Jun 2024 11:21:16 -0400 Subject: [PATCH] test(AILabel): update textLabel test --- .../__snapshots__/PublicAPI-test.js.snap | 20 +++++++++++-------- .../AILabel/__tests__/AILabel-test.js | 4 ++-- .../react/src/components/AILabel/index.js | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 20db52dca41f..273c1d1c8dde 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -11,9 +11,7 @@ Map { "aiText": Object { "type": "string", }, - "aiTextLabel": Object { - "type": "string", - }, + "aiTextLabel": [Function], "align": Object { "args": Array [ Array [ @@ -41,6 +39,9 @@ Map { ], "type": "oneOf", }, + "aria-label": Object { + "type": "string", + }, "autoAlign": Object { "type": "bool", }, @@ -82,7 +83,8 @@ Map { ], "type": "oneOf", }, - "slugLabel": Object { + "slugLabel": [Function], + "textLabel": Object { "type": "string", }, }, @@ -10789,9 +10791,7 @@ Map { "aiText": Object { "type": "string", }, - "aiTextLabel": Object { - "type": "string", - }, + "aiTextLabel": [Function], "align": Object { "args": Array [ Array [ @@ -10819,6 +10819,9 @@ Map { ], "type": "oneOf", }, + "aria-label": Object { + "type": "string", + }, "autoAlign": Object { "type": "bool", }, @@ -10860,7 +10863,8 @@ Map { ], "type": "oneOf", }, - "slugLabel": Object { + "slugLabel": [Function], + "textLabel": Object { "type": "string", }, }, diff --git a/packages/react/src/components/AILabel/__tests__/AILabel-test.js b/packages/react/src/components/AILabel/__tests__/AILabel-test.js index fc53fc65628b..43d24cb46d6b 100644 --- a/packages/react/src/components/AILabel/__tests__/AILabel-test.js +++ b/packages/react/src/components/AILabel/__tests__/AILabel-test.js @@ -40,7 +40,7 @@ describe('AILabel', () => { expect(screen.getByText('IA')).toBeInTheDocument(); }); - it('should respect aiTextLabel prop when kind is inline', () => { + it('should respect textLabel prop when kind is inline', () => { const wrapper = render(); const additionalTextSpan = wrapper.container.querySelector( @@ -50,7 +50,7 @@ describe('AILabel', () => { expect(additionalTextSpan).toHaveTextContent('Test text'); }); - it('should not populate aiTextLabel prop when kind is not inline', () => { + it('should not populate textLabel prop when kind is not inline', () => { const wrapper = render(); const additionalTextSpan = wrapper.container.querySelector( diff --git a/packages/react/src/components/AILabel/index.js b/packages/react/src/components/AILabel/index.js index 4eddccf7268f..f21db0c554f8 100644 --- a/packages/react/src/components/AILabel/index.js +++ b/packages/react/src/components/AILabel/index.js @@ -150,9 +150,9 @@ export const AILabel = React.forwardRef(function AILabel( className={aiLabelButtonClasses} label={ariaLabelText}> {aiText} - {kind === 'inline' && aiTextLabel && ( + {kind === 'inline' && (aiTextLabel || textLabel) && ( - {aiTextLabel} + {aiTextLabel || textLabel} )}