-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Expand file tree
/
Copy paththeme.test.ts
More file actions
64 lines (58 loc) · 1.81 KB
/
Copy paththeme.test.ts
File metadata and controls
64 lines (58 loc) · 1.81 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
60
61
62
63
64
import { describe, expect, test } from "bun:test";
import {
getTimelineElementClassName,
getTimelineElementClassNameForElement,
TIMELINE_ELEMENT_THEME,
TIMELINE_TRACK_THEME,
} from "../theme";
describe("getTimelineElementClassName", () => {
test("returns the configured class for each track type", () => {
expect(getTimelineElementClassName({ type: "audio" })).toBe(
TIMELINE_TRACK_THEME.audio.elementClassName.trim(),
);
expect(getTimelineElementClassName({ type: "text" })).toBe(
TIMELINE_TRACK_THEME.text.elementClassName.trim(),
);
});
});
describe("getTimelineElementClassNameForElement", () => {
test("uses the element-level theme when one is defined", () => {
expect(
getTimelineElementClassNameForElement({
elementType: "video",
trackType: "video",
}),
).toBe(TIMELINE_ELEMENT_THEME.video?.elementClassName.trim());
});
test("distinguishes video and image even though they share the video track", () => {
const videoClass = getTimelineElementClassNameForElement({
elementType: "video",
trackType: "video",
});
const imageClass = getTimelineElementClassNameForElement({
elementType: "image",
trackType: "video",
});
expect(videoClass).not.toBe(imageClass);
});
test("falls back to the track-level theme when an element type has no override", () => {
expect(
getTimelineElementClassNameForElement({
elementType: "audio",
trackType: "audio",
}),
).toBe(TIMELINE_TRACK_THEME.audio.elementClassName.trim());
expect(
getTimelineElementClassNameForElement({
elementType: "text",
trackType: "text",
}),
).toBe(TIMELINE_TRACK_THEME.text.elementClassName.trim());
expect(
getTimelineElementClassNameForElement({
elementType: "sticker",
trackType: "graphic",
}),
).toBe(TIMELINE_TRACK_THEME.graphic.elementClassName.trim());
});
});