diff --git a/docs/changelog.md b/docs/changelog.md index d1b2ac0e..1c022726 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -62,6 +62,9 @@ COMMIT; - local settings are now loaded from `/etc/umap/umap.conf` if available - fixed an issue where it was not possible to change the tilelayer if the tilelayer control was not added to the map (#587) +- `showLabel` is now a ternary value (instead of having this plus `labelHover`) + (#553) +- fixed resetting a select to undefined for inheritable fields (#551) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 6eb72185..bc8c72c5 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -8,6 +8,7 @@ L.FormBuilder.Element.include({ if (this.options.inheritable) { className += this.get(true) === undefined ? ' inheritable undefined' : ' inheritable '; } + className += ' umap-field-' + this.name; this.wrapper = L.DomUtil.create('div', className, this.form); this.header = L.DomUtil.create('div', 'header', this.wrapper); if (this.options.inheritable) { @@ -66,6 +67,11 @@ L.FormBuilder.Select.include({ clear: function () { this.select.value = ''; + }, + + getDefault: function () { + if (this.options.inheritable) return undefined + else return L.FormBuilder.Select.prototype.getDefault.call(this) } }); diff --git a/umap/static/umap/js/umap.xhr.js b/umap/static/umap/js/umap.xhr.js index 7e625784..d1b011f9 100644 --- a/umap/static/umap/js/umap.xhr.js +++ b/umap/static/umap/js/umap.xhr.js @@ -55,7 +55,6 @@ L.U.Xhr = L.Evented.extend({ xhr.onreadystatechange = function() { if (xhr.readyState === 4) { - console.log(xhr.status) if (xhr.status == 200) { settings.callback.call(settings.context || xhr, xhr.responseText, xhr); } diff --git a/umap/static/umap/test/DataLayer.js b/umap/static/umap/test/DataLayer.js index cff8591c..72ece389 100644 --- a/umap/static/umap/test/DataLayer.js +++ b/umap/static/umap/test/DataLayer.js @@ -1,4 +1,4 @@ -describe('L.DataLayer', function () { +describe('L.U.DataLayer', function () { var path = '/map/99/datalayer/edit/62/'; before(function () { @@ -202,6 +202,9 @@ describe('L.DataLayer', function () { changeSelectValue(qs('form#datalayer-advanced-properties select[name=iconClass]'), 'Circle'); assert.notOk(qs('div.umap-div-icon')); assert.ok(qs('div.umap-circle-icon')); + happen.click(qs('form#datalayer-advanced-properties .umap-field-iconClass .undefine')); + assert.notOk(qs('div.umap-circle-icon')); + assert.ok(qs('div.umap-div-icon')); clickCancel(); }); diff --git a/umap/static/umap/test/Feature.js b/umap/static/umap/test/Feature.js index afc7bd73..fce7ff3e 100644 --- a/umap/static/umap/test/Feature.js +++ b/umap/static/umap/test/Feature.js @@ -1,4 +1,4 @@ -describe('L.Utorage.FeatureMixin', function () { +describe('L.U.FeatureMixin', function () { before(function () { this.server = sinon.fakeServer.create(); diff --git a/umap/static/umap/test/Map.js b/umap/static/umap/test/Map.js index 11d0eff6..93616109 100644 --- a/umap/static/umap/test/Map.js +++ b/umap/static/umap/test/Map.js @@ -1,4 +1,4 @@ -describe('L.Umap.Map', function(){ +describe('L.U.Map', function(){ before(function () { this.server = sinon.fakeServer.create(); diff --git a/umap/static/umap/test/Marker.js b/umap/static/umap/test/Marker.js new file mode 100644 index 00000000..aec190d7 --- /dev/null +++ b/umap/static/umap/test/Marker.js @@ -0,0 +1,34 @@ +describe('L.U.Marker', function () { + + before(function () { + this.server = sinon.fakeServer.create(); + var datalayer_response = JSON.parse(JSON.stringify(RESPONSES.datalayer62_GET)); // Copy. + datalayer_response._umap_options.iconClass = 'Drop'; + this.server.respondWith('GET', '/datalayer/62/', JSON.stringify(datalayer_response)); + this.map = initMap({umap_id: 99}); + this.datalayer = this.map.getDataLayerByUmapId(62); + this.server.respond(); + }); + after(function () { + this.server.restore(); + resetMap(); + }); + + describe('#iconClassChange()', function () { + + it('should change icon class', function () { + enableEdit(); + happen.click(qs('div.umap-drop-icon')); + happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit')); + changeSelectValue(qs('form#umap-feature-shape-properties .umap-field-iconClass select[name=iconClass]'), 'Circle'); + assert.notOk(qs('div.umap-drop-icon')); + assert.ok(qs('div.umap-circle-icon')); + happen.click(qs('form#umap-feature-shape-properties .umap-field-iconClass .undefine')); + assert.notOk(qs('div.umap-circle-icon')); + assert.ok(qs('div.umap-drop-icon')); + clickCancel(); + }); + + }); + +}); diff --git a/umap/static/umap/test/_pre.js b/umap/static/umap/test/_pre.js index 63e88c82..386220dc 100644 --- a/umap/static/umap/test/_pre.js +++ b/umap/static/umap/test/_pre.js @@ -65,7 +65,7 @@ var cleanAlert = function () { }; var defaultDatalayerData = function (custom) { var _default = { - icon_class: 'Default', + iconClass: 'Default', name: 'Elephants', displayOnLoad: true, id: 62, diff --git a/umap/static/umap/test/index.html b/umap/static/umap/test/index.html index 639f31aa..f8bdaae5 100644 --- a/umap/static/umap/test/index.html +++ b/umap/static/umap/test/index.html @@ -70,6 +70,7 @@ +