-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfonts.spec.ts
More file actions
59 lines (48 loc) · 2.28 KB
/
Copy pathfonts.spec.ts
File metadata and controls
59 lines (48 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { expect } from "@playwright/test";
import { test } from "./_support/fixtures";
import { makeTestFont } from "./_support/font-fixture";
const FAMILY = "PPTypst Test";
test("adds a custom font from an uploaded file", async ({ powerPointPage }) => {
await powerPointPage.openFontsPanel();
await powerPointPage.addFontFiles([
{ name: "PPTypstTest-Regular.ttf", buffer: makeTestFont(FAMILY, "Regular") },
]);
await expect(powerPointPage.fontItems()).toHaveCount(1);
await powerPointPage.expectFontFamilyCount(FAMILY, 1);
await powerPointPage.expectFontStyleListed("Regular");
await powerPointPage.expectStatus(`Added: ${FAMILY} Regular`);
});
test("keeps multiple weights of the same family as separate faces", async ({ powerPointPage }) => {
await powerPointPage.openFontsPanel();
await powerPointPage.addFontFiles([
{ name: "PPTypstTest-Regular.ttf", buffer: makeTestFont(FAMILY, "Regular") },
{ name: "PPTypstTest-Bold.ttf", buffer: makeTestFont(FAMILY, "Bold") },
]);
// Both faces coexist (keyed per family+style) instead of overwriting each other.
await expect(powerPointPage.fontItems()).toHaveCount(2);
await powerPointPage.expectFontFamilyCount(FAMILY, 2);
await powerPointPage.expectFontStyleListed("Regular");
await powerPointPage.expectFontStyleListed("Bold");
});
test("removes a custom font", async ({ powerPointPage }) => {
await powerPointPage.openFontsPanel();
await powerPointPage.addFontFiles([
{ name: "PPTypstTest-Regular.ttf", buffer: makeTestFont(FAMILY, "Regular") },
]);
await expect(powerPointPage.fontItems()).toHaveCount(1);
await powerPointPage.removeFirstFont();
await expect(powerPointPage.fontItems()).toHaveCount(0);
await powerPointPage.expectNoCustomFonts();
});
test("persists custom fonts across a reload", async ({ powerPointPage }) => {
await powerPointPage.openFontsPanel();
await powerPointPage.addFontFiles([
{ name: "PPTypstTest-Regular.ttf", buffer: makeTestFont(FAMILY, "Regular") },
]);
await expect(powerPointPage.fontItems()).toHaveCount(1);
await powerPointPage.reload();
await powerPointPage.openFontsPanel();
// The font was restored from IndexedDB, not re-uploaded.
await expect(powerPointPage.fontItems()).toHaveCount(1);
await powerPointPage.expectFontFamilyCount(FAMILY, 1);
});