From 841bda729bf3e6b5835ae9c39ce432c07d06b27d Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 18 Jun 2024 10:36:21 -0400 Subject: [PATCH] test(AILabel): update tests to use AILabel --- .../components/Checkbox/__tests__/Checkbox-test.js | 4 ++-- .../components/CheckboxGroup/CheckboxGroup-test.js | 4 ++-- .../react/src/components/ComboBox/ComboBox-test.js | 6 ++++-- .../components/ComposedModal/ComposedModal-test.js | 4 ++-- .../src/components/DatePicker/DatePicker-test.js | 4 ++-- .../react/src/components/Dropdown/Dropdown-test.js | 6 ++++-- packages/react/src/components/Modal/Modal-test.js | 4 ++-- .../__tests__/FilterableMultiSelect-test.js | 4 ++-- .../MultiSelect/__tests__/MultiSelect-test.js | 4 ++-- .../NumberInput/__tests__/NumberInput-test.js | 4 ++-- .../RadioButton/__tests__/RadioButton-test.js | 4 ++-- .../RadioButtonGroup/RadioButtonGroup-test.js | 4 ++-- .../src/components/Select/__tests__/Select-test.js | 4 ++-- packages/react/src/components/Tag/Tag-test.js | 4 ++-- .../components/TextArea/__tests__/TextArea-test.js | 8 ++++++-- .../TextInput/__tests__/TextInput-test.js | 8 ++++++-- packages/react/src/components/Tile/Tile-test.js | 14 +++++++++----- 17 files changed, 53 insertions(+), 37 deletions(-) diff --git a/packages/react/src/components/Checkbox/__tests__/Checkbox-test.js b/packages/react/src/components/Checkbox/__tests__/Checkbox-test.js index a92359c4e473..274ed2489a39 100644 --- a/packages/react/src/components/Checkbox/__tests__/Checkbox-test.js +++ b/packages/react/src/components/Checkbox/__tests__/Checkbox-test.js @@ -9,7 +9,7 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import Checkbox from '../Checkbox'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -205,7 +205,7 @@ describe('Checkbox', () => { defaultChecked labelText="Checkbox label" id="checkbox-label-1" - slug={} + slug={} /> ); diff --git a/packages/react/src/components/CheckboxGroup/CheckboxGroup-test.js b/packages/react/src/components/CheckboxGroup/CheckboxGroup-test.js index 3426a611efe3..48daafcba87c 100644 --- a/packages/react/src/components/CheckboxGroup/CheckboxGroup-test.js +++ b/packages/react/src/components/CheckboxGroup/CheckboxGroup-test.js @@ -9,7 +9,7 @@ import React from 'react'; import CheckboxGroup from '../CheckboxGroup'; import Checkbox from '../Checkbox/Checkbox'; import { render, screen } from '@testing-library/react'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const prefix = 'cds'; @@ -155,7 +155,7 @@ describe('CheckboxGroup', () => { } + slug={} /> ); diff --git a/packages/react/src/components/ComboBox/ComboBox-test.js b/packages/react/src/components/ComboBox/ComboBox-test.js index 69308e762dc8..c9eb55a10dcf 100644 --- a/packages/react/src/components/ComboBox/ComboBox-test.js +++ b/packages/react/src/components/ComboBox/ComboBox-test.js @@ -19,7 +19,7 @@ import { import ComboBox from '../ComboBox'; import { act } from 'react'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const findInputNode = () => screen.getByRole('combobox'); const openMenu = async () => { @@ -146,7 +146,9 @@ describe('ComboBox', () => { }); it('should respect slug prop', async () => { - const { container } = render(} />); + const { container } = render( + } /> + ); await waitForPosition(); expect(container.firstChild).toHaveClass( `${prefix}--list-box__wrapper--slug` diff --git a/packages/react/src/components/ComposedModal/ComposedModal-test.js b/packages/react/src/components/ComposedModal/ComposedModal-test.js index 3db0bff2a4b9..9d0983cfe066 100644 --- a/packages/react/src/components/ComposedModal/ComposedModal-test.js +++ b/packages/react/src/components/ComposedModal/ComposedModal-test.js @@ -14,7 +14,7 @@ import ComposedModal, { ModalBody } from './ComposedModal'; import { ModalHeader } from './ModalHeader'; import { ModalFooter } from './ModalFooter'; import { TextInput } from '../../'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const prefix = 'cds'; @@ -235,7 +235,7 @@ describe('ComposedModal', () => { it('should respect slug prop', () => { const { container } = render( - }> + }> Modal header This is the modal body content { placeholder="mm/dd/yyyy" labelText="Date Picker label" data-testid="input-value" - slug={} + slug={} /> ); diff --git a/packages/react/src/components/Dropdown/Dropdown-test.js b/packages/react/src/components/Dropdown/Dropdown-test.js index bfe9a8a8560e..8efaaba4444a 100644 --- a/packages/react/src/components/Dropdown/Dropdown-test.js +++ b/packages/react/src/components/Dropdown/Dropdown-test.js @@ -17,7 +17,7 @@ import { } from '../ListBox/test-helpers'; import Dropdown from '../Dropdown'; import DropdownSkeleton from '../Dropdown/Dropdown.Skeleton'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const prefix = 'cds'; @@ -192,7 +192,9 @@ describe('Dropdown', () => { }); it('should respect slug prop', () => { - const { container } = render(} />); + const { container } = render( + } /> + ); expect(container.firstChild).toHaveClass( `${prefix}--list-box__wrapper--slug` ); diff --git a/packages/react/src/components/Modal/Modal-test.js b/packages/react/src/components/Modal/Modal-test.js index 7e0f65d859c1..c610007b48fc 100644 --- a/packages/react/src/components/Modal/Modal-test.js +++ b/packages/react/src/components/Modal/Modal-test.js @@ -11,7 +11,7 @@ import userEvent from '@testing-library/user-event'; import Modal from './Modal'; import TextInput from '../TextInput'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const prefix = 'cds'; @@ -374,7 +374,7 @@ describe('Modal', () => { danger primaryButtonText="Danger button text" data-testid="modal-5" - slug={} + slug={} /> ); diff --git a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js index 9a4185a207cc..842dc6abae6c 100644 --- a/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js @@ -16,7 +16,7 @@ import { generateItems, generateGenericItem, } from '../../ListBox/test-helpers'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -153,7 +153,7 @@ describe('FilterableMultiSelect', () => { it('should respect slug prop', () => { const { container } = render( - } /> + } /> ); expect(container.firstChild).toHaveClass( `${prefix}--list-box__wrapper--slug` diff --git a/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js b/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js index 819d65bacac4..a0bc921cdfcc 100644 --- a/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js +++ b/packages/react/src/components/MultiSelect/__tests__/MultiSelect-test.js @@ -11,7 +11,7 @@ import React from 'react'; import MultiSelect from '../'; import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; import userEvent from '@testing-library/user-event'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -574,7 +574,7 @@ describe('MultiSelect', () => { const items = generateItems(4, generateGenericItem); const label = 'test-label'; const { container } = render( - } /> + } /> ); expect(container.firstChild).toHaveClass( `${prefix}--list-box__wrapper--slug` diff --git a/packages/react/src/components/NumberInput/__tests__/NumberInput-test.js b/packages/react/src/components/NumberInput/__tests__/NumberInput-test.js index 531627b5faee..502ba605eae8 100644 --- a/packages/react/src/components/NumberInput/__tests__/NumberInput-test.js +++ b/packages/react/src/components/NumberInput/__tests__/NumberInput-test.js @@ -11,7 +11,7 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { NumberInput } from '../NumberInput'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; function translateWithId(id) { if (id === 'increment.number') { @@ -70,7 +70,7 @@ describe('NumberInput', () => { }); it('should respect slug prop', () => { - render(} />); + render(} />); expect( screen.getByRole('button', { name: 'AI - Show information' }) diff --git a/packages/react/src/components/RadioButton/__tests__/RadioButton-test.js b/packages/react/src/components/RadioButton/__tests__/RadioButton-test.js index e3b7a7610172..0f228936ef62 100644 --- a/packages/react/src/components/RadioButton/__tests__/RadioButton-test.js +++ b/packages/react/src/components/RadioButton/__tests__/RadioButton-test.js @@ -9,7 +9,7 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import RadioButton from '../RadioButton'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -142,7 +142,7 @@ describe('RadioButton', () => { name="test-name" value="test-value" labelText="test-label" - slug={} + slug={} /> ); diff --git a/packages/react/src/components/RadioButtonGroup/RadioButtonGroup-test.js b/packages/react/src/components/RadioButtonGroup/RadioButtonGroup-test.js index 3cf101d18b41..625bb4383b0a 100644 --- a/packages/react/src/components/RadioButtonGroup/RadioButtonGroup-test.js +++ b/packages/react/src/components/RadioButtonGroup/RadioButtonGroup-test.js @@ -10,7 +10,7 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import RadioButtonGroup from './RadioButtonGroup'; import RadioButton from '../RadioButton'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; const prefix = 'cds'; @@ -216,7 +216,7 @@ describe('RadioButtonGroup', () => { it('should respect slug prop', () => { const { container } = render( - } name="test" legendText="test"> + } name="test" legendText="test"> diff --git a/packages/react/src/components/Select/__tests__/Select-test.js b/packages/react/src/components/Select/__tests__/Select-test.js index 1d141584786e..d146a59ed08c 100644 --- a/packages/react/src/components/Select/__tests__/Select-test.js +++ b/packages/react/src/components/Select/__tests__/Select-test.js @@ -11,7 +11,7 @@ import SelectItem from '../../SelectItem'; import SelectSkeleton from '../../Select/Select.Skeleton'; import userEvent from '@testing-library/user-event'; import { render, screen } from '@testing-library/react'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -243,7 +243,7 @@ describe('Select', () => { it('should respect slug prop', () => { const { container } = render( - } /> ); expect(container.firstChild.firstChild).toHaveClass( diff --git a/packages/react/src/components/Tag/Tag-test.js b/packages/react/src/components/Tag/Tag-test.js index 69c5e1d3ad1a..0424fd687a07 100644 --- a/packages/react/src/components/Tag/Tag-test.js +++ b/packages/react/src/components/Tag/Tag-test.js @@ -10,7 +10,7 @@ import { render, screen } from '@testing-library/react'; import React from 'react'; import Tag from './'; import DismissibleTag from './DismissibleTag'; -import { Slug } from '../Slug'; +import { AILabel } from '../AILabel'; describe('Tag', () => { describe('automated accessibility testing', () => { @@ -57,7 +57,7 @@ describe('Tag', () => { }); it('should respect slug prop', () => { - render(} />); + render(} />); expect( screen.getByRole('button', { name: 'AI - Show information' }) diff --git a/packages/react/src/components/TextArea/__tests__/TextArea-test.js b/packages/react/src/components/TextArea/__tests__/TextArea-test.js index 2a9c3726efd9..53c56a772520 100644 --- a/packages/react/src/components/TextArea/__tests__/TextArea-test.js +++ b/packages/react/src/components/TextArea/__tests__/TextArea-test.js @@ -10,7 +10,7 @@ import TextArea from '../TextArea'; import userEvent from '@testing-library/user-event'; import { fireEvent, waitFor } from '@testing-library/react'; import { render, screen, createEvent } from '@testing-library/react'; -import { Slug } from '../../Slug'; +import { AILabel } from '../../AILabel'; const prefix = 'cds'; @@ -197,7 +197,11 @@ describe('TextArea', () => { it('should respect slug prop', () => { render( -