|
1 | 1 | import { ProjectId, type PullRequestSummary, type VcsStatusResult } from "@t3tools/contracts"; |
2 | 2 | import { describe, expect, it } from "@effect/vitest"; |
| 3 | +import type { AnimationEvent } from "react"; |
3 | 4 |
|
4 | 5 | import { |
5 | 6 | ChangeRequestStatusIcon, |
6 | 7 | prStatusIndicator, |
7 | 8 | resolveThreadPullRequestBadgePresentation, |
| 9 | + synchronizeTerminalPulse, |
8 | 10 | } from "./ThreadStatusIndicators"; |
9 | 11 | import { newestPullRequestSummary } from "../state/pullRequests"; |
10 | 12 | import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons"; |
11 | 13 |
|
| 14 | +describe("synchronizeTerminalPulse", () => { |
| 15 | + it("pins only the status pulse to the document clock", () => { |
| 16 | + const pulse = { animationName: "status-pulse", startTime: 975 } as CSSAnimation; |
| 17 | + const otherCss = { animationName: "other-animation", startTime: 125 } as CSSAnimation; |
| 18 | + const otherAnimation = { startTime: 250 } as Animation; |
| 19 | + |
| 20 | + synchronizeTerminalPulse({ |
| 21 | + animationName: "status-pulse", |
| 22 | + currentTarget: { getAnimations: () => [pulse, otherCss, otherAnimation] }, |
| 23 | + } as AnimationEvent<SVGSVGElement>); |
| 24 | + |
| 25 | + expect([pulse.startTime, otherCss.startTime, otherAnimation.startTime]).toEqual([0, 125, 250]); |
| 26 | + }); |
| 27 | +}); |
| 28 | + |
12 | 29 | describe("ChangeRequestStatusIcon", () => { |
13 | 30 | it.each([ |
14 | 31 | ["open", "open", false, PullRequestGlyph.pullRequest], |
|
0 commit comments