Skip to content

Commit

Permalink
test: add a test for hidden shadow host (#6008)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman committed Mar 31, 2021
1 parent ba89603 commit ceb4bc2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/page/page-wait-for-selector-2.spec.ts
Expand Up @@ -250,3 +250,21 @@ it('should allow you to select an element with single slash xpath', async ({page
const waitForXPath = page.waitForSelector('//html/body/div');
expect(await page.evaluate(x => x.textContent, await waitForXPath)).toBe('some text');
});

it('should correctly handle hidden shadow host', async ({page, server}) => {
await page.setContent(`
<x-host hidden></x-host>
<script>
const host = document.querySelector('x-host');
const root = host.attachShadow({ mode: 'open' });
const style = document.createElement('style');
style.textContent = ':host([hidden]) { display: none; }';
root.appendChild(style);
const child = document.createElement('div');
child.textContent = 'Find me';
root.appendChild(child);
</script>
`);
expect(await page.textContent('div')).toBe('Find me');
await page.waitForSelector('div', { state: 'hidden' });
});

0 comments on commit ceb4bc2

Please sign in to comment.