Smooth WebUI streaming with state-driven viewport motion (#4696)

This commit is contained in:
chengyongru
2026-07-26 00:18:24 +08:00
committed by GitHub
parent 9a7debcb48
commit b0ef759e2c
28 changed files with 3202 additions and 670 deletions
+34 -1
View File
@@ -1,7 +1,12 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { setAppLanguage } from "@/i18n";
import { fmtDateTime, formatTurnLatency, relativeTime } from "@/lib/format";
import {
fmtDateTime,
formatMessageEndTime,
formatTurnLatency,
relativeTime,
} from "@/lib/format";
describe("localized format helpers", () => {
beforeEach(() => {
@@ -62,6 +67,34 @@ describe("localized format helpers", () => {
expect(english).not.toBe(french);
});
it("shows only the local clock time for messages completed today", async () => {
const value = Date.parse("2026-04-18T08:34:56Z");
const date = new Date(value);
await setAppLanguage("zh-CN");
expect(formatMessageEndTime(value)).toBe(
new Intl.DateTimeFormat("zh-CN", {
hour: "2-digit",
minute: "2-digit",
}).format(date),
);
});
it("adds the local date for messages completed before today", async () => {
const value = Date.parse("2026-04-16T08:34:56Z");
const date = new Date(value);
await setAppLanguage("zh-CN");
expect(formatMessageEndTime(value)).toBe(
new Intl.DateTimeFormat("zh-CN", {
dateStyle: "medium",
timeStyle: "short",
}).format(date),
);
});
it("formats turn latency with locale-aware units", async () => {
await setAppLanguage("en");
const subMinute = formatTurnLatency(2400, "en");