Skip to content

Commit

Permalink
innerHTML, firstChild test
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 1, 2021
1 parent b1f7d2b commit d8b94a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/platform/anchor/anchor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ test('anchor', async ({ page }) => {
await page.waitForSelector('.testCreateAnchorAppend');
const testCreateAnchorAppend = page.locator('#testCreateAnchorAppend');
await expect(testCreateAnchorAppend).toHaveText('/platform/anchor/append-child');

await page.waitForSelector('.testInnerHtmlFirstChild');
const testInnerHtmlFirstChild = page.locator('#testInnerHtmlFirstChild');
await expect(testInnerHtmlFirstChild).toHaveText('#');
});
20 changes: 19 additions & 1 deletion tests/platform/anchor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
</style>
</head>
<body >
<body>
<h1>Anchor</h1>

<ul>
Expand Down Expand Up @@ -99,6 +99,24 @@ <h1>Anchor</h1>
</script>
</li>

<li>
<strong>innerHTML firstChild</strong>
<div id="testInnerHtmlFirstChild"></div>
<script type="text/partytown">
(function () {
const elm = document.getElementById('testInnerHtmlFirstChild');

const div = document.createElement('div');
div.innerHTML = "<a href='#'></a>";

const firstChild = div.firstChild;
const href = firstChild.getAttribute('href');

elm.textContent = href;
elm.className = 'testInnerHtmlFirstChild';
})();
</script>
</li>
</ul>

<hr />
Expand Down

1 comment on commit d8b94a2

@vercel
Copy link

@vercel vercel bot commented on d8b94a2 Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.