mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 17:02:28 +00:00
Merge pull request #1788 from PR0M3TH3AN/fix-ci-failures-popover-and-tags-11428382662993013885
Fix CI failures: popover window reference, tag formatting, and canvas mock
This commit is contained in:
3 files changed
+20
-3
No files matched your search
@@ -3244,7 +3244,7 @@ export class VideoModal {
|
||||
|
||||
seen.add(key);
|
||||
|
||||
const display = trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
||||
const display = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
|
||||
normalized.push(display);
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,9 @@ export function createPopover(trigger, render, options = {}) {
|
||||
}
|
||||
|
||||
function getView() {
|
||||
return documentRef?.defaultView || globalThis;
|
||||
if (typeof window !== "undefined") return window;
|
||||
if (typeof globalThis !== "undefined") return globalThis;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function focusWithoutScroll(node) {
|
||||
@@ -774,10 +776,18 @@ export function createPopover(trigger, render, options = {}) {
|
||||
}
|
||||
|
||||
async function updatePosition() {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!anchor || !panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (anchor.isConnected === false || panel.isConnected === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const effectiveGap = Number.isFinite(gap) ? gap : 0;
|
||||
const safePadding = Number.isFinite(viewportPadding) ? viewportPadding : 0;
|
||||
@@ -848,6 +858,9 @@ export function createPopover(trigger, render, options = {}) {
|
||||
|
||||
syncPopoverStyles();
|
||||
} catch (error) {
|
||||
if (error instanceof ReferenceError && error.message.includes("window")) {
|
||||
return;
|
||||
}
|
||||
logger.user.error("[popover] positioning failed", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,11 @@ export async function setupModal({ lazyLoad = false } = {}) {
|
||||
|
||||
// Force override getContext to silence JSDOM "Not implemented" error
|
||||
try {
|
||||
window.HTMLCanvasElement.prototype.getContext = () => null;
|
||||
window.HTMLCanvasElement.prototype.getContext = () => ({
|
||||
fillStyle: "",
|
||||
fillRect: () => {},
|
||||
drawImage: () => {},
|
||||
});
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user