feat: filtre de recherche dans la sidebar Historique IA (#98) + menus '@' et '/' depuis le menu '+' (BUG-048)
CI / lint (push) Successful in 1m28s
CI / security (push) Successful in 58s
CI / test (push) Successful in 2m19s
CI / build (push) Successful in 54s
CI / e2e (push) Successful in 10m44s

This commit is contained in:
2026-09-16 16:11:54 -04:00
parent c9e3240ae2
commit 8e2b6203a1
19 changed files with 376 additions and 18 deletions
+90
View File
@@ -1802,6 +1802,96 @@ async function main() {
assert.equal(AuthManager.getToken(), null, "session cleared");
});
// ── BUG-048: the "+" panel menus must stay open (contexts @ / skills /) ──
await test("ext menu opens the @ mention menu and keeps it visible", async () => {
localStorage.clear();
const stateMod = await import(pathToFileURL(path.join(JS_DIR, "state.js")).href);
const prevVaults = stateMod.state.allVaults;
stateMod.state.allVaults = [{ name: "V" }];
globalThis.fetch = async (url) => {
const u = String(url);
if (u.includes("/api/ai/skills")) {
return {
ok: true, status: 200,
json: async () => ({
skills: [{ id: "research", label: "Recherche", type: "skill", description: "d" }],
commands: [],
}),
};
}
if (u.includes("/paths")) {
return {
ok: true, status: 200,
json: async () => ({ vault: "V", count: 1, results: [
{ vault: "V", path: "notes/a.md", name: "a.md", type: "file" },
] }),
};
}
return { ok: true, status: 200, json: async () => ({}) };
};
const b = new BooksLM();
b._panel = b._render();
document.body.appendChild(b._panel);
const ta = b._panel.querySelector("textarea");
ta.value = ta.selectionStart = ta.selectionEnd = 0;
b._toggleExtMenu();
const mentionMenu = b._panel.querySelector(".bookslm-mention-menu");
const contextBtn = b._panel.querySelector('.bookslm-ext-item[data-ext-id="context"]');
assert.ok(contextBtn, "Contextes entry present in the + panel");
contextBtn.click();
await sleep(20);
assert.ok(!mentionMenu.classList.contains("hidden"),
"mention menu stays open after picking Contextes (BUG-048)");
assert.ok(mentionMenu.querySelectorAll(".bookslm-menu-item").length >= 1,
"mention menu lists entries");
b._panel.remove();
localStorage.clear();
stateMod.state.allVaults = prevVaults;
});
await test("ext menu opens the / command menu and keeps it visible", async () => {
localStorage.clear();
globalThis.fetch = async (url) => {
if (String(url).includes("/api/ai/skills")) {
return {
ok: true, status: 200,
json: async () => ({
skills: [{ id: "research", label: "Recherche", type: "skill", description: "d" }],
commands: [],
}),
};
}
return { ok: true, status: 200, json: async () => ({}) };
};
const b = new BooksLM();
b._panel = b._render();
document.body.appendChild(b._panel);
const ta = b._panel.querySelector("textarea");
ta.value = ta.selectionStart = ta.selectionEnd = 0;
b._toggleExtMenu();
const commandMenu = b._panel.querySelector(".bookslm-command-menu");
const skillBtn = b._panel.querySelector('.bookslm-ext-item[data-ext-id="skill"]');
assert.ok(skillBtn, "Skills entry present in the + panel");
skillBtn.click();
await sleep(20);
assert.ok(!commandMenu.classList.contains("hidden"),
"command menu stays open after picking Skills (BUG-048)");
assert.ok(commandMenu.querySelectorAll(".bookslm-menu-item").length >= 1,
"command menu lists skills");
b._panel.remove();
localStorage.clear();
});
await test("the + button carries a '+' icon", async () => {
const b = new BooksLM();
b._panel = b._render();
document.body.appendChild(b._panel);
const plus = b._panel.querySelector(".bookslm-btn-plus i");
assert.ok(plus, "the + button shows an icon");
assert.equal(plus.getAttribute("data-lucide"), "plus", "the + button icon is a plus");
b._panel.remove();
});
// ── Summary ──
console.log(`\n${passCount}/${testCount} tests passed`);
if (passCount !== testCount) {