chore(sync) make the test pass

This commit is contained in:
Alexis Métaireau 2024-05-13 16:09:46 +02:00
parent b85ee4011e
commit 124b7278da
No known key found for this signature in database
GPG key ID: 1C21B876828E5FF2
4 changed files with 11 additions and 7 deletions

View file

@ -745,14 +745,12 @@ L.FormBuilder.Switch = L.FormBuilder.CheckBox.extend({
}) })
L.FormBuilder.FacetSearchBase = L.FormBuilder.Element.extend({ L.FormBuilder.FacetSearchBase = L.FormBuilder.Element.extend({
buildLabel: function () { buildLabel: function () {
this.label = L.DomUtil.element({ this.label = L.DomUtil.element({
tagName: 'legend', tagName: 'legend',
textContent: this.options.label, textContent: this.options.label,
}) })
} },
}) })
L.FormBuilder.FacetSearchChoices = L.FormBuilder.FacetSearchBase.extend({ L.FormBuilder.FacetSearchChoices = L.FormBuilder.FacetSearchBase.extend({
build: function () { build: function () {
@ -865,13 +863,13 @@ L.FormBuilder.MinMaxBase = L.FormBuilder.FacetSearchBase.extend({
}, },
isMinModified: function () { isMinModified: function () {
const default_ = this.minInput.getAttribute("value") const default_ = this.minInput.getAttribute('value')
const current = this.minInput.value const current = this.minInput.value
return current != default_ return current != default_
}, },
isMaxModified: function () { isMaxModified: function () {
const default_ = this.maxInput.getAttribute("value") const default_ = this.maxInput.getAttribute('value')
const current = this.maxInput.value const current = this.maxInput.value
return current != default_ return current != default_
}, },

View file

@ -33,6 +33,7 @@ U.Map = L.Map.extend({
includes: [ControlsMixin], includes: [ControlsMixin],
initialize: function (el, geojson) { initialize: function (el, geojson) {
this.sync = new U.SyncEngine(this)
// Locale name (pt_PT, en_US…) // Locale name (pt_PT, en_US…)
// To be used for Django localization // To be used for Django localization
if (geojson.properties.locale) L.setLocale(geojson.properties.locale) if (geojson.properties.locale) L.setLocale(geojson.properties.locale)
@ -153,7 +154,6 @@ U.Map = L.Map.extend({
this.options.onLoadPanel = 'datafilters' this.options.onLoadPanel = 'datafilters'
} }
this.sync = new U.SyncEngine(this)
let isDirty = false // self status let isDirty = false // self status
try { try {
Object.defineProperty(this, 'isDirty', { Object.defineProperty(this, 'isDirty', {

View file

@ -1368,6 +1368,12 @@ U.DataLayer = L.Evented.extend({
) )
popupFieldset.appendChild(builder.build()) popupFieldset.appendChild(builder.build())
// XXX I'm not sure **why** this is needed (as it's set during `this.initialize`)
// but apparently it's needed.
if (!U.Utils.isObject(this.options.remoteData)) {
this.options.remoteData = {}
}
const remoteDataFields = [ const remoteDataFields = [
[ [
'options.remoteData.url', 'options.remoteData.url',

View file

@ -5,7 +5,7 @@ from time import sleep
from playwright.sync_api import expect from playwright.sync_api import expect
from umap.models import DataLayer, Map from umap.models import DataLayer
from ..base import DataLayerFactory, MapFactory from ..base import DataLayerFactory, MapFactory