Fix inheritable select not properly reset (fix #551)
This commit is contained in:
parent
67d7ab962c
commit
fded9d6201
9 changed files with 51 additions and 5 deletions
|
@ -62,6 +62,9 @@ COMMIT;
|
||||||
- local settings are now loaded from `/etc/umap/umap.conf` if available
|
- 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
|
- fixed an issue where it was not possible to change the tilelayer if the
|
||||||
tilelayer control was not added to the map (#587)
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ L.FormBuilder.Element.include({
|
||||||
if (this.options.inheritable) {
|
if (this.options.inheritable) {
|
||||||
className += this.get(true) === undefined ? ' inheritable undefined' : ' inheritable ';
|
className += this.get(true) === undefined ? ' inheritable undefined' : ' inheritable ';
|
||||||
}
|
}
|
||||||
|
className += ' umap-field-' + this.name;
|
||||||
this.wrapper = L.DomUtil.create('div', className, this.form);
|
this.wrapper = L.DomUtil.create('div', className, this.form);
|
||||||
this.header = L.DomUtil.create('div', 'header', this.wrapper);
|
this.header = L.DomUtil.create('div', 'header', this.wrapper);
|
||||||
if (this.options.inheritable) {
|
if (this.options.inheritable) {
|
||||||
|
@ -66,6 +67,11 @@ L.FormBuilder.Select.include({
|
||||||
|
|
||||||
clear: function () {
|
clear: function () {
|
||||||
this.select.value = '';
|
this.select.value = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefault: function () {
|
||||||
|
if (this.options.inheritable) return undefined
|
||||||
|
else return L.FormBuilder.Select.prototype.getDefault.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -55,7 +55,6 @@ L.U.Xhr = L.Evented.extend({
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
console.log(xhr.status)
|
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
settings.callback.call(settings.context || xhr, xhr.responseText, xhr);
|
settings.callback.call(settings.context || xhr, xhr.responseText, xhr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.DataLayer', function () {
|
describe('L.U.DataLayer', function () {
|
||||||
var path = '/map/99/datalayer/edit/62/';
|
var path = '/map/99/datalayer/edit/62/';
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
|
@ -202,6 +202,9 @@ describe('L.DataLayer', function () {
|
||||||
changeSelectValue(qs('form#datalayer-advanced-properties select[name=iconClass]'), 'Circle');
|
changeSelectValue(qs('form#datalayer-advanced-properties select[name=iconClass]'), 'Circle');
|
||||||
assert.notOk(qs('div.umap-div-icon'));
|
assert.notOk(qs('div.umap-div-icon'));
|
||||||
assert.ok(qs('div.umap-circle-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();
|
clickCancel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Utorage.FeatureMixin', function () {
|
describe('L.U.FeatureMixin', function () {
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
this.server = sinon.fakeServer.create();
|
this.server = sinon.fakeServer.create();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('L.Umap.Map', function(){
|
describe('L.U.Map', function(){
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
this.server = sinon.fakeServer.create();
|
this.server = sinon.fakeServer.create();
|
||||||
|
|
34
umap/static/umap/test/Marker.js
Normal file
34
umap/static/umap/test/Marker.js
Normal file
|
@ -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();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -65,7 +65,7 @@ var cleanAlert = function () {
|
||||||
};
|
};
|
||||||
var defaultDatalayerData = function (custom) {
|
var defaultDatalayerData = function (custom) {
|
||||||
var _default = {
|
var _default = {
|
||||||
icon_class: 'Default',
|
iconClass: 'Default',
|
||||||
name: 'Elephants',
|
name: 'Elephants',
|
||||||
displayOnLoad: true,
|
displayOnLoad: true,
|
||||||
id: 62,
|
id: 62,
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
<script src="./DataLayer.js"></script>
|
<script src="./DataLayer.js"></script>
|
||||||
<script src="./TableEditor.js"></script>
|
<script src="./TableEditor.js"></script>
|
||||||
<script src="./Feature.js"></script>
|
<script src="./Feature.js"></script>
|
||||||
|
<script src="./Marker.js"></script>
|
||||||
<script src="./Polyline.js"></script>
|
<script src="./Polyline.js"></script>
|
||||||
<script src="./Polygon.js"></script>
|
<script src="./Polygon.js"></script>
|
||||||
<script src="./Util.js"></script>
|
<script src="./Util.js"></script>
|
||||||
|
|
Loading…
Reference in a new issue