Files
marqdo/tests/web/layout.browser.cjs
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

35 lines
2.0 KiB
JavaScript
Executable File

// Exercise the actual recursive reference output; no external resources required.
const assert = require('node:assert/strict');
const {pathToFileURL} = require('node:url');
const {chromium} = require(process.env.MARQDO_PLAYWRIGHT_MODULE || 'playwright');
(async () => {
const browser = await chromium.launch({headless:true, executablePath:process.env.MARQDO_CHROMIUM || undefined, args:['--no-sandbox']});
try {
const page = await browser.newPage();
const errors=[]; page.on('pageerror',e=>errors.push(e.message));
const target=process.argv[2];
await page.goto(target.startsWith('/') ? pathToFileURL(target).href : target);
const box=selector=>page.locator(selector).boundingBox();
for (const width of [1440,390]) {
await page.setViewportSize({width,height:1000});
const brand=await box('.slot-footer-brand');
const links=await box('.slot-footer-links');
const docs=await box('.slot-footer-links-docs');
const community=await box('.slot-footer-links-community');
assert(brand&&links&&docs&&community,'all footer leaves are present');
assert.equal(await page.locator('.slot-footer.mq-row > .slot-footer-links.mq-row').count(),1,'nested columns remain children');
if(width===1440) {
assert(links.x>brand.x+brand.width-1 && Math.abs(links.y-brand.y)<2,'brand and links form two columns');
assert(community.x>docs.x+docs.width-1 && Math.abs(community.y-docs.y)<2,'links decomposes into two further columns');
} else {
assert(links.y>=brand.y+brand.height,'footer collapses vertically');
assert(community.y>=docs.y+docs.height,'inner columns also collapse');
}
assert(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+1),'no horizontal overflow');
console.log(`layout ${width}px: outer and nested geometry passed`);
}
assert.deepEqual(errors,[]);
if(process.argv[3]) await page.screenshot({path:process.argv[3],fullPage:true});
} finally {await browser.close();}
})().catch(error=>{console.error(error);process.exit(1);});