Files
piik/tests/service-transit-ui.test.ts
T
AAA f730e84bc8 fix(ui): keep room controls usable through layout changes
The shared room sweep fixes narrow stage sizing, caption overlap, covered chat reads, phone history, focus restoration, settings error placement and row alignment at their existing owners. Room and Network settings share one draft and save action. The two shell stylesheets are consolidated; hidden current-room links and obsolete grid rules are removed. The handbook, matching guides and four generated room screenshots follow the shared components.

Chrome 156 interaction checks covered both themes, 320px phones, short windows, classic scrollbars, native-caption simulation, eight retained players, nested Back/Escape and room-tool popout. Full Web validation passed 2485 cases and exposed one assertion on removed hidden local-preview text; the preview identity now lives in the player accessible label and all 15 affected playback/layout checks pass. TypeScript and Browser SDK types pass. Actual WebView caption dragging and physical mobile capture are outside this browser check.
2026-11-26 18:57:48 -05:00

24 lines
1.3 KiB
TypeScript

import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { afterEach, expect, test } from "vitest";
import { ServiceTransit } from "../src/client/channel/components/ChannelRoomControls";
import type { ChannelRoom } from "../src/client/channel/protocol";
import { setCopy } from "../src/client/ui/copy";
afterEach(() => setCopy({ lang: "en" }));
test.each(["zh", "en"] as const)("service permission reflects the manager's confirmed preference (%s)", lang => {
setCopy({ lang });
const room = { id: "room", available: true, canManage: true, authorized: true } as ChannelRoom;
const render = (overrides: Partial<ChannelRoom>) => renderToStaticMarkup(createElement(ServiceTransit, {
room: { ...room, ...overrides }, disabled: false, onChange() {},
}));
expect(render({})).toBe("");
const standby = { enabled: true, available: false };
expect(render({ serviceRelay: standby, canManage: false })).toBe("");
expect(render({ serviceRelay: standby })).toContain('aria-checked="true"');
expect(render({ serviceRelay: standby })).toContain('role="status"');
const available = render({ serviceRelay: { enabled: false, available: true } });
expect(available).toContain('aria-checked="false"');
expect(available).not.toContain('role="status"');
});