(attachTo: HTMLElement = document.body)
| 17 | } |
| 18 | |
| 19 | export function createShadowRoot(attachTo: HTMLElement = document.body): ShadowRootReturnValue { |
| 20 | const div = document.createElement('div'); |
| 21 | div.setAttribute('data-testid', 'shadow-root'); |
| 22 | attachTo.appendChild(div); |
| 23 | const shadowRoot = div.attachShadow({mode: 'open'}); |
| 24 | return {shadowHost: div, shadowRoot, cleanup: () => attachTo.removeChild(div)}; |
| 25 | } |