From f85bf29692e8d1fa37028e833a7649853058dfbd Mon Sep 17 00:00:00 2001 From: Marie Malarme Date: Tue, 2 Mar 2021 19:18:19 +0000 Subject: [PATCH] Test for select-and-style --- dom/select-and-style_test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dom/select-and-style_test.js diff --git a/dom/select-and-style_test.js b/dom/select-and-style_test.js new file mode 100644 index 00000000..7fca5626 --- /dev/null +++ b/dom/select-and-style_test.js @@ -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, + ) +})