From c5e3dfb95c7e87e033ea9be00a7f7a5c369cb3d1 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 15 Mar 2024 17:19:56 +0100 Subject: [PATCH] chore: fix JS syntax to be compatible with browser >= 2020 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Safari only supports public field since 2021… --- umap/static/umap/js/modules/panel.js | 25 +++++++++++++++---------- umap/static/umap/js/umap.js | 6 +++--- umap/tests/integration/test_import.py | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/umap/static/umap/js/modules/panel.js b/umap/static/umap/js/modules/panel.js index b83d703d..d2ea1918 100644 --- a/umap/static/umap/js/modules/panel.js +++ b/umap/static/umap/js/modules/panel.js @@ -2,13 +2,12 @@ import { DomUtil, DomEvent } from '../../vendors/leaflet/leaflet-src.esm.js' import { translate } from './i18n.js' export class Panel { - MODE = 'condensed' - CLASSNAME = 'left' - constructor(map) { this.parent = map._container this.map = map this.container = DomUtil.create('div', '', this.parent) + this.mode = 'condensed' + this.classname = 'left' DomEvent.disableClickPropagation(this.container) DomEvent.on(this.container, 'contextmenu', DomEvent.stopPropagation) // Do not activate our custom context menu. DomEvent.on(this.container, 'wheel', DomEvent.stopPropagation) @@ -16,7 +15,7 @@ export class Panel { } open(e) { - this.container.className = `with-transition panel ${this.CLASSNAME} ${this.MODE}` + this.container.className = `with-transition panel ${this.classname} ${this.mode}` this.container.innerHTML = '' const actionsContainer = DomUtil.create('ul', 'toolbox', this.container) const body = DomUtil.create('div', 'body', this.container) @@ -45,12 +44,12 @@ export class Panel { } resize() { - if (this.MODE === 'expanded') { - this.MODE = 'condensed' + if (this.mode === 'expanded') { + this.mode = 'condensed' this.container.classList.remove('expanded') this.container.classList.add('condensed') } else { - this.MODE = 'expanded' + this.mode = 'expanded' this.container.classList.remove('condensed') this.container.classList.add('expanded') } @@ -66,10 +65,16 @@ export class Panel { } export class EditPanel extends Panel { - CLASSNAME = 'right dark' + constructor(map) { + super(map) + this.classname = 'right dark' + } } export class FullPanel extends Panel { - CLASSNAME = 'full dark' - MODE = 'expanded' + constructor(map) { + super(map) + this.classname = 'full dark' + this.mode = 'expanded' + } } diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 89e0d1a6..7c6d8394 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -207,13 +207,13 @@ U.Map = L.Map.extend({ if (L.Util.queryString('share')) { this.share.open() } else if (this.options.onLoadPanel === 'databrowser') { - this.panel.MODE = 'expanded' + this.panel.mode = 'expanded' this.openBrowser() } else if (this.options.onLoadPanel === 'datalayers') { - this.panel.MODE = 'condensed' + this.panel.mode = 'condensed' this.openBrowser() } else if (this.options.onLoadPanel === 'caption') { - this.panel.MODE = 'condensed' + this.panel.mode = 'condensed' this.displayCaption() } else if (['facet', 'datafilters'].includes(this.options.onLoadPanel)) { this.openFacet() diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index 32fb378a..a50c7a1a 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -1,7 +1,7 @@ import json import re -from time import sleep from pathlib import Path +from time import sleep import pytest from playwright.sync_api import expect