From 3236d351152f1b433560e7eb9bc42aa11523ec8f Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 15 May 2017 15:39:52 +0200
Subject: [PATCH] unit test for init contextmenu added

---
 frontend-js/src/main/js/gui/MapContextMenu.js       |  6 ++++++
 frontend-js/src/test/js/gui/MapContextMentu-test.js | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/frontend-js/src/main/js/gui/MapContextMenu.js b/frontend-js/src/main/js/gui/MapContextMenu.js
index 68008e6759..d2caf8181e 100644
--- a/frontend-js/src/main/js/gui/MapContextMenu.js
+++ b/frontend-js/src/main/js/gui/MapContextMenu.js
@@ -26,7 +26,13 @@ MapContextMenu.prototype._createMapContextMenuGui = function() {
   self.addOption("Select mode", function() {
     return self.getMap().turnOnOffDrawing();
   });
+};
 
+MapContextMenu.prototype.init = function() {
+  var self = this;
+  return self.createExportAsImageSubmenu().then(function(submenu){
+    self.addOption(submenu);
+  });
 };
 
 module.exports = MapContextMenu;
diff --git a/frontend-js/src/test/js/gui/MapContextMentu-test.js b/frontend-js/src/test/js/gui/MapContextMentu-test.js
index 0ff69f16bd..5b1c49f784 100644
--- a/frontend-js/src/test/js/gui/MapContextMentu-test.js
+++ b/frontend-js/src/test/js/gui/MapContextMentu-test.js
@@ -30,6 +30,16 @@ describe('MapContextMenu', function() {
     assert.equal(logger.getWarnings().length, 0);
   });
 
+  it('init', function() {
+    var map = helper.createCustomMap();
+
+    var menu = new MapContextMenu({
+      element : testDiv,
+      customMap : map
+    });
+    return menu.init();
+  });
+
   it('open comment dialog', function() {
     var map;
     return ServerConnector.getProject().then(function(project) {
-- 
GitLab