test: click links in shadow dom (#5773)
This commit is contained in:
parent
c020278f9d
commit
13977301fd
28
test/assets/shadow-dom-link.html
Normal file
28
test/assets/shadow-dom-link.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<html>
|
||||
<head>
|
||||
<script>
|
||||
customElements.define('my-link',
|
||||
class extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const template = document.getElementById('my-link-template');
|
||||
const templateContent = template.content;
|
||||
|
||||
this.attachShadow({mode: 'open'}).appendChild(
|
||||
templateContent.cloneNode(true)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
window.clickCount = 0;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<template id="my-link-template">
|
||||
<a href="#" id="inner-link" onclick="clickCount++"><slot></slot></a>
|
||||
</template>
|
||||
<my-link>Sign up</my-link>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -27,6 +27,15 @@ it('should work for open shadow roots', async ({page, server}) => {
|
|||
expect(await page.$$(`data-testid:light=foo`)).toEqual([]);
|
||||
});
|
||||
|
||||
it('should click on links in shadow dom', (test, { browserName }) => {
|
||||
test.fixme(browserName === 'chromium', 'Cannot get link quads, see #5765');
|
||||
}, async ({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/shadow-dom-link.html');
|
||||
expect(await page.evaluate(() => (window as any).clickCount)).toBe(0);
|
||||
await page.click('#inner-link');
|
||||
expect(await page.evaluate(() => (window as any).clickCount)).toBe(1);
|
||||
});
|
||||
|
||||
it('should work with :visible', async ({page}) => {
|
||||
await page.setContent(`
|
||||
<section>
|
||||
|
|
|
|||
Loading…
Reference in a new issue