feat: restore Wolai workspace navigation and assets
This commit is contained in:
@@ -187,6 +187,33 @@ async function main() {
|
||||
await page.goto(rootUrl.toString(), { waitUntil: "domcontentloaded", timeout: UI_TIMEOUT_MS });
|
||||
await assertNavigationPage(page);
|
||||
assert.equal(await page.locator('[data-root-active-page-id="local-md:Home.md"]').count(), 0, "打开文件夹 root 不应自动打开 Home.md");
|
||||
const homePageBlock = page.locator('[data-testid="mnote-navigation-pages"] [data-navigation-item-kind="page"][data-local-relative-path="Home.md"]').first();
|
||||
await homePageBlock.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
|
||||
const homePageBlockVisual = await homePageBlock.evaluate((anchor) => {
|
||||
const style = getComputedStyle(anchor);
|
||||
const before = getComputedStyle(anchor, "::before");
|
||||
return {
|
||||
className: anchor.className,
|
||||
blockType: anchor.getAttribute("data-block-type"),
|
||||
area: anchor.getAttribute("data-area"),
|
||||
display: style.display,
|
||||
cursor: style.cursor,
|
||||
beforeWidth: before.width,
|
||||
beforeHeight: before.height,
|
||||
};
|
||||
});
|
||||
assert.ok(
|
||||
homePageBlockVisual.className.split(/\s+/).includes("mnote-page-block-link"),
|
||||
`首页子页面必须使用页面块链接语义: ${JSON.stringify(homePageBlockVisual)}`,
|
||||
);
|
||||
assert.equal(homePageBlockVisual.blockType, "page", `首页页面块应声明 page 类型: ${JSON.stringify(homePageBlockVisual)}`);
|
||||
assert.equal(homePageBlockVisual.area, "page-block", `首页页面块应标记 page-block 区域: ${JSON.stringify(homePageBlockVisual)}`);
|
||||
assert.equal(homePageBlockVisual.display, "inline-flex", `首页页面块应使用图标+标题布局: ${JSON.stringify(homePageBlockVisual)}`);
|
||||
assert.equal(homePageBlockVisual.cursor, "pointer", `首页页面块应明确可点击: ${JSON.stringify(homePageBlockVisual)}`);
|
||||
assert.ok(
|
||||
parseFloat(homePageBlockVisual.beforeWidth) >= 14 && parseFloat(homePageBlockVisual.beforeHeight) >= 14,
|
||||
`首页页面块应显示页面图标: ${JSON.stringify(homePageBlockVisual)}`,
|
||||
);
|
||||
await page.waitForFunction(() => Boolean(window.__mnoteDocumentPaneRuntime?.openResourceInActiveTab), null, {
|
||||
timeout: UI_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user