Skip to content

Commit

Permalink
test(AILabel): update textLabel test
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Jun 27, 2024
1 parent de3eca6 commit 249dcb3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
20 changes: 12 additions & 8 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Map {
"aiText": Object {
"type": "string",
},
"aiTextLabel": Object {
"type": "string",
},
"aiTextLabel": [Function],
"align": Object {
"args": Array [
Array [
Expand Down Expand Up @@ -41,6 +39,9 @@ Map {
],
"type": "oneOf",
},
"aria-label": Object {
"type": "string",
},
"autoAlign": Object {
"type": "bool",
},
Expand Down Expand Up @@ -82,7 +83,8 @@ Map {
],
"type": "oneOf",
},
"slugLabel": Object {
"slugLabel": [Function],
"textLabel": Object {
"type": "string",
},
},
Expand Down Expand Up @@ -10789,9 +10791,7 @@ Map {
"aiText": Object {
"type": "string",
},
"aiTextLabel": Object {
"type": "string",
},
"aiTextLabel": [Function],
"align": Object {
"args": Array [
Array [
Expand Down Expand Up @@ -10819,6 +10819,9 @@ Map {
],
"type": "oneOf",
},
"aria-label": Object {
"type": "string",
},
"autoAlign": Object {
"type": "bool",
},
Expand Down Expand Up @@ -10860,7 +10863,8 @@ Map {
],
"type": "oneOf",
},
"slugLabel": Object {
"slugLabel": [Function],
"textLabel": Object {
"type": "string",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<AILabel kind="inline" textLabel="Test text" />);

const additionalTextSpan = wrapper.container.querySelector(
Expand All @@ -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(<AILabel textLabel="Test text" />);

const additionalTextSpan = wrapper.container.querySelector(
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/AILabel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ export const AILabel = React.forwardRef(function AILabel(
className={aiLabelButtonClasses}
label={ariaLabelText}>
<span className={`${prefix}--slug__text`}>{aiText}</span>
{kind === 'inline' && aiTextLabel && (
{kind === 'inline' && (aiTextLabel || textLabel) && (
<span className={`${prefix}--slug__additional-text`}>
{aiTextLabel}
{aiTextLabel || textLabel}
</span>
)}
</ToggletipButton>
Expand Down

0 comments on commit 249dcb3

Please sign in to comment.