comparison 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
comparison
equal deleted inserted replaced
149:5e76bad44a81 150:3ce355e4f388
1 import { describe, expect, it } from "vitest";
2 import { addFontToRootPage } from "./style";
3
4 describe("addFontToRootPage", () => {
5 it("adds a style block", () => {
6 addFontToRootPage();
7 const el = document.head.children[0] as HTMLElement;
8 expect(el.innerText).toContain("@font-face");
9 });
10 it("is idempotent", () => {
11 addFontToRootPage();
12 addFontToRootPage();
13 expect(document.head.children.length).toBe(1);
14 });
15 });