From 1a30d7301998cd6d5a7e0c5989e9656d601fce45 Mon Sep 17 00:00:00 2001 From: chizukicn Date: Wed, 25 Oct 2023 11:18:09 +0800 Subject: [PATCH] chore: update test --- test/generate.test.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/generate.test.ts diff --git a/test/generate.test.ts b/test/generate.test.ts new file mode 100644 index 0000000..1ebf81f --- /dev/null +++ b/test/generate.test.ts @@ -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));}" + `); + }); +});