Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:white_check_mark: Stabilize Electron regression test fixtures

Daniel0e35efa15752
diff --git a/app/src/block/panelPosition.test.ts b/app/src/block/panelPosition.test.ts
index 808a105b25..b7067d5f24 100644
--- a/app/src/block/panelPosition.test.ts
+++ b/app/src/block/panelPosition.test.ts
@@ -139,7 +139,11 @@ app.whenReady().then(async () => {
const win = new BrowserWindow({show: false, width, height: 900, useContentSize: true,
webPreferences: {nodeIntegration: true, contextIsolation: false}});
try {
+ // 创建窗口时可能受屏幕工作区限制,显式设置内容尺寸以固定测试视口。
+ win.setContentSize(width, 900);
await win.loadURL("data:text/html,<html><body></body></html>");
+ const viewport = await win.webContents.executeJavaScript("[innerWidth, innerHeight]");
+ require("node:assert/strict").deepEqual(viewport, [width, 900]);
const result = await win.webContents.executeJavaScript(${JSON.stringify(
`(() => { const __name = value => value; try {
return (${browserCases.toString()})(${JSON.stringify(source)}, ${JSON.stringify(css)});
diff --git a/app/src/protyle/render/listMindmap/preview.test.ts b/app/src/protyle/render/listMindmap/preview.test.ts
index dc6d6ae482..c4e5e8f7da 100644
--- a/app/src/protyle/render/listMindmap/preview.test.ts
+++ b/app/src/protyle/render/listMindmap/preview.test.ts
@@ -185,7 +185,7 @@ test("special block previews cannot acquire document writes or lose unsupported
extract("../htmlRender.ts", ["htmlRender"]) + extract("../blockRender.ts", ["blockRender"]) +
extract("../chartRender.ts", ["refreshChartTheme"]) +
extract("../av/render.ts", ["avRender", "getAVElements"]) +
- extract("../../util/tableVirtualizationDOM.ts", ["TABLE_VIRTUAL_ID"]) +
+ extract("../../util/tableVirtualizationDOM.ts", ["TABLE_VIRTUAL_ID", "TABLE_VIRTUAL_ROWS"]) +
extract("../../util/tableControl.ts", ["getCell", "getTableNode"]) +
compile(`class TablePreviewControl {${methods.map(method => method.getText(tableSource)).join("\n")}}`) +
extract("../av/richText.ts", ["ALLOWED_BLOCK_TYPES", "isSupportedAVRichTextBlock", "getAVRichTextUnsupportedPasteBlocks"]) +