Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn committed Oct 25, 2023
1 parent 6e1fd51 commit 1a30d73
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/generate.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createGenerator, presetUno } from "unocss";
import { describe, expect, it } from "vitest";
import { presetPalette } from "../src";
describe("generate test", () => {
it("generate prelights", async () => {
const uno = createGenerator({
presets: [
presetPalette({
themeColors: {
primary: "rgb(255,0,0)"
}
})
]
});
const { css } = await uno.generate("bg-primary");
expect(css).toMatchInlineSnapshot(`
"/* layer: palette */
:root{--un-platte-primary-color-rgb:255 0 0;--un-platte-primary-color:rgb(var(--un-platte-primary-color-rgb));}"
`);
});

it("generate", async () => {
const uno = createGenerator({
presets: [
presetPalette({
themeColors: {
primary: "rgb(255,0,0)"
}
}),
presetUno()
]
});
const { css } = await uno.generate("bg-primary", {
preflights: false
});
expect(css).toMatchInlineSnapshot(`
"/* layer: default */
.bg-primary{--un-bg-opacity:1;background-color:rgb(var(--un-platte-primary-color-rgb) / var(--un-bg-opacity));}"
`);
});
});

0 comments on commit 1a30d73

Please sign in to comment.