// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import '@testing-library/jest-dom'; import React from 'react'; import Portal from '../../../../src/components/ui/Portal'; import lightTheme from '../../../../src/theme/light'; import { renderWithTheme } from '../../../test-helpers'; describe('Portal', () => { it('should render a Portal without rootId', () => { const component = ( Portal content ); renderWithTheme(lightTheme, component); const divs = document.querySelectorAll('div'); expect(divs[1]).toContainHTML('Portal content'); }); it('should render a Portal with rootId', () => { const component = ( <>
Root Div
Portal content
); const { getByText } = renderWithTheme(lightTheme, component); const divElement = getByText('Root Div'); expect(divElement).toContainHTML('Root Div
Portal content
'); }); });