Lines 49-89javascript
49 assert.match(js, /interactState\.queue/);
50 assert.match(css, /\.interact-card \{/);
53test("streaming conversations expose reading and recovery controls", () => {
54 assert.match(html, /id="jump-latest"/);
55 assert.match(js, /function showRetry/);
56 assert.match(js, /function enhanceContent/);
57 assert.match(css, /\.approval \{ position: sticky/);
60test("chat rendering supports rich markdown and highlighted code", () => {
61 assert.match(js, /function safeHref/);
62 assert.match(js, /function highlightCode/);
63 assert.match(js, /data-language=/);
64 assert.match(js, /class="task-item"/);
65 assert.match(js, /loading="lazy"/);
66 assert.match(css, /\.tok-keyword/);
67 assert.match(css, /\.code-language/);
68 assert.match(css, /\.prose \.task-item/);
70 const rendered = markdownContext.render("- [x] done\n\n~~old~~ and [safe](https://example.com)\n\n```js\nconst n = 42; // note\n```");
71 assert.match(rendered, /class="task-item"/);
MediumUnsafe Vm Context
Package source executes code through a VM context API.
webui/tests/ux.test.mjsView on unpkg · L69 72 assert.match(rendered, /<del>old<\/del>/);
73 assert.match(rendered, /tok-keyword/);
74 assert.match(rendered, /tok-number/);
75 assert.match(rendered, /tok-comment/);
76 assert.match(rendered, /data-language="js"/);
77 assert.equal(markdownContext.render("[bad](javascript:alert(1))").includes('href="javascript:'), false);
78 assert.equal(markdownContext.render("first\nsecond"), "<p>first<br/>second</p>");
79 assert.equal(markdownContext.render("first<br>second<br />third"), "<p>first<br/>second<br/>third</p>");
80 assert.equal(markdownContext.render("`<br>`"), "<p><code><br></code></p>");
81 assert.match(markdownContext.render("<script>alert(1)</script>"), /<script>/);
84test("thinking states are simple, animated, and motion-safe", () => {
85 assert.match(js, /thinking-spinner/);
86 assert.match(js, /setAttribute\("aria-label", "Thinking"\)/);
87 assert.match(js, /<span>Thinking…<\/span>/);
88 assert.match(js, /\^thinking\(\?:/);
89 assert.doesNotMatch(js, /thinkingTimer/);