Fix tests

This commit is contained in:
Pieter Vander Vennet 2024-01-11 05:06:12 +01:00
parent 9655f8a092
commit 503cecf4b8

View file

@ -1,4 +1,5 @@
import { Stores, UIEventSource } from "../Logic/UIEventSource" import { Stores, UIEventSource } from "../Logic/UIEventSource"
import { Utils } from "../Utils"
/** /**
* Utilities to (re)set user zoom (this is when the user enlarges HTML-elements by pinching out a non-map element). * Utilities to (re)set user zoom (this is when the user enlarges HTML-elements by pinching out a non-map element).
@ -17,6 +18,9 @@ export default class Zoomcontrol {
private readonly _lockTokens: Set<any> = new Set<any>() private readonly _lockTokens: Set<any> = new Set<any>()
private constructor() { private constructor() {
if (Utils.runningFromConsole) {
return
}
const metaElems = document.getElementsByTagName("head")[0].getElementsByTagName("meta") const metaElems = document.getElementsByTagName("head")[0].getElementsByTagName("meta")
this.viewportElement = Array.from(metaElems).find( this.viewportElement = Array.from(metaElems).find(
(meta) => meta.getAttribute("name") === "viewport" (meta) => meta.getAttribute("name") === "viewport"
@ -39,7 +43,7 @@ export default class Zoomcontrol {
} }
private apply(fullSpec: string) { private apply(fullSpec: string) {
this.viewportElement.setAttribute("content", fullSpec) this.viewportElement?.setAttribute("content", fullSpec)
} }
public static createLock(): () => void { public static createLock(): () => void {