import '@testing-library/jest-dom'; export function expectStylesInDom(styleUrls: string | string[], shadowRootFn: () => ShadowRoot) { [styleUrls].flat().forEach(styleUrl => { const link = shadowRootFn().querySelector( `link[href='${styleUrl}'][rel='stylesheet'][crossorigin='anonymous']` ); expect(link).toBeInTheDocument(); }); expect(shadowRootFn().querySelectorAll('link').length).toBe([styleUrls].flat().length); }