feat: chat — les posts affichent le markdown rendu comme un document, code coloré #193
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user