From 50f2c08ecb528ebd54e03bc6ee2cba97af3e8770 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 26 Mar 2025 11:27:49 +0100 Subject: [PATCH] wip: do not call document during JS unittests --- umap/static/umap/js/modules/sync/undo.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/umap/static/umap/js/modules/sync/undo.js b/umap/static/umap/js/modules/sync/undo.js index e96bcf9d..47e0a3de 100644 --- a/umap/static/umap/js/modules/sync/undo.js +++ b/umap/static/umap/js/modules/sync/undo.js @@ -11,6 +11,8 @@ export class UndoManager { } toggleState() { + // document is undefined during unittests + if (typeof document === 'undefined') return const undoButton = document.querySelector('.edit-undo') const redoButton = document.querySelector('.edit-redo') if (undoButton) undoButton.disabled = !this._undoStack.length