From d4b8ea6eda2f12b931c73dbd7d667c310042284c Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 13 Feb 2018 13:53:18 +0100 Subject: [PATCH] AliasSurface constructor set identified element --- frontend-js/src/main/js/map/surface/AliasSurface.js | 10 +++------- frontend-js/src/test/js/map/AbstractCustomMap-test.js | 2 +- .../src/test/js/map/surface/AliasSurface-test.js | 2 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend-js/src/main/js/map/surface/AliasSurface.js b/frontend-js/src/main/js/map/surface/AliasSurface.js index f062657fdc..84253e837f 100644 --- a/frontend-js/src/main/js/map/surface/AliasSurface.js +++ b/frontend-js/src/main/js/map/surface/AliasSurface.js @@ -22,6 +22,7 @@ function AliasSurface(params) { // original data this.setBioEntity(params.alias); + this.setIdentifiedElement(new IdentifiedElement(params.alias)); } AliasSurface.prototype = Object.create(AbstractSurfaceElement.prototype); @@ -106,14 +107,12 @@ AliasSurface.create = function (params) { rectangle.setOptions({ fillColor: color }); - var result = new AliasSurface({ + return new AliasSurface({ map: map, gmapObj: rectangle, alias: alias, onClick: params.onClick }); - result.setIdentifiedElement(new IdentifiedElement(alias)); - return result; }); }; @@ -163,15 +162,12 @@ AliasSurface.createFromIdentifiedElement = function (params) { strokeWeight: strokeWeight }); - var result = new AliasSurface({ + return new AliasSurface({ gmapObj: rectangle, map: map, onClick: params.onClick, alias: alias }); - result.setIdentifiedElement(element); - return result; - }); }; diff --git a/frontend-js/src/test/js/map/AbstractCustomMap-test.js b/frontend-js/src/test/js/map/AbstractCustomMap-test.js index 9337776ab5..3e956487f8 100644 --- a/frontend-js/src/test/js/map/AbstractCustomMap-test.js +++ b/frontend-js/src/test/js/map/AbstractCustomMap-test.js @@ -319,7 +319,7 @@ describe('AbstractCustomMap', function () { }); var surface = new AliasSurface({ map: map, - element: ie, + alias: alias, gmapObj: new google.maps.Rectangle({ map: map.getGoogleMap(), bounds: new google.maps.LatLngBounds(new google.maps.LatLng(0, 0), new google.maps.LatLng(0.5, 1)) diff --git a/frontend-js/src/test/js/map/surface/AliasSurface-test.js b/frontend-js/src/test/js/map/surface/AliasSurface-test.js index 029e8a7330..9f55e766c7 100644 --- a/frontend-js/src/test/js/map/surface/AliasSurface-test.js +++ b/frontend-js/src/test/js/map/surface/AliasSurface-test.js @@ -24,6 +24,7 @@ describe('AliasSurface', function() { }).then(function(result) { assert.ok(result instanceof AliasSurface); assert.equal(logger.getWarnings.length, 0); + assert.ok(result.getIdentifiedElement()); }); }); @@ -44,6 +45,7 @@ describe('AliasSurface', function() { }).then(function(result) { assert.ok(result instanceof AliasSurface); assert.equal(logger.getWarnings.length, 0); + assert.ok(result.getIdentifiedElement()); }); }); it("setBoundsForAlias", function() { -- GitLab