Mercurial > code > home > repos > streamed-graph
diff src/style.test.ts @ 150:3ce355e4f388 default tip
bye jest; hi vitest. new working test for styles.ts
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 17:27:44 -0700 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/style.test.ts Mon May 08 17:27:44 2023 -0700 @@ -0,0 +1,15 @@ +import { describe, expect, it } from "vitest"; +import { addFontToRootPage } from "./style"; + +describe("addFontToRootPage", () => { + it("adds a style block", () => { + addFontToRootPage(); + const el = document.head.children[0] as HTMLElement; + expect(el.innerText).toContain("@font-face"); + }); + it("is idempotent", () => { + addFontToRootPage(); + addFontToRootPage(); + expect(document.head.children.length).toBe(1); + }); +});