mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-12 15:52:30 +00:00
Merge pull request #1782 from PR0M3TH3AN/fix-jsdom-errors-and-tag-sorting-7781906767581563489
Fix JSDOM errors and correct video tag sorting logic
This commit is contained in:
3 files changed
+21
-25
No files matched your search
@@ -33,9 +33,8 @@ export async function setupModal({ lazyLoad = false } = {}) {
|
||||
// jsdom defines HTMLMediaElement but .pause/.load throw "Not implemented".
|
||||
// Replace with safe no-ops for tests that just depend on calls happening.
|
||||
if (window.HTMLMediaElement && window.HTMLMediaElement.prototype) {
|
||||
const proto = window.HTMLMediaElement.prototype;
|
||||
proto.pause = () => {};
|
||||
proto.load = () => {};
|
||||
window.HTMLMediaElement.prototype.pause = function () {};
|
||||
window.HTMLMediaElement.prototype.load = function () {};
|
||||
}
|
||||
|
||||
globalThis.HTMLElement = window.HTMLElement;
|
||||
@@ -47,15 +46,6 @@ export async function setupModal({ lazyLoad = false } = {}) {
|
||||
globalThis.Node = window.Node;
|
||||
globalThis.EventTarget = window.EventTarget;
|
||||
|
||||
if (typeof window.HTMLMediaElement !== "undefined") {
|
||||
window.HTMLMediaElement.prototype.pause = function () {};
|
||||
window.HTMLMediaElement.prototype.load = function () {};
|
||||
}
|
||||
if (typeof window.HTMLVideoElement !== "undefined") {
|
||||
window.HTMLVideoElement.prototype.pause = function () {};
|
||||
window.HTMLVideoElement.prototype.load = function () {};
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(globalThis, "navigator", {
|
||||
value: window.navigator,
|
||||
@@ -458,13 +448,9 @@ async function setupPlaybackHarness() {
|
||||
globalThis.Node = window.Node;
|
||||
globalThis.EventTarget = window.EventTarget;
|
||||
|
||||
if (typeof window.HTMLMediaElement !== "undefined") {
|
||||
if (!window.HTMLMediaElement.prototype.pause) {
|
||||
window.HTMLMediaElement.prototype.pause = function () {};
|
||||
}
|
||||
if (!window.HTMLMediaElement.prototype.load) {
|
||||
window.HTMLMediaElement.prototype.load = function () {};
|
||||
}
|
||||
if (window.HTMLMediaElement && window.HTMLMediaElement.prototype) {
|
||||
window.HTMLMediaElement.prototype.pause = function () {};
|
||||
window.HTMLMediaElement.prototype.load = function () {};
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user