theme redux
This commit is contained in:
71
src/utils/theme.test.ts
Normal file
71
src/utils/theme.test.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import { describe, expect, it } from "bun:test"
|
||||
import { ansiToRgba } from "./ansi-to-rgba"
|
||||
import { resolveTheme } from "./theme-resolver"
|
||||
import type { ThemeJson } from "../types/theme-schema"
|
||||
|
||||
describe("theme utils", () => {
|
||||
it("converts ansi codes", () => {
|
||||
const color = ansiToRgba(1)
|
||||
expect(color).toBeTruthy()
|
||||
})
|
||||
|
||||
it("resolves simple theme", () => {
|
||||
const json: ThemeJson = {
|
||||
theme: {
|
||||
primary: "#ffffff",
|
||||
secondary: "#000000",
|
||||
accent: "#000000",
|
||||
error: "#000000",
|
||||
warning: "#000000",
|
||||
success: "#000000",
|
||||
info: "#000000",
|
||||
text: "#000000",
|
||||
textMuted: "#000000",
|
||||
background: "#000000",
|
||||
backgroundPanel: "#000000",
|
||||
backgroundElement: "#000000",
|
||||
border: "#000000",
|
||||
borderActive: "#000000",
|
||||
borderSubtle: "#000000",
|
||||
diffAdded: "#000000",
|
||||
diffRemoved: "#000000",
|
||||
diffContext: "#000000",
|
||||
diffHunkHeader: "#000000",
|
||||
diffHighlightAdded: "#000000",
|
||||
diffHighlightRemoved: "#000000",
|
||||
diffAddedBg: "#000000",
|
||||
diffRemovedBg: "#000000",
|
||||
diffContextBg: "#000000",
|
||||
diffLineNumber: "#000000",
|
||||
diffAddedLineNumberBg: "#000000",
|
||||
diffRemovedLineNumberBg: "#000000",
|
||||
markdownText: "#000000",
|
||||
markdownHeading: "#000000",
|
||||
markdownLink: "#000000",
|
||||
markdownLinkText: "#000000",
|
||||
markdownCode: "#000000",
|
||||
markdownBlockQuote: "#000000",
|
||||
markdownEmph: "#000000",
|
||||
markdownStrong: "#000000",
|
||||
markdownHorizontalRule: "#000000",
|
||||
markdownListItem: "#000000",
|
||||
markdownListEnumeration: "#000000",
|
||||
markdownImage: "#000000",
|
||||
markdownImageText: "#000000",
|
||||
markdownCodeBlock: "#000000",
|
||||
syntaxComment: "#000000",
|
||||
syntaxKeyword: "#000000",
|
||||
syntaxFunction: "#000000",
|
||||
syntaxVariable: "#000000",
|
||||
syntaxString: "#000000",
|
||||
syntaxNumber: "#000000",
|
||||
syntaxType: "#000000",
|
||||
syntaxOperator: "#000000",
|
||||
syntaxPunctuation: "#000000",
|
||||
},
|
||||
}
|
||||
|
||||
const resolved = resolveTheme(json, "dark") as unknown as { primary: unknown }
|
||||
expect(resolved.primary).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user