diff --git a/packages/react/src/components/Tooltip/__tests__/DefinitionTooltip-test.js b/packages/react/src/components/Tooltip/__tests__/DefinitionTooltip-test.js index 34360c5ebd55..232653cb8e79 100644 --- a/packages/react/src/components/Tooltip/__tests__/DefinitionTooltip-test.js +++ b/packages/react/src/components/Tooltip/__tests__/DefinitionTooltip-test.js @@ -11,11 +11,15 @@ import React from 'react'; import { DefinitionTooltip } from '../DefinitionTooltip'; describe('DefinitionTooltip', () => { - it('should display onClick a definition provided via prop', async () => { + it('should display on click a definition provided via prop', async () => { const definition = 'Uniform Resource Locator'; render(URL); + expect(screen.getByRole('button')).toHaveAttribute( + 'aria-expanded', + 'false' + ); await userEvent.click(screen.getByText('URL')); - expect(screen.getByText(definition)).toBeVisible(); + expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true'); }); it('should have a visible tooltip if `defaultOpen` is set to true', () => { @@ -25,7 +29,7 @@ describe('DefinitionTooltip', () => { term ); - expect(screen.getByText(definition)).toBeVisible(); + expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true'); }); describe('Component API', () => {