mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
Fix JSDOM reference error and assertion in popover tests
- Exposed `HTMLStyleElement` globally in `tests/ui/popoverEngine.test.mjs` to resolve a `ReferenceError` during `instanceof` checks. - Updated assertion in "applies token-based sizing and arrow positioning" to check the `--popover-arrow-top` CSS variable instead of the `top` property, as JSDOM does not compute layout properties from variables. - Verified all tests in the file pass.
This commit is contained in:
1 parent
c0be521be2
commit
4cd85b8096
1 file changed
+3
-1
@@ -64,6 +64,7 @@ beforeEach(async () => {
|
||||
global.window = windowRef;
|
||||
global.document = documentRef;
|
||||
global.HTMLElement = windowRef.HTMLElement;
|
||||
global.HTMLStyleElement = windowRef.HTMLStyleElement;
|
||||
global.Element = windowRef.Element;
|
||||
global.Node = windowRef.Node;
|
||||
global.getComputedStyle = windowRef.getComputedStyle.bind(windowRef);
|
||||
@@ -103,6 +104,7 @@ afterEach(() => {
|
||||
delete global.window;
|
||||
delete global.document;
|
||||
delete global.HTMLElement;
|
||||
delete global.HTMLStyleElement;
|
||||
delete global.Element;
|
||||
delete global.Node;
|
||||
delete global.getComputedStyle;
|
||||
@@ -756,7 +758,7 @@ test("applies token-based sizing and arrow positioning", async () => {
|
||||
assert.equal(panelStyles.getPropertyValue("--popover-max-height").trim(), "240px");
|
||||
assert.equal(arrow.dataset.popoverArrowSide, "bottom");
|
||||
const arrowStyles = getComputedStyle(arrow);
|
||||
assert.notEqual(arrowStyles.top, "");
|
||||
assert.notEqual(arrowStyles.getPropertyValue("--popover-arrow-top").trim(), "auto");
|
||||
|
||||
popover.destroy();
|
||||
});
|
||||
Reference in new issue
Block a user