Commit c525b7d7 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

selecting user data overlay activates empty background

parent 33021fed
Pipeline #2642 passed with stage
in 43 seconds
...@@ -223,8 +223,20 @@ CustomMap.prototype.openDataOverlay = function (param) { ...@@ -223,8 +223,20 @@ CustomMap.prototype.openDataOverlay = function (param) {
} }
ServerConnector.getSessionData(self.getProject()).setVisibleOverlays(ids); ServerConnector.getSessionData(self.getProject()).setVisibleOverlays(ids);
return self.refreshSelectedLayouts(); return self.refreshSelectedLayouts();
}).then(function () {
var backgroundToOpen;
for (var i = 0; i < self.getLayouts().length; i++) {
var overlay = self.getLayouts()[i];
if (overlay.getName().toLowerCase() === "empty") {
backgroundToOpen = overlay;
}
}
if (backgroundToOpen === undefined) {
logger.warn("Cannot find empty background overlay");
} else {
return self.openDataOverlay(backgroundToOpen.getId());
}
}); });
} }
} else { } else {
self.getGoogleMap().setMapTypeId(identifier.toString()); self.getGoogleMap().setMapTypeId(identifier.toString());
......
...@@ -116,6 +116,24 @@ describe('CustomMap', function () { ...@@ -116,6 +116,24 @@ describe('CustomMap', function () {
}); });
}); });
it("with non background overlay", function () {
var map = helper.createCustomMap();
var layout = helper.createLayout();
layout.setInitialized(true);
layout.setInputDataAvailable(true);
map.getModel().addLayout(layout);
var emptyBackground = helper.createLayout();
emptyBackground.setInputDataAvailable(false);
emptyBackground.setName("Empty");
map.getModel().addLayout(emptyBackground);
return map.openDataOverlay(layout.getId()).then(function () {
var backgroundId = ServerConnector.getSessionData(map.getProject()).getSelectedBackgroundOverlay();
assert.equal(backgroundId, emptyBackground.getId());
});
});
it("simple", function () { it("simple", function () {
var map = helper.createCustomMap(); var map = helper.createCustomMap();
var alias = helper.createAlias(map); var alias = helper.createAlias(map);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment