fix(vite): route css import (#3438)
Fixes https://github.com/denoland/fresh/issues/3426
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { expect } from "@std/expect";
|
||||
import { waitForText, withBrowser } from "../../fresh/tests/test_utils.tsx";
|
||||
import {
|
||||
waitFor,
|
||||
waitForText,
|
||||
withBrowser,
|
||||
} from "../../fresh/tests/test_utils.tsx";
|
||||
import {
|
||||
buildVite,
|
||||
DEMO_DIR,
|
||||
@@ -383,6 +387,33 @@ Deno.test({
|
||||
sanitizeResources: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "vite build - route css import",
|
||||
fn: async () => {
|
||||
await launchProd(
|
||||
{ cwd: viteResult.tmp },
|
||||
async (address) => {
|
||||
await withBrowser(async (page) => {
|
||||
await page.goto(`${address}/tests/css`, {
|
||||
waitUntil: "networkidle2",
|
||||
});
|
||||
|
||||
await waitFor(async () => {
|
||||
const color = await page
|
||||
.locator("h1")
|
||||
// deno-lint-ignore no-explicit-any
|
||||
.evaluate((el) => window.getComputedStyle(el as any).color);
|
||||
expect(color).toEqual("rgb(255, 0, 0)");
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
sanitizeOps: false,
|
||||
sanitizeResources: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "vite build - remote island",
|
||||
fn: async () => {
|
||||
|
||||
@@ -306,6 +306,28 @@ Deno.test({
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "vite dev - route css import",
|
||||
fn: async () => {
|
||||
await withBrowser(async (page) => {
|
||||
await page.goto(`${demoServer.address()}/tests/css`, {
|
||||
waitUntil: "networkidle2",
|
||||
});
|
||||
|
||||
await waitFor(async () => {
|
||||
const color = await page
|
||||
.locator("h1")
|
||||
// deno-lint-ignore no-explicit-any
|
||||
.evaluate((el) => window.getComputedStyle(el as any).color);
|
||||
expect(color).toEqual("rgb(255, 0, 0)");
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
sanitizeResources: false,
|
||||
sanitizeOps: false,
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "vite dev - remote island",
|
||||
fn: async () => {
|
||||
|
||||
Reference in New Issue
Block a user