fix: no-window lint error (#2272)

Latest PR runs are failing with linting errors, e.g.
https://github.com/denoland/fresh/actions/runs/7625625084/job/20770308634?pr=2266

Maybe this shouldn't be happening like this right now, but we'll still
need to clean these up eventually.
This commit is contained in:
Reed von Redwitz
2024-01-23 21:51:38 +01:00
committed by GitHub
parent 4bd556970a
commit a83765efaa
7 changed files with 16 additions and 10 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ Deno.test("rewrites root relative URLs in HTML", async () => {
const style = await page.$eval(
".foo",
(el) => window.getComputedStyle(el).color,
(el) => globalThis.getComputedStyle(el).color,
);
assertMatch(
style,
+3 -3
View File
@@ -1204,7 +1204,7 @@ Deno.test("fragment navigation should not scroll to top", async () => {
await page.click("a");
await page.waitForFunction(() => location.hash === "#foo");
const scroll = await page.evaluate(() => window.scrollY);
const scroll = await page.evaluate(() => globalThis.scrollY);
assert(scroll > 0, `Did not scroll to fragment`);
},
);
@@ -1332,12 +1332,12 @@ Deno.test("merges <head> content", async () => {
assertMetaContent(doc, "og:bar", "og value bar");
const color = await page.$eval("h1", (el) => {
return window.getComputedStyle(el).color;
return globalThis.getComputedStyle(el).color;
});
assertEquals(color, "rgb(255, 0, 0)");
const textColor = await page.$eval("p", (el) => {
return window.getComputedStyle(el).color;
return globalThis.getComputedStyle(el).color;
});
assertEquals(textColor, "rgb(0, 128, 0)");
},
+1 -1
View File
@@ -157,7 +157,7 @@ Deno.test({
// Check that CSS was applied accordingly
const color = await page.$eval("h1", (el) => {
return window.getComputedStyle(el).color;
return globalThis.getComputedStyle(el).color;
});
assertEquals(color, "rgb(220, 38, 38)");
},
+1 -1
View File
@@ -459,7 +459,7 @@ export async function waitForStyle(
(s, n, v) => {
const el = document.querySelector(s);
if (!el) return false;
return window.getComputedStyle(el)[n] === v;
return globalThis.getComputedStyle(el)[n] === v;
},
selector,
name,