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

many identical icons for marker are resolved as single icon

parent 20c7c5ef
Pipeline #2587 passed with stage
in 43 seconds
......@@ -58,7 +58,15 @@ AbstractMarker.prototype.getIcon = function () {
} else if (icons.length === 1) {
return icons[0];
} else {
var result = icons[0];
//if we have many identical icons then return this specific icon
for (var i = 1; i < icons.length; i++) {
if (icons[i] !== result) {
return "marker/generic/search_green.png";
}
}
return result;
}
};
......
"use strict";
/* exported logger */
require("../../mocha-config.js");
var ServerConnector = require('../../ServerConnector-mock');
var logger = require('../../logger');
......@@ -8,76 +10,94 @@ var AliasMarker = require('../../../../main/js/map/marker/AliasMarker');
var IdentifiedElement = require('../../../../main/js/map/data/IdentifiedElement');
var assert = require('assert');
describe('AliasMarker', function() {
describe('AliasMarker', function () {
it("Constructor", function() {
var map;
var alias, marker;
return ServerConnector.getProject().then(function(project) {
it("Constructor", function () {
var map, alias, marker;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
return map.getModel().getAliasById(329171);
}).then(function(result) {
}).then(function (result) {
alias = result;
var identifiedElement = new IdentifiedElement(alias);
identifiedElement.setIcon("empty.png");
marker = new AliasMarker({
element : identifiedElement,
map : map
element: identifiedElement,
map: map
});
assert.equal(alias.getId(), marker.getId());
assert.equal(map, marker.getCustomMap());
assert.equal("empty.png", marker.getIcon());
return marker.init();
}).then(function() {
}).then(function () {
assert.equal(alias, marker.getAliasData());
assert.ok(marker._marker);
assert.ok(marker.getBounds());
assert.equal(0, logger.getWarnings().length);
});
});
it("getIcon", function () {
var map = helper.createCustomMap();
var element = helper.createAlias(map);
var marker = new AliasMarker({
element: new IdentifiedElement(element),
map: map
});
var icon = "test.png";
marker.addIcon("test.png");
assert.equal(icon, marker.getIcon());
marker.addIcon("test.png");
assert.equal(icon, marker.getIcon());
marker.removeIcon("test.png");
assert.equal(icon, marker.getIcon());
marker.removeIcon("test.png");
assert.equal(undefined, marker.getIcon());
});
it("click on marker", function() {
it("click on marker", function () {
var map;
var marker;
return ServerConnector.getProject().then(function(project) {
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
return map.getModel().getAliasById(329171);
}).then(function(alias) {
}).then(function (alias) {
var identifiedElement = new IdentifiedElement(alias);
marker = new AliasMarker({
element : identifiedElement,
map : map
element: identifiedElement,
map: map
});
return marker.init();
}).then(function() {
}).then(function () {
return google.maps.event.trigger(marker.getGoogleMarker(), "click");
});
});
it("click on marker when chemical is not available", function() {
it("click on marker when chemical is not available", function () {
var projectId = "complex_model_with_submaps";
helper.setUrl("http://test/?id=" + projectId);
var map;
var marker;
return ServerConnector.getProject(projectId).then(function(project) {
return ServerConnector.getProject(projectId).then(function (project) {
map = helper.createCustomMap(project);
var ov = helper.createChemicalDbOverlay(map);
ov.setAllowGeneralSearch(false);
ov.setAllowSearchById(false);
return map.getModel().getAliasById(345334);
}).then(function(alias) {
}).then(function (alias) {
var identifiedElement = new IdentifiedElement(alias);
marker = new AliasMarker({
element : identifiedElement,
map : map
element: identifiedElement,
map: map
});
return marker.init();
}).then(function() {
}).then(function () {
return google.maps.event.trigger(marker.getGoogleMarker(), "click");
});
......
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