diff --git a/src/Portal/Portal.spec.tsx b/src/Portal/Portal.spec.tsx index 570269a..52bc093 100644 --- a/src/Portal/Portal.spec.tsx +++ b/src/Portal/Portal.spec.tsx @@ -2,10 +2,9 @@ import { render, getByTestId as globalGetByTestId, getAllByTestId as globalGetAllByTestId, - waitFor, } from '@testing-library/react'; import React from 'react'; -import { PabloThemeProvider, rootContext } from '../theme'; +import { PabloThemeProvider } from '../theme'; import { Portal } from './Portal'; test('Render Portal component', () => { @@ -34,7 +33,7 @@ test('Forward ref object with ShadowRoot', async () => { renderComponent({ ref }, shadowRoot); expect(ref.current).toBeDefined(); expect(ref.current.getAttribute('data-testid')).toBe('pbl-portal-mountpoint'); - expect(ref.current.parentElement).toBe(shadowRoot); + expect(ref.current.parentNode).toBe(shadowRoot); }); test('Forward ref function with ShadowRoot', () => { @@ -46,8 +45,6 @@ test('Forward ref function with ShadowRoot', () => { }); function renderComponent(props: object, rootElement: ShadowRoot | Document = document) { - console.log('document', rootElement); - const { baseElement, unmount } = render( diff --git a/src/Portal/Portal.tsx b/src/Portal/Portal.tsx index 7c56f9f..1ba320c 100644 --- a/src/Portal/Portal.tsx +++ b/src/Portal/Portal.tsx @@ -16,15 +16,9 @@ export const Portal = forwardRef(({ children, name }, ref) if (mountPoint) { mountPoint.setAttribute('data-testid', `pbl-${name}-mountpoint`); const mountPointParent = rootElement instanceof ShadowRoot ? rootElement : rootElement.body; - - console.log('Appending mountPoint to:', mountPointParent); mountPointParent.appendChild(mountPoint); setRef(ref, mountPoint); - setTimeout(() => { - console.log('mountPointParent', mountPointParent, mountPoint.parentElement); - }); return () => { - console.log('Removing mountPoint from:', mountPointParent); mountPointParent.removeChild(mountPoint); }; }