Improve local filetree view state and sidebar performance
This commit is contained in:
@@ -286,7 +286,8 @@ async function run() {
|
||||
request.url().includes("/api/tree/commands") ||
|
||||
request.url().includes("/api/documents/title") ||
|
||||
request.url().includes("/api/documents/save") ||
|
||||
request.url().includes("/api/documents/options")
|
||||
request.url().includes("/api/documents/options") ||
|
||||
request.url().includes("/api/ui/preferences")
|
||||
) {
|
||||
requests.push({
|
||||
url: request.url(),
|
||||
@@ -298,7 +299,6 @@ async function run() {
|
||||
|
||||
try {
|
||||
await page.goto(documentUrl(root, "local-md:README.md"), { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await page.evaluate(() => window.localStorage.removeItem("mnote.global.showHeadingNumbers"));
|
||||
await page.reload({ waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await waitForText(page, "Frontmatter Title");
|
||||
const dialogs = [];
|
||||
@@ -393,21 +393,14 @@ async function run() {
|
||||
if (!optionsResponse.ok) throw new Error(`options_failed_${optionsResponse.status}`);
|
||||
}, { rootUri: fileUrl(root) });
|
||||
assert(fs.readFileSync(path.join(root, "README.md"), "utf8").includes("Browser saved body"), "浏览器保存应写回 Markdown 正文");
|
||||
assert(fs.existsSync(path.join(root, ".mnote", "page-options.json")), "浏览器页面设置保存应写入 .mnote/page-options.json");
|
||||
assert(!fs.existsSync(path.join(root, ".mnote", "page-options.json")), "浏览器页面设置保存不应继续写入 .mnote/page-options.json");
|
||||
await page.reload({ waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await waitForText(page, "Browser Saved Title");
|
||||
await waitForText(page, "Browser saved body");
|
||||
const globallyDisabledHeadingBefore = await page.locator("#mnote-leptos-tiptap-island-editor-root .ProseMirror h1").first().evaluate((node) =>
|
||||
window.getComputedStyle(node, "::before").content
|
||||
);
|
||||
assert(globallyDisabledHeadingBefore === "none", "全局关闭时,即使页面设置显式开启 showHeadingNumbers,也不应显示标题自动编号");
|
||||
await page.evaluate(() => window.localStorage.setItem("mnote.global.showHeadingNumbers", "true"));
|
||||
await page.reload({ waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await waitForText(page, "Browser Saved Title");
|
||||
const enabledHeadingBefore = await page.locator("#mnote-leptos-tiptap-island-editor-root .ProseMirror h1").first().evaluate((node) =>
|
||||
window.getComputedStyle(node, "::before").content
|
||||
);
|
||||
assert(enabledHeadingBefore !== "none", "全局开启后应显示标题自动编号");
|
||||
assert(enabledHeadingBefore !== "none", "SQLite 偏好开启后应显示标题自动编号");
|
||||
await page.goto(documentUrl(root, "local-md:docs~2Fblocks.md"), { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await waitForText(page, "Complex Title");
|
||||
await waitForText(page, "Bullet item");
|
||||
|
||||
Reference in New Issue
Block a user