mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-11 09:51:40 +00:00
* feat: chart color * fix * fix * fix: chart color * chore: changeset * chore: restore directory registry formatting * feat: add fontHeading * feat: rebuild registry * fix: v0 * refactor * fix * fix * fix * fix * fix * fix: refactor preset handling * fix * fix * fix
35 lines
909 B
TypeScript
35 lines
909 B
TypeScript
import { describe, expect, it } from "vitest"
|
|
|
|
import { resolvePresetOverrides } from "./preset-query"
|
|
|
|
describe("resolvePresetOverrides", () => {
|
|
it("prefers explicit fontHeading and chartColor query params", () => {
|
|
const overrides = resolvePresetOverrides(
|
|
new URLSearchParams("fontHeading=playfair-display&chartColor=emerald"),
|
|
{
|
|
theme: "neutral",
|
|
chartColor: "blue",
|
|
fontHeading: "inherit",
|
|
}
|
|
)
|
|
|
|
expect(overrides).toEqual({
|
|
fontHeading: "playfair-display",
|
|
chartColor: "emerald",
|
|
})
|
|
})
|
|
|
|
it("falls back to decoded preset values when no overrides are present", () => {
|
|
const overrides = resolvePresetOverrides(new URLSearchParams(), {
|
|
theme: "neutral",
|
|
chartColor: "blue",
|
|
fontHeading: "inherit",
|
|
})
|
|
|
|
expect(overrides).toEqual({
|
|
fontHeading: "inherit",
|
|
chartColor: "blue",
|
|
})
|
|
})
|
|
})
|