feat(remote-control): 优化 Web 展示、状态同步与桥接控制流程 (#288)

Co-authored-by: chengzifeng <chengzifeng@meituan.com>
This commit is contained in:
Cheng Zi Feng
2026-04-17 16:21:27 +08:00
committed by GitHub
parent b5c299f5d2
commit 72a2093cd6
64 changed files with 4138 additions and 312 deletions

View File

@@ -0,0 +1,36 @@
import { describe, expect, test } from "bun:test";
import { formatPlanContent } from "./render.js";
describe("formatPlanContent", () => {
test("renders headings, paragraphs, and lists for plan panels", () => {
const html = formatPlanContent(`## Summary
Line one
Line two
- First item
- Second item
1. Step one
2. Step two`);
expect(html).toContain("<h2>Summary</h2>");
expect(html).toContain("<p>Line one<br>Line two</p>");
expect(html).toContain("<ul><li>First item</li><li>Second item</li></ul>");
expect(html).toContain("<ol><li>Step one</li><li>Step two</li></ol>");
});
test("escapes unsafe markup and preserves inline formatting plus code blocks", () => {
const html = formatPlanContent(`**Bold** with \`inline\` and <script>alert(1)</script>
\`\`\`js
const markup = "<div>";
\`\`\``);
expect(html).toContain("<strong>Bold</strong>");
expect(html).toContain("<code");
expect(html).toContain("inline</code>");
expect(html).toContain("&lt;script&gt;alert(1)&lt;/script&gt;");
expect(html).toContain("<pre><code>const markup = &quot;&lt;div&gt;&quot;;</code></pre>");
});
});