feat: consolidate local-first mnote web runtime
This commit is contained in:
@@ -122,8 +122,6 @@ async function main() {
|
||||
MNOTE_WEB_PUBLIC_BIND: `127.0.0.1:${port}`,
|
||||
MNOTE_WEB_ENABLE_LEGACY_NEXT_COMPAT: "0",
|
||||
MNOTE_LOCAL_ACCESS_POLICY_FILE: policyFile,
|
||||
CONVEX_SELF_HOSTED_URL: "http://127.0.0.1:9",
|
||||
NEXT_PUBLIC_CONVEX_URL: "http://127.0.0.1:9",
|
||||
},
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
@@ -173,6 +171,9 @@ async function main() {
|
||||
showHeadingNumbers: true,
|
||||
wideLayout: true,
|
||||
pageFont: "song",
|
||||
"pageWidth.markdown": { mode: "wide", custom: null },
|
||||
"pageWidth.word": { mode: "wide", custom: null },
|
||||
"pageWidth.excel": { mode: "full", custom: null },
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -187,10 +188,35 @@ async function main() {
|
||||
assert.equal(sameUserEffective.pageOptions.showHeadingNumbers, true, "同用户第二浏览器应读到标题编号偏好");
|
||||
assert.equal(sameUserEffective.pageOptions.wideLayout, true, "同用户第二浏览器应读到页面宽度偏好");
|
||||
assert.equal(sameUserEffective.pageOptions.pageFont, "song", "同用户第二浏览器应读到页面字体偏好");
|
||||
assert.equal(sameUserEffective.pageWidthPreferences.markdown.mode, "wide", "同用户第二浏览器应读到 Markdown 宽度偏好");
|
||||
assert.equal(sameUserEffective.pageWidthPreferences.markdown.source, "global", "页面宽度偏好应存为全局 scope");
|
||||
assert.equal(sameUserEffective.pageWidthPreferences.excel.mode, "full", "同用户第二浏览器应读到 Excel 宽度偏好");
|
||||
|
||||
const documentPage = await secondContext.newPage();
|
||||
const documentUrl = new URL(`/documents/${encodeURIComponent(documentId)}`, baseUrl);
|
||||
documentUrl.searchParams.set("sourceKind", "local_folder");
|
||||
documentUrl.searchParams.set("rootUri", rootUri);
|
||||
await documentPage.goto(documentUrl.toString(), { waitUntil: "domcontentloaded", timeout: TIMEOUT_MS });
|
||||
await documentPage.waitForSelector('.document-shell[data-page-width-resolved-mode="wide"]', { timeout: TIMEOUT_MS });
|
||||
const shellWidthState = await documentPage.evaluate(() => {
|
||||
const shell = document.querySelector(".document-shell");
|
||||
if (!(shell instanceof HTMLElement)) return null;
|
||||
return {
|
||||
mode: shell.getAttribute("data-page-width-resolved-mode"),
|
||||
source: shell.getAttribute("data-page-width-source"),
|
||||
maxWidth: getComputedStyle(shell).maxWidth,
|
||||
};
|
||||
});
|
||||
assert(shellWidthState, "文档页应渲染 document-shell");
|
||||
assert.equal(shellWidthState.mode, "wide", "Markdown 文档页应消费全局 Markdown 宽度偏好");
|
||||
assert.equal(shellWidthState.source, "global", "Markdown 文档页宽度来源应为 global");
|
||||
assert.equal(shellWidthState.maxWidth, "1180px", "Markdown 文档页宽版 max-width 应为 1180px");
|
||||
await documentPage.close();
|
||||
|
||||
const otherUserEffective = await effectivePreferences(otherContext.request, baseUrl, documentId, rootUri);
|
||||
assert.equal(otherUserEffective.pageOptions.hideTitleHeader, true, "不同用户不应串读 source family 偏好");
|
||||
assert.equal(otherUserEffective.pageOptions.showHeadingNumbers, false, "不同用户不应串读 global 偏好");
|
||||
assert.equal(otherUserEffective.pageWidthPreferences.markdown.mode, "readable", "不同用户不应串读 Markdown 宽度偏好");
|
||||
|
||||
console.log("task493 page settings sqlite preferences smoke passed");
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user