fix: align scale info with floating timeline

This commit is contained in:
2026-08-19 16:45:35 +08:00
parent 45f1ebee7e
commit 3db95c27b5
5 changed files with 65 additions and 15 deletions
@@ -1,6 +1,10 @@
import { describe, expect, it } from "vitest";
import type { ScheduledConditionItem } from "../types";
import { clusterOperationalEvents, createOperationalEvents } from "./operational-timeline-model";
import {
canDockMapScaleBesideTimeline,
clusterOperationalEvents,
createOperationalEvents
} from "./operational-timeline-model";
const workOrder: ScheduledConditionItem = {
id: "work-1", kind: "work_order", code: "WO-1", scheduledAt: "2026-08-19T10:00:00.000Z",
@@ -39,4 +43,10 @@ describe("operational timeline model", () => {
expect(clusters).toHaveLength(2);
expect(clusters.find((cluster) => cluster.lane === "plan")?.events).toHaveLength(2);
});
it("docks scale info beside a floating timeline only when the business area is wide enough", () => {
expect(canDockMapScaleBesideTimeline(2048, "expanded", true)).toBe(true);
expect(canDockMapScaleBesideTimeline(1380, "expanded", true)).toBe(false);
expect(canDockMapScaleBesideTimeline(1380, "expanded", false)).toBe(true);
});
});