fix(webui): enforce localized group copy

This commit is contained in:
Xubin Ren
2026-08-14 19:55:25 +09:00
parent 4266ef2099
commit b378319d4a
15 changed files with 64 additions and 51 deletions
+5 -5
View File
@@ -3099,7 +3099,7 @@ describe("App layout", () => {
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
const alphaTab = await within(sidebar).findByRole("button", { name: "Tab: Alpha tab" });
const alphaTab = await within(sidebar).findByRole("button", { name: "Group: Alpha tab" });
const betaTab = within(sidebar).getByRole("button", { name: "Beta tab" });
expect(alphaTab.compareDocumentPosition(betaTab) & Node.DOCUMENT_POSITION_FOLLOWING)
.toBeTruthy();
@@ -3218,7 +3218,7 @@ describe("App layout", () => {
statusHandlers.forEach((handler) => handler("open"));
});
const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
expect(within(sidebar).queryByRole("button", { name: "Tab: Solo pane" }))
expect(within(sidebar).queryByRole("button", { name: "Group: Solo pane" }))
.not.toBeInTheDocument();
setSidebarStateSpy.mockClear();
@@ -3228,14 +3228,14 @@ describe("App layout", () => {
fireEvent.click(await screen.findByRole("menuitem", { name: "Create group" }));
const tabButton = await within(sidebar).findByRole("button", {
name: "Tab: Solo pane",
name: "Group: Solo pane",
});
const tabGroup = tabButton.closest("[data-sidebar-tab-group]") as HTMLElement;
expect(within(tabGroup).getByRole("list", { name: "Panes in Solo pane" }))
.toBeInTheDocument();
expect(within(tabGroup).getAllByRole("button", { name: "Solo pane" }))
.toHaveLength(1);
expect(within(sidebar).queryByRole("button", { name: "Tab: Other pane" }))
expect(within(sidebar).queryByRole("button", { name: "Group: Other pane" }))
.not.toBeInTheDocument();
await waitFor(() => expect(setSidebarStateSpy).toHaveBeenCalledWith(
expect.objectContaining({
@@ -3312,7 +3312,7 @@ describe("App layout", () => {
render(<App />);
await waitFor(() => expect(connectSpy).toHaveBeenCalled());
const secondSidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
expect(await within(secondSidebar).findByRole("button", { name: "Tab: Solo pane" }))
expect(await within(secondSidebar).findByRole("button", { name: "Group: Solo pane" }))
.toBeInTheDocument();
});
+14 -14
View File
@@ -90,7 +90,7 @@ describe("ChatList", () => {
/>,
);
expect(screen.getByRole("button", { name: "Tab: Root topic" }))
expect(screen.getByRole("button", { name: "Group: Root topic" }))
.toHaveAttribute("draggable", "false");
const pane = screen.getByRole("button", { name: "Research pane" });
expect(pane).toHaveAttribute("draggable", "true");
@@ -209,7 +209,7 @@ describe("ChatList", () => {
/>,
);
expect(screen.queryByRole("button", { name: "Tab: Solo pane" }))
expect(screen.queryByRole("button", { name: "Group: Solo pane" }))
.not.toBeInTheDocument();
expect(screen.getAllByText("Solo pane")).toHaveLength(1);
expect(screen.queryByRole("list", { name: "Panes in Solo pane" }))
@@ -293,10 +293,10 @@ describe("ChatList", () => {
types: [SESSION_DRAG_TYPE],
} as unknown as DataTransfer;
const source = screen.getByRole("button", { name: "Solo topic" });
const targetGroup = screen.getByRole("button", { name: "Tab: Target group" })
const targetGroup = screen.getByRole("button", { name: "Group: Target group" })
.closest("[data-sidebar-tab-group]")!;
const targetSurface = targetGroup.querySelector("[data-workbench-tab-surface]")!;
const fullGroup = screen.getByRole("button", { name: "Tab: Full group" })
const fullGroup = screen.getByRole("button", { name: "Group: Full group" })
.closest("[data-sidebar-tab-group]")!;
const fullSurface = fullGroup.querySelector("[data-workbench-tab-surface]")!;
@@ -367,7 +367,7 @@ describe("ChatList", () => {
types: [SESSION_DRAG_TYPE],
} as unknown as DataTransfer;
const source = screen.getByRole("button", { name: "Research pane" });
const sourceSurface = screen.getByRole("button", { name: "Tab: Root topic" })
const sourceSurface = screen.getByRole("button", { name: "Group: Root topic" })
.closest("[data-workbench-tab-surface]")!;
const standaloneList = document.querySelector("[data-chat-list-content]")!;
@@ -443,7 +443,7 @@ describe("ChatList", () => {
expect(child.closest("[data-sidebar-pane]"))
.toHaveAttribute("data-sidebar-pane", "websocket:child");
expect(child).toHaveAttribute("aria-current", "true");
const targetTabRow = screen.getByRole("button", { name: "Tab: Target tab" })
const targetTabRow = screen.getByRole("button", { name: "Group: Target tab" })
.closest("li")!;
const targetChild = within(targetTabRow).getByRole("button", {
name: "Target research",
@@ -464,7 +464,7 @@ describe("ChatList", () => {
expect(onSelect).not.toHaveBeenCalled();
onSelectPane.mockClear();
const rootTab = screen.getByRole("button", { name: "Tab: Root topic" });
const rootTab = screen.getByRole("button", { name: "Group: Root topic" });
fireEvent.click(rootTab);
expect(onSelectPane).not.toHaveBeenCalled();
expect(onSelect).not.toHaveBeenCalled();
@@ -510,7 +510,7 @@ describe("ChatList", () => {
fireEvent.keyDown(document, { key: "Escape" });
expect(child).toHaveAttribute("draggable", "false");
expect(screen.getByRole("button", { name: "Tab: Target tab" }))
expect(screen.getByRole("button", { name: "Group: Target tab" }))
.toHaveAttribute("draggable", "false");
});
@@ -547,7 +547,7 @@ describe("ChatList", () => {
/>,
);
const tabButton = screen.getByRole("button", { name: "Tab: Root topic" });
const tabButton = screen.getByRole("button", { name: "Group: Root topic" });
const tabGroup = tabButton.closest("[data-sidebar-tab-group]")!;
const tabHeader = tabButton.closest("[data-workbench-tab]")!;
const tabSurface = tabButton.closest("[data-workbench-tab-surface]")!;
@@ -587,7 +587,7 @@ describe("ChatList", () => {
expect(within(tabGroup).getByRole("button", {
name: "Expand panes in Root topic",
})).toHaveAttribute("aria-expanded", "false");
expect(within(tabGroup).getByRole("button", { name: "Tab: Root topic" }))
expect(within(tabGroup).getByRole("button", { name: "Group: Root topic" }))
.not.toHaveAttribute("aria-current");
fireEvent.click(within(tabGroup).getByRole("button", {
@@ -634,8 +634,8 @@ describe("ChatList", () => {
fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));
expect(screen.getByText("1 selected")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Tab: Root topic" }));
expect(screen.getByRole("button", { name: "Tab: Root topic" }))
fireEvent.click(screen.getByRole("button", { name: "Group: Root topic" }));
expect(screen.getByRole("button", { name: "Group: Root topic" }))
.toHaveAttribute("aria-pressed", "true");
expect(screen.getByRole("button", { name: "Root topic" }))
.toHaveAttribute("aria-pressed", "true");
@@ -942,12 +942,12 @@ describe("ChatList", () => {
};
const firstRender = render(<ChatList {...props} />);
fireEvent.click(screen.getByRole("button", { name: "Tab: Root topic" }));
fireEvent.click(screen.getByRole("button", { name: "Group: Root topic" }));
expect(screen.queryByRole("button", { name: "Research pane" })).not.toBeInTheDocument();
firstRender.unmount();
render(<ChatList {...props} />);
expect(screen.getByRole("button", { name: "Tab: Root topic" }))
expect(screen.getByRole("button", { name: "Group: Root topic" }))
.toHaveAttribute("aria-expanded", "false");
expect(screen.queryByRole("button", { name: "Research pane" })).not.toBeInTheDocument();
});
+28
View File
@@ -269,6 +269,22 @@ const LOCALIZED_NEW_SURFACE_KEYS = [
"chat.groups.yesterday",
"chat.groups.earlier",
"chat.groups.archived",
"workbench.tabAria",
"workbench.panesInTab",
"workbench.collapseTabGroup",
"workbench.expandTabGroup",
"workbench.dropPane",
"workbench.createGroup",
"workbench.moveTo",
"workbench.renameGroupTitle",
"workbench.renameGroupDescription",
"workbench.renameGroupPlaceholder",
"workbench.dissolveTab",
"workbench.deleteConversations",
"workbench.paneLimit",
"workbench.paneActions",
"workbench.detachPane",
"workbench.composerAria",
"thread.promptNavigator.railAria",
"thread.composer.mentions.cliTitle",
"thread.composer.mentions.mcpTitle",
@@ -582,6 +598,18 @@ describe("webui i18n", () => {
expect(settings.skills.marketplaceTrendingTitle).toBe("各市场热门技能");
});
it("keeps the Simplified Chinese group workflow localized", () => {
const workbench = resources["zh-CN"].common.workbench;
expect(workbench.tabAria).toBe("分组:{{title}}");
expect(workbench.createGroup).toBe("创建分组");
expect(workbench.renameGroupTitle).toBe("重命名分组");
expect(workbench.renameGroupDescription).toBe("为这个分组命名。");
expect(workbench.renameGroupPlaceholder).toBe("分组名称");
expect(workbench.moveTo).toBe("移动到");
expect(workbench.detachPane).toBe("移出");
});
it("keeps Indonesian and Vietnamese settings free of copied Spanish help text", () => {
const spanish = flattenResource(resources.es.common);