惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
月光博客
月光博客
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
Vercel News
Vercel News
量子位
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
腾讯CDC
有赞技术团队
有赞技术团队

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(ui): guard chat composer controls · openclaw/opencla...
vincentkoc · 2026-06-01 · via Recent Commits to openclaw:main

@@ -2,6 +2,7 @@

2233

import { html, render } from "lit";

44

import { beforeEach, describe, expect, it, vi } from "vitest";

5+

import { i18n } from "../i18n/index.ts";

56

import type { AppViewState } from "./app-view-state.ts";

67

import type { ChatProps } from "./views/chat.ts";

78

import type { QuickSettingsProps } from "./views/config-quick.ts";

@@ -13,6 +14,7 @@ const chatProps = vi.hoisted(() => ({

1314

current: null as ChatProps | null,

1415

}));

1516

const localStorageValues = vi.hoisted(() => new Map<string, string>());

17+

const renderChatControlsMock = vi.hoisted(() => vi.fn(() => "chat-controls"));

16181719

vi.mock("../local-storage.ts", () => ({

1820

getSafeLocalStorage: () => ({

@@ -33,10 +35,18 @@ vi.mock("./views/config-quick.ts", () => ({

3335

vi.mock("./views/chat.ts", () => ({

3436

renderChat: (props: ChatProps) => {

3537

chatProps.current = props;

36-

return html`<div data-testid="chat"></div>`;

38+

return html`<div data-testid="chat">${props.composerControls}</div>`;

3739

},

3840

}));

394142+

vi.mock("./app-render.helpers.ts", async (importOriginal) => {

43+

const actual = await importOriginal<typeof import("./app-render.helpers.ts")>();

44+

return {

45+

...actual,

46+

renderChatControls: renderChatControlsMock,

47+

};

48+

});

49+4050

vi.mock("./icons.ts", () => ({

4151

icons: {},

4252

}));

@@ -218,10 +228,12 @@ function createState(overrides: Partial<AppViewState> = {}): AppViewState {

218228

} as unknown as AppViewState;

219229

}

220230221-

beforeEach(() => {

231+

beforeEach(async () => {

232+

await i18n.setLocale("en");

222233

localStorageValues.clear();

223234

quickSettingsProps.current = null;

224235

chatProps.current = null;

236+

renderChatControlsMock.mockClear();

225237

});

226238227239

describe("renderApp assistant avatar routing", () => {

@@ -332,6 +344,35 @@ describe("renderApp assistant avatar routing", () => {

332344

expect(chatProps.current?.error).toBe("gateway disconnected");

333345

});

334346347+

it("does not rebuild chat composer controls for draft-only rerenders", () => {

348+

const container = document.createElement("div");

349+

const state = createState({ tab: "chat", chatMessage: "" });

350+351+

render(renderApp(state), container);

352+

state.chatMessage = "h";

353+

render(renderApp(state), container);

354+

state.chatMessage = "hello";

355+

render(renderApp(state), container);

356+357+

expect(renderChatControlsMock).toHaveBeenCalledTimes(1);

358+359+

state.chatSending = true;

360+

render(renderApp(state), container);

361+362+

expect(renderChatControlsMock).toHaveBeenCalledTimes(2);

363+

});

364+365+

it("rebuilds chat composer controls after locale changes", async () => {

366+

const container = document.createElement("div");

367+

const state = createState({ tab: "chat", chatMessage: "" });

368+369+

render(renderApp(state), container);

370+

await i18n.setLocale("zh-CN");

371+

render(renderApp(state), container);

372+373+

expect(renderChatControlsMock).toHaveBeenCalledTimes(2);

374+

});

375+335376

it("passes security quick setting fields to Quick Settings", () => {

336377

const state = createState({

337378

configForm: {