Bugs fixed: function clearButtons and a did not exist
Change-Id: I47e0f5f02ae2d355dea8c86c71fb07b8b87f39ec
diff --git a/dev/js/spec/pluginSpec.js b/dev/js/spec/pluginSpec.js
index f7514bd..b84fc65 100644
--- a/dev/js/spec/pluginSpec.js
+++ b/dev/js/spec/pluginSpec.js
@@ -190,5 +190,38 @@
KorAP.Panel['query'] = undefined;
manager.destroy();
});
+
+ it('Plugin buttons should be cleared after adding to panel', function () {
+
+ // Register plugin first
+ KorAP.Plugin = pluginServerClass.create();
+
+ KorAP.Plugin.register({
+ name : 'Check',
+ embed : [{
+ panel : 'query',
+ title : 'Translate',
+ onClick : {
+ template : 'test'
+ }
+ }]
+ });
+
+
+ var queryPanel = queryPanelClass.create();
+ var div = document.createElement('div');
+
+ div.appendChild(queryPanel.element());
+ KorAP.Panel = KorAP.Panel || {};
+ KorAP.Panel['query'] = queryPanel;
+ expect(KorAP.Plugin.buttonGroup('query').length).toEqual(0);
+
+ // Clean up
+ KorAP.Panel['query'] = undefined;
+ KorAP.Plugin.destroy();
+ KorAP.Plugin = undefined;
+ });
+
+
});
});
diff --git a/dev/js/src/panel/query.js b/dev/js/src/panel/query.js
index aed2a91..f0f1920 100644
--- a/dev/js/src/panel/query.js
+++ b/dev/js/src/panel/query.js
@@ -20,7 +20,8 @@
// Initialize panel
_init : function (opened) {
this._opened = opened;
-
+ var a = this.actions;
+
// If plugins are enabled, add all buttons for the query panel
if (KorAP.Plugin) {
var queryButtons = KorAP.Plugin.buttonGroup("query");
@@ -30,7 +31,7 @@
a.add.apply(a, queryButtons[i]);
};
- KorAP.Plugin.clearButtons("query")
+ KorAP.Plugin.clearButtonGroup("query")
};
return this;