feat(web): add lightweight workspace matching existing UI

This commit is contained in:
2026-11-11 16:59:09 -08:00
parent bc92651509
commit b7fdf7a89c
37 changed files with 2415 additions and 291 deletions
+29
View File
@@ -0,0 +1,29 @@
import assert from "node:assert/strict";
import test from "node:test";
import { marked } from "marked";
import { installLiteCompatibility } from "../src/lib/lite-compat.ts";
test("Markdown still renders on readers without native Array.at", () => {
const original = Object.getOwnPropertyDescriptor(Array.prototype, "at");
try {
delete Array.prototype.at;
installLiteCompatibility();
assert.equal([1, 2, 3].at(-1), 3);
assert.equal([1, 2, 3].at(-4), undefined);
assert.equal([1, 2, 3].at(Infinity), undefined);
assert.equal(Object.getOwnPropertyDescriptor(Array.prototype, "at").enumerable, false);
const html = marked("## A reply\n\nFirst paragraph.\n\nSecond paragraph.\n\n| Name | Value |\n| --- | --- |\n| One | Two |");
assert.match(html, /<h2>A reply<\/h2>/);
assert.match(html, /<table>/);
assert.match(html, /<td>Two<\/td>/);
} finally {
if (original) Object.defineProperty(Array.prototype, "at", original);
else delete Array.prototype.at;
}
});
test("Lite keeps the browser's existing Array.at implementation", () => {
const original = Array.prototype.at;
installLiteCompatibility();
assert.equal(Array.prototype.at, original);
});