reformat + add testing utils, test dev plugin fully
This commit is contained in:
parent
0259a96937
commit
4d8a9dff8e
15 changed files with 242 additions and 158 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { expect, test } from "bun:test";
|
||||
import PostCSS from "../postcss";
|
||||
|
||||
// Dummy PostCSS plugin that uppercases all CSS
|
||||
function uppercasePlugin() {
|
||||
return {
|
||||
postcssPlugin: "uppercase",
|
||||
|
|
@ -10,7 +9,7 @@ function uppercasePlugin() {
|
|||
decl.value = decl.value.toUpperCase();
|
||||
decl.prop = decl.prop.toUpperCase();
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
uppercasePlugin.postcss = true;
|
||||
|
|
@ -30,7 +29,6 @@ test("PostCSS returns unchanged CSS if no plugins", async () => {
|
|||
});
|
||||
|
||||
test("PostCSS handles multiple plugins", async () => {
|
||||
// Plugin to replace 'red' with 'green'
|
||||
function replaceRedPlugin() {
|
||||
return {
|
||||
postcssPlugin: "replace-red",
|
||||
|
|
@ -38,7 +36,7 @@ test("PostCSS handles multiple plugins", async () => {
|
|||
root.walkDecls((decl: any) => {
|
||||
decl.value = decl.value.replace(/red/g, "green");
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
replaceRedPlugin.postcss = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue