diff --git a/frontend-js/src/test/js/helper.js b/frontend-js/src/test/js/helper.js index d59c71e24ea4606ae3a1ea21e2773616bec9fdf4..de0f857afc44bc782f7677d46384cad408543c3f 100644 --- a/frontend-js/src/test/js/helper.js +++ b/frontend-js/src/test/js/helper.js @@ -184,6 +184,11 @@ Helper.prototype.createUser = function () { }); }; +/** + * + * @param {AbstractCustomMap} [map] + * @returns {Alias} + */ Helper.prototype.createAlias = function (map) { var mapId; if (map === undefined) { @@ -359,17 +364,6 @@ Helper.prototype.createOverlay = function (model) { }); }; -Helper.prototype.createGoogleMap = function () { - return new google.maps.Map(testDiv, { - center: { - lat: -34.397, - lng: 150.644 - }, - scrollwheel: false, - zoom: 8 - }); -}; - Helper.prototype.createCustomMapOptions = function (project) { if (project === undefined) { project = this.createProject(); @@ -405,6 +399,16 @@ Helper.prototype.createCustomMap = function (project) { return new CustomMap(options); }; +/** + * + * @param {BioEntity} params.element + * @param {AbstractCustomMap} params.map + */ +Helper.prototype.createMarker = function (params) { + var position = params.element.getCenter(); + return params.map.getMapCanvas().createMarker({position: position, id: params.element.getId(), icon: "empty.png"}); +}; + /** * Changes url but saves the cookies. */ diff --git a/frontend-js/src/test/js/map/window/AliasInfoWindow-test.js b/frontend-js/src/test/js/map/window/AliasInfoWindow-test.js index 845f2bb295ce228d34b28cf3f3111074f7891c20..ab23b3e855eef90f8a7455d0b3485b5670fbcfe1 100644 --- a/frontend-js/src/test/js/map/window/AliasInfoWindow-test.js +++ b/frontend-js/src/test/js/map/window/AliasInfoWindow-test.js @@ -21,15 +21,13 @@ describe('AliasInfoWindow', function () { it("default", function () { var map = helper.createCustomMap(); - var alias = helper.createAlias(); - alias.setId(30001); + var alias = helper.createAlias(map); alias.setIsComplete(false); - alias.setModelId(map.getId()); - map.getModel().addAlias(alias); var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); assert.equal(alias, aliasWindow.getAlias()); @@ -58,7 +56,8 @@ describe('AliasInfoWindow', function () { var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); assert.equal(alias, aliasWindow.alias); @@ -75,7 +74,8 @@ describe('AliasInfoWindow', function () { var alias = helper.createAlias(map); var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); oc.searchNamesByTarget = function () { @@ -116,7 +116,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return aliasWindow.init() }).then(function () { @@ -145,7 +146,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return oc.getDetailDataByIdentifiedElement(ie, true); }).then(function (data) { @@ -168,7 +170,8 @@ describe('AliasInfoWindow', function () { var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return oc.getDetailDataByIdentifiedElement(new IdentifiedElement(alias), true).then(function (data) { @@ -197,7 +200,8 @@ describe('AliasInfoWindow', function () { var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return oc.getDetailDataByIdentifiedElement(new IdentifiedElement(alias), true).then(function (data) { @@ -234,7 +238,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { win = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return win.init(); }).then(function () { @@ -264,7 +269,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { win = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return win.init(); }).then(function () { @@ -301,7 +307,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { win = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); return win.init(); }).then(function () { @@ -322,7 +329,8 @@ describe('AliasInfoWindow', function () { var aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); assert.ok(functions.isDomElement(aliasWindow.createWaitingContentDiv())); @@ -342,7 +350,8 @@ describe('AliasInfoWindow', function () { }).then(function (alias) { aliasWindow = new AliasInfoWindow({ alias: alias, - map: map + map: map, + marker: helper.createMarker({element: alias, map: map}) }); aliasWindow.layoutAliases = [helper.createLayoutAlias(alias), null]; aliasWindow.layoutNames = ["x", "y"];