fix(foundry): stabilize map window compositor and drag
This commit is contained in:
@@ -61,13 +61,15 @@ test("dropdown scroll keeps portal geometry stable and contained", async () => {
|
||||
});
|
||||
|
||||
test("workspace windows keep their glass rim without masked compositor overlays", async () => {
|
||||
const [workspace, styles] = await Promise.all([
|
||||
const [workspace, styles, mapStyles] = await Promise.all([
|
||||
readFile(new URL("../packages/ui-react/src/WorkspaceWindow.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../packages/ui-core/styles.css", import.meta.url), "utf8"),
|
||||
readFile(new URL("../apps/catalog/src/styles.css", import.meta.url), "utf8"),
|
||||
]);
|
||||
const rootClass = workspace.match(/className=\{cn\("(?<classes>[^"]+)"/)?.groups?.classes ?? "";
|
||||
const windowRule = styles.match(/\.nodedc-workspace-window \{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
|
||||
const materialOverride = styles.match(/\.nodedc-workspace-window\.nodedc-glass-material::before \{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
|
||||
const mapWindowRule = mapStyles.match(/\.catalog-map-fixture__map-glass-window \{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
|
||||
|
||||
assert.match(rootClass, /\bnodedc-glass-material\b/);
|
||||
assert.doesNotMatch(rootClass, /\bnodedc-material-rim\b/);
|
||||
@@ -76,4 +78,20 @@ test("workspace windows keep their glass rim without masked compositor overlays"
|
||||
assert.match(windowRule, /border-color:[\s\S]*--nodedc-modal-glass-outline-opacity/);
|
||||
assert.match(materialOverride, /content:\s*none;/);
|
||||
assert.doesNotMatch(materialOverride, /mask/);
|
||||
assert.match(mapWindowRule, /backdrop-filter:\s*none;/);
|
||||
assert.match(mapWindowRule, /contain:\s*layout paint;/);
|
||||
assert.doesNotMatch(mapWindowRule, /backdrop-filter:\s*blur/);
|
||||
});
|
||||
|
||||
test("workspace pointer drag paints on animation frames and commits once on release", async () => {
|
||||
const workspace = await readFile(new URL("../packages/ui-react/src/WorkspaceWindow.tsx", import.meta.url), "utf8");
|
||||
const pointerMove = workspace.match(/const handlePointerMove = \(event: globalThis\.PointerEvent\) => \{(?<body>[\s\S]*?)\n \};/)?.groups?.body ?? "";
|
||||
const pointerEnd = workspace.match(/const endInteraction = \(event: globalThis\.PointerEvent\) => \{(?<body>[\s\S]*?)\n \};/)?.groups?.body ?? "";
|
||||
|
||||
assert.match(workspace, /interactionFrameRef\.current = window\.requestAnimationFrame\(paintInteraction\)/);
|
||||
assert.match(pointerMove, /interaction\.previewRect = nextRect/);
|
||||
assert.match(pointerMove, /scheduleInteractionPaint\(\)/);
|
||||
assert.doesNotMatch(pointerMove, /onRectChangeRef|emitRect/);
|
||||
assert.match(pointerEnd, /onRectChangeRef\.current\(nextRect\)/);
|
||||
assert.match(workspace, /translate3d\(\$\{deltaX\}px, \$\{deltaY\}px, 0\)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user