fix(ui): contain dropdown scroll geometry
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
import { computeFloatingPosition } from "../packages/ui-core/dist/index.js";
|
||||
@@ -46,3 +47,15 @@ test("floating surface remains bounded when its anchor is below the viewport", (
|
||||
assert.ok(position.top + Math.min(500, position.maxHeight) <= 712);
|
||||
assert.ok(position.maxHeight <= 704);
|
||||
});
|
||||
|
||||
test("dropdown scroll keeps portal geometry stable and contained", async () => {
|
||||
const styles = await readFile(
|
||||
new URL("../packages/ui-core/styles.css", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const dropdownRule = styles.match(/\.nodedc-dropdown-surface \{(?<body>[\s\S]*?)\n\}/)?.groups?.body ?? "";
|
||||
|
||||
assert.match(dropdownRule, /box-sizing:\s*border-box;/);
|
||||
assert.match(dropdownRule, /overflow:\s*auto;/);
|
||||
assert.match(dropdownRule, /overscroll-behavior:\s*contain;/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user