Test for select-and-style

This commit is contained in:
Marie Malarme 2021-03-02 19:18:19 +00:00 committed by Clément
parent d753240d20
commit f85bf29692
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
export const tests = []
tests.push(async ({ page, eq }) => {
// check the CSS stylesheet is linked in the head tag
const CSSLink = await page.$$eval('head', (nodes) =>
[...nodes[0].children].some(
(node) => node.tagName === 'LINK' && node.rel === 'stylesheet',
),
)
eq(CSSLink, true)
// check the universal selector has been declared properly
const universalSelectorStyle = await page.evaluate(() => {
const target = [...window.document.styleSheets[0].cssRules].find(
(rule) => rule.selectorText === '*',
)
const { margin, opacity, boxSizing } = target.style
return { margin, opacity, boxSizing }
})
eq(
{ margin: '0px', opacity: '0.85', boxSizing: 'border-box' },
universalSelectorStyle,
)
})