-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
postcss.test.ts
67 lines (49 loc) · 1.23 KB
/
postcss.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { assertSiteSnapshot, build, getSite } from "./utils.ts";
import { assert } from "../deps/assert.ts";
import postcss from "../plugins/postcss.ts";
import nano from "npm:cssnano";
Deno.test("postcss plugin", async (t) => {
const site = getSite({
src: "postcss",
});
site.use(postcss());
await build(site);
await assertSiteSnapshot(t, site);
});
Deno.test("postcss plugin without includes", async (t) => {
const site = getSite({
src: "postcss",
});
site.use(postcss({
includes: false,
}));
await build(site);
await assertSiteSnapshot(t, site);
});
Deno.test("postcss plugin with hooks", async (t) => {
const site = getSite({
src: "postcss",
});
site.use(postcss());
site.hooks.addPostcssPlugin(nano());
await build(site);
await assertSiteSnapshot(t, site);
});
Deno.test("postcss plugin with default name", () => {
const site = getSite({
src: "postcss",
});
site.use(postcss());
const { helpers } = site.renderer;
assert(helpers.has("postcss"));
});
Deno.test("postcss plugin with custom name", () => {
const site = getSite({
src: "postcss",
});
site.use(postcss({
name: "css",
}));
const { helpers } = site.renderer;
assert(helpers.has("css"));
});