feat: chat — les posts affichent le markdown rendu comme un document, code coloré #193
CI / lint (push) Successful in 2m50s
CI / security (push) Successful in 1m37s
CI / test (push) Successful in 4m34s
CI / build (push) Successful in 1m31s
CI / e2e (push) Successful in 17m36s

This commit is contained in:
2026-10-09 15:48:04 -04:00
parent 4fb7c43e06
commit f4c8504c8d
17 changed files with 308 additions and 19 deletions
+24
View File
@@ -433,6 +433,30 @@ test("#110 — notification OS quand l'app est en arrière-plan", () => {
}
});
// --- #193 : un post est rendu comme un document (markdown + code coloré) -----
test("#193 — post avec html rendu : markdown + bloc de code", () => {
const list = document.createElement("div");
renderChatMessages(list, [{
id: "md1", user: "alice", text: "**gras**\n\n```python\nprint(1)\n```", ts: 400,
html: '<p><strong>gras</strong></p><pre><code class="language-python">print(1)</code></pre>',
}], "bruno");
const body = list.querySelector("[data-id='md1'] .file-chat-body");
assert.ok(body.classList.contains("file-chat-md"), "classe md posée sur le corps");
assert.ok(body.querySelector(".md-content"), "conteneur md-content");
assert.ok(body.querySelector(".md-content strong"), "markdown rendu (strong)");
assert.ok(body.querySelector("pre code.language-python"), "bloc de code conservé");
});
test("#193 — sans html, repli texte brut + URL cliquable", () => {
const list = document.createElement("div");
renderChatMessages(list, [{ id: "md2", user: "alice", text: "voir https://ex.com/a", ts: 401 }], "bruno");
const body = list.querySelector("[data-id='md2'] .file-chat-body");
assert.ok(!body.classList.contains("file-chat-md"), "pas de rendu markdown");
assert.ok(body.querySelector("a.file-chat-link"), "URL toujours cliquable");
assert.strictEqual(body.textContent, "voir https://ex.com/a", "texte intact");
});
// Sequential execution: each case depends on panel state left by the previous.
for (const [name, fn] of cases) {
try {