fix: repair resource tab and slash menu regressions

This commit is contained in:
lix-2026
2026-05-20 17:47:09 +08:00
parent bbd9dab701
commit 4c62ea7e35
8 changed files with 404 additions and 17 deletions
@@ -154,6 +154,21 @@ async function main() {
state: "visible",
timeout: UI_TIMEOUT_MS,
});
const markdownTabState = await page.evaluate(() => {
const pageTab = document.querySelector('[data-mnote-main-tab="page"]');
const tab = document.querySelector('.mnote-main-tab.is-active[data-mnote-tab-kind="markdown"]');
const badge = tab?.querySelector(".mnote-main-tab-badge");
return {
pageText: pageTab?.textContent || "",
resourceText: tab?.textContent || "",
badgeKind: tab?.getAttribute("data-mnote-tab-badge-kind") || "",
badgeColor: badge ? getComputedStyle(badge).backgroundColor : "",
};
});
assert(!/\b(description|article|notes)\b/i.test(markdownTabState.pageText), `页面 tab 不应显示 Material Symbols 文本: ${JSON.stringify(markdownTabState)}`);
assert(!/\b(description|article|notes)\b/i.test(markdownTabState.resourceText), `Markdown tab 不应显示 Material Symbols 文本: ${JSON.stringify(markdownTabState)}`);
assert.equal(markdownTabState.badgeKind, "code", `Markdown tab 应使用黑色 code 色块: ${JSON.stringify(markdownTabState)}`);
assert(markdownTabState.badgeColor === "rgb(17, 17, 17)", `Markdown tab 色块应为黑色: ${JSON.stringify(markdownTabState)}`);
const editor = page.locator('.mnote-resource-tab-panel:not([hidden]) .editor-surface .ProseMirror[contenteditable="true"]').first();
await editor.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
await editor.click({ timeout: UI_TIMEOUT_MS });
@@ -186,6 +201,18 @@ async function main() {
state: "visible",
timeout: UI_TIMEOUT_MS,
});
const officeTabState = await page.evaluate(() => {
const tab = document.querySelector('.mnote-main-tab.is-active[data-mnote-tab-kind="office"]');
const badge = tab?.querySelector(".mnote-main-tab-badge");
return {
resourceText: tab?.textContent || "",
badgeKind: tab?.getAttribute("data-mnote-tab-badge-kind") || "",
badgeColor: badge ? getComputedStyle(badge).backgroundColor : "",
};
});
assert(!/\b(description|article|notes)\b/i.test(officeTabState.resourceText), `Office tab 不应显示 Material Symbols 文本: ${JSON.stringify(officeTabState)}`);
assert.equal(officeTabState.badgeKind, "word", `docx tab 应使用 word 色块: ${JSON.stringify(officeTabState)}`);
assert(officeTabState.badgeColor === "rgb(79, 125, 243)", `docx tab 色块应与附件 word 蓝色一致: ${JSON.stringify(officeTabState)}`);
const officeFrameSrc = await page.locator('.mnote-resource-tab-panel:not([hidden]) iframe.mnote-resource-tab-frame').first().getAttribute("src", {
timeout: UI_TIMEOUT_MS,
});