Skip to content

Commit e0313dd

Browse files
authored
test(mdx): create referenced css file (#6124)
1 parent 1b20340 commit e0313dd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

integration/mdx-test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
createFixture,
66
js,
77
mdx,
8+
css,
89
} from "./helpers/create-fixture";
910
import type { Fixture, AppFixture } from "./helpers/create-fixture";
1011
import { PlaywrightFixture } from "./helpers/playwright-fixture";
@@ -62,8 +63,10 @@ headers:
6263
Cache-Control: no-cache
6364
---
6465
66+
import stylesheetHref from "../app.css"
67+
6568
export const links = () => [
66-
{ rel: "stylesheet", href: "app.css" }
69+
{ rel: "stylesheet", href: stylesheetHref }
6770
]
6871
6972
import { useLoaderData } from '@remix-run/react';
@@ -86,6 +89,13 @@ export function ComponentUsingData() {
8689
"app/routes/basic.mdx": mdx`
8790
# This is some basic markdown!
8891
`.trim(),
92+
93+
"app/app.css": css`
94+
body {
95+
background-color: #eee;
96+
color: #000;
97+
}
98+
`,
8999
},
90100
});
91101
appFixture = await createAppFixture(fixture);
@@ -113,6 +123,8 @@ export function ComponentUsingData() {
113123
expect(await app.getHtml("title")).toMatch("My First Post");
114124
expect(await app.getHtml("#loader")).toMatch(/Mambo Number:.+5/s);
115125
expect(await app.getHtml("#handle")).toMatch("abc");
116-
expect(await app.getHtml('link[rel="stylesheet"]')).toMatch("app.css");
126+
expect(await app.getHtml('link[rel="stylesheet"]')).toMatch(
127+
/app-[\dA-Z]+\.css/
128+
);
117129
});
118130
});

0 commit comments

Comments
 (0)