Skip to content

Commit

Permalink
test: style element
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 21, 2021
1 parent ccbb8ad commit 0197ab5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/platform/element/element.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ test('element', async ({ page }) => {

const testParagraphConstructor = page.locator('#testParagraphConstructor');
await expect(testParagraphConstructor).toHaveText('HTMLParagraphElement HTMLParagraphElement');

const testStyleElement = page.locator('#testStyleElement');
await expect(testStyleElement).toHaveText('rgb(0, 0, 255)');
});
22 changes: 22 additions & 0 deletions tests/platform/element/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,28 @@ <h1>Element</h1>
</script>
</li>

<li>
<strong>style element</strong>
<code id="testStyleElement"></code>
<script type="text/partytown">
(function () {
const elm = document.getElementById('testStyleElement');

const css = document.createTextNode(`
#testStyleElement {
color: blue;
}
`);
const style = document.createElement('style');
style.setAttribute('mph', '88');
style.appendChild(css);
document.head.appendChild(style);

elm.textContent = getComputedStyle(elm).color;
})();
</script>
</li>

<script type="text/partytown">
(function () {
document.body.classList.add('completed');
Expand Down

1 comment on commit 0197ab5

@vercel
Copy link

@vercel vercel bot commented on 0197ab5 Oct 21, 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.