Skip to content

Commit 8dd168c

Browse files
committed
Add playground action regression coverage
1 parent 3eca2d5 commit 8dd168c

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { readFileSync } from "node:fs";
2+
import { resolve } from "node:path";
3+
import { describe, expect, it } from "vitest";
4+
5+
const root = resolve(import.meta.dirname, "../..");
6+
const playground = readFileSync(resolve(root, "playground/play.html"), "utf8");
7+
const main = readFileSync(resolve(root, "playground/src/main.ts"), "utf8");
8+
9+
describe("playground header actions", () => {
10+
it("keeps both motion formats behind one Export menu", () => {
11+
expect(playground).toContain('id="export-menu-button"');
12+
expect(playground).toContain('aria-haspopup="menu"');
13+
expect(playground).toContain('id="export-menu"');
14+
expect(playground).toContain('id="download-bvh"');
15+
expect(playground).toContain('id="download-gltf"');
16+
expect(playground.match(/>Download BVH</g)).toBeNull();
17+
expect(playground.match(/>Download glTF</g)).toBeNull();
18+
});
19+
20+
it("links the GitHub action to the repository instead of issue creation", () => {
21+
expect(playground).toContain('href="https://github.com/posecode-dev/posecode"');
22+
expect(playground).not.toContain("posecode-dev/posecode/issues/new");
23+
expect(playground).toContain("Open the Posecode repository on GitHub");
24+
});
25+
26+
it("supports dismissal and keyboard navigation for the export menu", () => {
27+
expect(main).toContain("function setExportMenu(open: boolean)");
28+
expect(main).toContain('event.key === "ArrowDown"');
29+
expect(main).toContain('event.key === "ArrowUp"');
30+
expect(main).toContain('e.key === "Escape"');
31+
});
32+
});

0 commit comments

Comments
 (0)