Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7e1ad1c0c | ||
|
|
714090a83d |
No files matched your search
@@ -25,6 +25,21 @@ const fs = require('node:fs');
|
|||||||
const box = await frame.locator(`#${id}`).boundingBox();
|
const box = await frame.locator(`#${id}`).boundingBox();
|
||||||
assert(box && box.width >= 40 && box.height >= 44, id);
|
assert(box && box.width >= 40 && box.height >= 44, id);
|
||||||
}
|
}
|
||||||
|
const toolbar = await frame.locator('.toolbar').boundingBox();
|
||||||
|
const exportButton = await frame.locator('#btn-export').boundingBox();
|
||||||
|
const diagram = await frame.locator('.diagram-container > svg').boundingBox();
|
||||||
|
const rightGap = toolbar.x + toolbar.width - exportButton.x - exportButton.width;
|
||||||
|
assert(Math.abs(rightGap - 8) < 1, `toolbar right padding at ${width}: ${rightGap}`);
|
||||||
|
assert(diagram.y >= toolbar.y + toolbar.height, 'toolbar must stay above nodes');
|
||||||
|
const checkMenu = async selector => {
|
||||||
|
await frame.locator(selector).evaluate(n => Promise.all(n.getAnimations().map(a => a.finished)));
|
||||||
|
const menu = await frame.locator(selector).boundingBox();
|
||||||
|
const viewport = await iframe.boundingBox();
|
||||||
|
const currentToolbar = await frame.locator('.toolbar').boundingBox();
|
||||||
|
assert(menu && menu.x >= viewport.x - 1 && menu.y >= currentToolbar.y + currentToolbar.height - 1, selector);
|
||||||
|
assert(menu.x + menu.width <= viewport.x + viewport.width + 1, `${selector} clips horizontally`);
|
||||||
|
assert(menu.y + menu.height <= viewport.y + viewport.height + 1, `${selector} clips vertically`);
|
||||||
|
};
|
||||||
const light = await frame.locator('body').evaluate(n => getComputedStyle(n).backgroundColor);
|
const light = await frame.locator('body').evaluate(n => getComputedStyle(n).backgroundColor);
|
||||||
await frame.locator('#btn-theme').click(); await theme('dark');
|
await frame.locator('#btn-theme').click(); await theme('dark');
|
||||||
assert.notEqual(await frame.locator('body').evaluate(n => getComputedStyle(n).backgroundColor), light);
|
assert.notEqual(await frame.locator('body').evaluate(n => getComputedStyle(n).backgroundColor), light);
|
||||||
@@ -42,6 +57,7 @@ const fs = require('node:fs');
|
|||||||
await portalTheme('light'); await theme('light');
|
await portalTheme('light'); await theme('light');
|
||||||
for (const preset of ['signal-flow', 'blueprint', 'editorial', 'classic']) {
|
for (const preset of ['signal-flow', 'blueprint', 'editorial', 'classic']) {
|
||||||
await frame.locator('#btn-preset').click();
|
await frame.locator('#btn-preset').click();
|
||||||
|
await checkMenu('.preset-menu');
|
||||||
await frame.locator(`[data-preset-value="${preset}"]`).click();
|
await frame.locator(`[data-preset-value="${preset}"]`).click();
|
||||||
assert.equal(await frame.locator('html').getAttribute('data-preset'), preset);
|
assert.equal(await frame.locator('html').getAttribute('data-preset'), preset);
|
||||||
}
|
}
|
||||||
@@ -53,6 +69,7 @@ const fs = require('node:fs');
|
|||||||
const exports = [];
|
const exports = [];
|
||||||
for (const format of ['png', 'jpeg', 'webp', 'svg', 'svg-light', 'svg-dark', 'webm']) {
|
for (const format of ['png', 'jpeg', 'webp', 'svg', 'svg-light', 'svg-dark', 'webm']) {
|
||||||
await frame.locator('#btn-export').click();
|
await frame.locator('#btn-export').click();
|
||||||
|
await checkMenu('.export-menu');
|
||||||
if (format === 'webm' && await frame.locator('[data-format="webm"]').isDisabled()) {
|
if (format === 'webm' && await frame.locator('[data-format="webm"]').isDisabled()) {
|
||||||
exports.push({format, unsupported: true});
|
exports.push({format, unsupported: true});
|
||||||
await frame.locator('#btn-export').click();
|
await frame.locator('#btn-export').click();
|
||||||
@@ -108,7 +125,7 @@ const fs = require('node:fs');
|
|||||||
await next.scrollIntoViewIfNeeded();
|
await next.scrollIntoViewIfNeeded();
|
||||||
await (await (await next.elementHandle()).contentFrame()).waitForFunction(() => document.documentElement.dataset.theme === 'dark');
|
await (await (await next.elementHandle()).contentFrame()).waitForFunction(() => document.documentElement.dataset.theme === 'dark');
|
||||||
assert(!await page.evaluate(() => document.documentElement.scrollWidth > innerWidth));
|
assert(!await page.evaluate(() => document.documentElement.scrollWidth > innerWidth));
|
||||||
results.push({width, themeSync:true, presets:4, exports, fullscreen:true, routeTheme:true});
|
results.push({width, toolbar, rightGap, dropdownsUnclipped:true, themeSync:true, presets:4, exports, fullscreen:true, routeTheme:true});
|
||||||
fs.writeFileSync(`${output}/results.json`, JSON.stringify(results,null,2));
|
fs.writeFileSync(`${output}/results.json`, JSON.stringify(results,null,2));
|
||||||
await context.close();
|
await context.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ html[data-embed="true"] .toolbar {
|
|||||||
display: flex !important;
|
display: flex !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
inset: auto;
|
inset: auto;
|
||||||
justify-content: center;
|
justify-content: flex-end;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
padding: 4px;
|
padding: 4px 8px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
@@ -16,17 +16,18 @@ html[data-embed="true"] .diagram-container > svg {
|
|||||||
}
|
}
|
||||||
html[data-embed="true"] .toolbar .preset-menu,
|
html[data-embed="true"] .toolbar .preset-menu,
|
||||||
html[data-embed="true"] .toolbar .export-menu {
|
html[data-embed="true"] .toolbar .export-menu {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
top: 100%;
|
top: 52px;
|
||||||
left: 0;
|
left: auto;
|
||||||
right: auto;
|
right: 0;
|
||||||
width: min(320px, 100vw);
|
width: min(320px, 100vw);
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
max-height: calc(100vh - 52px);
|
max-height: calc(100vh - 52px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
/* Keep the preset menu in the iframe viewport without moving its capsule. */
|
||||||
html[data-embed="true"] .toolbar .export-wrap { position: static; }
|
html[data-embed="true"] .toolbar .export-wrap { position: static; }
|
||||||
html[data-embed="true"] .toolbar .export-menu { left: auto; right: 0; }
|
html[data-embed="true"] .toolbar .export-menu { position: absolute; top: 100%; }
|
||||||
html[data-embed="true"] .toolbar .preset-menu button,
|
html[data-embed="true"] .toolbar .preset-menu button,
|
||||||
html[data-embed="true"] .toolbar .export-menu button { min-height: 44px; }
|
html[data-embed="true"] .toolbar .export-menu button { min-height: 44px; }
|
||||||
Reference in new issue
Block a user