UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

28 lines 1.11 kB
import React from 'react'; import { render, cleanup } from '@testing-library/react'; import Portal from "../Portal"; beforeEach(() => { cleanup(); }); describe('Portal', () => { test('rendering the defult props', () => { const customPortalContainer = document.createElement('div'); customPortalContainer.setAttribute('data-portal', 'portal1'); document.body.appendChild(customPortalContainer); const { baseElement } = render( /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", null, "Portal Div Check"))); expect(baseElement).toMatchSnapshot(); }); test('renders with portalId prop', () => { const customPortalContainer = document.createElement('div'); customPortalContainer.setAttribute('data-portal', 'customPortal'); document.body.appendChild(customPortalContainer); const { baseElement } = render( /*#__PURE__*/React.createElement(Portal, { portalId: "customPortal" }, /*#__PURE__*/React.createElement("div", null, "Portal Content Check"))); expect(baseElement).toMatchSnapshot(); }); });