Add panel types
Change-Id: I27692ae25756924993a0b1843d8227fa83c590f8
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 0d1615f..4016bdc 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -724,6 +724,8 @@
// Add table
matchObj.panel.addTable();
+ expect(matchObj.panel.type).toEqual('match');
+
// now
var infotable = matchElement.children[1];
expect(infotable.tagName).toEqual('DIV');
diff --git a/dev/js/spec/panelSpec.js b/dev/js/spec/panelSpec.js
index e53c464..9799b07 100644
--- a/dev/js/spec/panelSpec.js
+++ b/dev/js/spec/panelSpec.js
@@ -30,6 +30,8 @@
it('should be initializable', function () {
var panel = panelClass.create();
var e = panel.element();
+
+ expect(panel.type).toEqual('base');
expect(e.tagName).toEqual("DIV");
expect(e.classList.contains("panel")).toBeTruthy();
expect(e.firstChild.tagName).toEqual("DIV");
@@ -118,6 +120,7 @@
it('should be initializable', function () {
var show = {};
var result = resultClass.create(show);
+ expect(result.type).toEqual('result');
expect(result.element().children.length).toEqual(2);
expect(result.element().firstChild.children.length).toEqual(0);
});
@@ -201,6 +204,7 @@
// Create pagination class object
var pagination = paginationClass.create();
let list = pagination.actions().element();
+ expect(pagination.type).toEqual('pagination');
expect(list.classList.contains('button-group-list')).toBeTruthy();
expect(list.classList.contains('visible')).toBeFalsy();
diff --git a/dev/js/src/panel.js b/dev/js/src/panel.js
index 63eea6c..a79fad7 100644
--- a/dev/js/src/panel.js
+++ b/dev/js/src/panel.js
@@ -10,6 +10,8 @@
define(['buttongroup', 'util'], function (buttonGroupClass) {
return {
+ type : 'base',
+
create : function (classes) {
return Object.create(this)._init(classes);
},
diff --git a/dev/js/src/panel/match.js b/dev/js/src/panel/match.js
index 6a3fe57..33e7dc9 100644
--- a/dev/js/src/panel/match.js
+++ b/dev/js/src/panel/match.js
@@ -27,6 +27,8 @@
loc.ADDTREE = loc.ADDTREE || 'Relations';
return {
+ type : 'match',
+
create : function (match) {
return Object.create(panelClass)._init(['matchinfo']).upgradeTo(this)._init(match);
},
diff --git a/dev/js/src/panel/pagination.js b/dev/js/src/panel/pagination.js
index f084e51..dd3331c 100644
--- a/dev/js/src/panel/pagination.js
+++ b/dev/js/src/panel/pagination.js
@@ -19,6 +19,8 @@
return {
+ type : 'pagination',
+
create : function () {
return Object.create(panelClass)._init(['pagination']).upgradeTo(this)._init();
},
diff --git a/dev/js/src/panel/query.js b/dev/js/src/panel/query.js
index a4658b0..0eca1b7 100644
--- a/dev/js/src/panel/query.js
+++ b/dev/js/src/panel/query.js
@@ -15,6 +15,8 @@
const loc = KorAP.Locale;
return {
+ type : 'query',
+
create : function (opened) {
return Object.create(panelClass)._init(['query']).upgradeTo(this)._init(opened);
},
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index 94ab856..7d771ad 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -20,6 +20,8 @@
const aRoll = ['left', 'right','center'];
return {
+ type : 'result',
+
create : function (opened) {
return Object.create(panelClass)._init(['result']).upgradeTo(this)._init(opened);
},
diff --git a/dev/js/src/panel/vc.js b/dev/js/src/panel/vc.js
index b9dc7a2..4ce7a5d 100644
--- a/dev/js/src/panel/vc.js
+++ b/dev/js/src/panel/vc.js
@@ -22,6 +22,8 @@
loc.VERB_SHOWSTAT = loc.VERB_SHOWSTAT || 'Corpus Statistics';
return {
+ type : 'vc',
+
create : function (vc) {
return Object.create(panelClass)._init(['vcinfo']).upgradeTo(this)._init(vc);
},