test: trim remaining ui browser cases

This commit is contained in:
Peter Steinberger
2026-04-17 19:11:58 +01:00
parent d155d578eb
commit c47c4b3574
2 changed files with 12 additions and 13 deletions

View File

@@ -424,8 +424,10 @@ describe("toSanitizedMarkdownHtml", () => {
describe("ReDoS protection", () => {
it("does not throw on deeply nested emphasis markers (#36213)", () => {
const nested = "*".repeat(500) + "text" + "*".repeat(500);
expect(() => toSanitizedMarkdownHtml(nested)).not.toThrow();
const html = toSanitizedMarkdownHtml(nested);
let html = "";
expect(() => {
html = toSanitizedMarkdownHtml(nested);
}).not.toThrow();
expect(html).toContain("text");
});
@@ -467,7 +469,7 @@ describe("toSanitizedMarkdownHtml", () => {
it("uses plain text fallback for oversized content", () => {
// MARKDOWN_PARSE_LIMIT is 40_000 chars
const input = Array.from(
{ length: 320 },
{ length: 220 },
(_, i) => `Paragraph ${i + 1}: ${"Long plain-text reply. ".repeat(8)}`,
).join("\n\n");
const html = toSanitizedMarkdownHtml(input);
@@ -475,7 +477,7 @@ describe("toSanitizedMarkdownHtml", () => {
});
it("preserves indentation in plain text fallback", () => {
const input = `${"Header line\n".repeat(5000)}\n indented log line\n deeper indent`;
const input = `${"Header line\n".repeat(3400)}\n indented log line\n deeper indent`;
const html = toSanitizedMarkdownHtml(input);
expect(html).toContain('class="markdown-plain-text-fallback"');
expect(html).toContain(" indented log line");

View File

@@ -173,7 +173,7 @@ describe("control UI routing", () => {
expect(header.querySelector(".nav-collapse-toggle")).not.toBeNull();
});
it("preserves the active session when opening chat from sidebar navigation", async () => {
it("preserves session navigation and keeps focus mode scoped to chat", async () => {
const app = mountApp("/sessions?session=agent:main:subagent:task-123");
await app.updateComplete;
@@ -186,11 +186,6 @@ describe("control UI routing", () => {
expect(app.sessionKey).toBe("agent:main:subagent:task-123");
expect(window.location.pathname).toBe("/chat");
expect(window.location.search).toBe("?session=agent%3Amain%3Asubagent%3Atask-123");
});
it("keeps focus mode scoped to the chat tab", async () => {
const app = mountApp("/chat");
await app.updateComplete;
const shell = app.querySelector(".shell");
expect(shell).not.toBeNull();
@@ -203,9 +198,11 @@ describe("control UI routing", () => {
await app.updateComplete;
expect(shell?.classList.contains("shell--chat-focus")).toBe(true);
const link = app.querySelector<HTMLAnchorElement>('a.nav-item[href="/channels"]');
expect(link).not.toBeNull();
link?.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true, button: 0 }));
const channelsLink = app.querySelector<HTMLAnchorElement>('a.nav-item[href="/channels"]');
expect(channelsLink).not.toBeNull();
channelsLink?.dispatchEvent(
new MouseEvent("click", { bubbles: true, cancelable: true, button: 0 }),
);
await app.updateComplete;
expect(app.tab).toBe("channels");