Renamed to Kalamar and updated Virtual Collection Chooser
diff --git a/public/js/spec/hintSpec.js b/public/js/spec/hintSpec.js
index 80807ff..a7232d4 100644
--- a/public/js/spec/hintSpec.js
+++ b/public/js/spec/hintSpec.js
@@ -705,4 +705,81 @@
var hint = KorAP.Hint.create();
});
});
+
+
+describe('KorAP.ContextAnalyzer', function () {
+
+ it('should be initializable', function () {
+ var analyzer = KorAP.ContextAnalyzer.create(")");
+ expect(analyzer).toBe(undefined);
+
+ analyzer = KorAP.ContextAnalyzer.create(".+?");
+ expect(analyzer).not.toBe(undefined);
+
+ });
+
+ it('should check correctly', function () {
+ analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
+ expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
+ expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
+ expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
+ expect(analyzer.test("impcnx/")).toEqual("impcnx/");
+ expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
+ expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
+ .toEqual("corenlp/ne_dewac_175m_600=");
+ });
+});
+
+describe('KorAP.InputField', function () {
+ var input;
+
+ beforeAll(function () {
+ input = document.createElement("input");
+ input.setAttribute("type", "text");
+ input.setAttribute("value", "abcdefghijklmno");
+ input.style.position = 'absolute';
+ input.style.top = "20px";
+ input.style.left = "30px";
+ input.focus();
+ input.selectionStart = 5;
+ });
+
+ afterAll(function () {
+ document.getElementsByTagName("body")[0].removeChild(input);
+ document.getElementsByTagName("body")[0].removeChild(
+ document.getElementById("searchMirror")
+ );
+ });
+
+ it('should be initializable', function () {
+ // Supports: context, searchField
+ var inputField = KorAP.InputField.create(input);
+ expect(inputField._element).not.toBe(undefined);
+ });
+
+ it('should have text', function () {
+ var inputField = KorAP.InputField.create(input);
+
+ expect(inputField.value).toEqual("abcdefghijklmno");
+ expect(inputField.element.selectionStart).toEqual(5);
+ expect(inputField.split()[0]).toEqual("abcde");
+ expect(inputField.split()[1]).toEqual("fghijklmno");
+
+ inputField.insert("xyz");
+ expect(inputField.split()[0]).toEqual("abcdexyz");
+ expect(inputField.split()[1]).toEqual("fghijklmno");
+
+ });
+
+ it('should be correctly positioned', function () {
+ var inputField = KorAP.InputField.create(input);
+ document.getElementsByTagName("body")[0].appendChild(input);
+ inputField.reposition();
+ expect(inputField.mirror.style.left).toEqual("30px");
+ expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
+ });
+});
+
+
+
*/
diff --git a/public/js/spec/menuSpec.js b/public/js/spec/menuSpec.js
index 98f6e72..cc569a8 100644
--- a/public/js/spec/menuSpec.js
+++ b/public/js/spec/menuSpec.js
@@ -1,3 +1,4 @@
+// The OwnMenu item
KorAP.OwnMenuItem = {
create : function (params) {
return Object.create(KorAP.MenuItem).upgradeTo(KorAP.OwnMenuItem)._init(params);
@@ -19,36 +20,8 @@
}
};
-KorAP.ComplexMenuItem = {
- create : function (params) {
- return Object.create(KorAP.MenuItem)
- .upgradeTo(KorAP.ComplexMenuItem)
- ._init(params);
- },
- content : function (content) {
- if (arguments.length === 1) {
- this._content = content;
- };
- return this._content;
- },
- _init : function (params) {
- if (params[0] === undefined)
- throw new Error("Missing parameters");
- var r = document.createElement('div');
- for (var i = 1; i <= params.length; i++) {
- var h = document.createElement('h' + i);
- h.appendChild(document.createTextNode(params[i-1]));
- r.appendChild(h);
- };
-
- this._content = r;
- this._lcField = ' ' + this.content().textContent.toLowerCase();
-
- return this;
- }
-};
-
+// The OwnMenu
KorAP.OwnMenu = {
create : function (params) {
return Object.create(KorAP.Menu)
@@ -58,17 +31,7 @@
};
-// Support for hint
-KorAP.HintMenu = {
- create : function (context, params) {
- var obj = Object.create(KorAP.Menu)
- .upgradeTo(KorAP.HintMenu)
- ._init(KorAP.HintMenuItem, params);
- obj._context = context;
- return obj;
- }
-};
-
+// HintMenuItem
KorAP.HintMenuItem = {
create : function (params) {
return Object.create(KorAP.MenuItem)
@@ -131,6 +94,50 @@
};
+// HintMenu
+KorAP.HintMenu = {
+ create : function (context, params) {
+ var obj = Object.create(KorAP.Menu)
+ .upgradeTo(KorAP.HintMenu)
+ ._init(KorAP.HintMenuItem, params);
+ obj._context = context;
+ return obj;
+ }
+};
+
+
+// The ComplexMenuItem
+KorAP.ComplexMenuItem = {
+ create : function (params) {
+ return Object.create(KorAP.MenuItem)
+ .upgradeTo(KorAP.ComplexMenuItem)
+ ._init(params);
+ },
+ content : function (content) {
+ if (arguments.length === 1) {
+ this._content = content;
+ };
+ return this._content;
+ },
+ _init : function (params) {
+ if (params[0] === undefined)
+ throw new Error("Missing parameters");
+
+ var r = document.createElement('div');
+ for (var i = 1; i <= params.length; i++) {
+ var h = document.createElement('h' + i);
+ h.appendChild(document.createTextNode(params[i-1]));
+ r.appendChild(h);
+ };
+
+ this._content = r;
+ this._lcField = ' ' + this.content().textContent.toLowerCase();
+
+ return this;
+ }
+};
+
+
describe('KorAP.MenuItem', function () {
it('should be initializable', function () {
@@ -305,6 +312,14 @@
describe('KorAP.Menu', function () {
+ var list = [
+ ["Constituency", "c=", "Example 1"],
+ ["Lemma", "l="],
+ ["Morphology", "m=", "Example 2"],
+ ["Part-of-Speech", "p="],
+ ["Syntax", "syn="]
+ ];
+
it('should be initializable', function () {
var list = [
["Constituency"],
@@ -342,13 +357,6 @@
});
it('should be visible', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
var menu = KorAP.HintMenu.create("cnx/", list);
expect(menu.delete()).toBe(undefined);
menu.limit(3);
@@ -368,14 +376,6 @@
});
it('should be filterable', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
-
var menu = KorAP.HintMenu.create("cnx/", list);
menu.limit(3);
@@ -421,14 +421,6 @@
it('should be nextable', function () {
- var list = [
- ["Constituency", "c=", "Example 1"],
- ["Lemma", "l="],
- ["Morphology", "m=", "Example 2"],
- ["Part-of-Speech", "p="],
- ["Syntax", "syn="]
- ];
-
var menu = KorAP.HintMenu.create("cnx/", list);
// Show only 3 items
@@ -464,332 +456,249 @@
expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (3)
+ // scroll!
menu.next();
-// expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+
expect(menu.shownItem(0).active()).toBe(false);
-// expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
-// expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(2).active()).toBe(true);
expect(menu.element().childNodes[3]).toBe(undefined);
- });
-});
-
-
-/*
-describe('KorAP.Menu', function () {
-
-
// Activate next (4)
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (5) - ROLL
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Active next (6)
menu.next();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
-
+ expect(menu.element().childNodes[3]).toBe(undefined);
});
-
it('should be prevable', function () {
- var menu = KorAP.Menu.create("cnx/", list);
+ var menu = KorAP.HintMenu.create("cnx/", list);
- KorAP.limit = 3;
+ menu.limit(3);
expect(menu.show()).toBe(undefined);
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (1) - roll to bottom
menu.prev();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (2)
menu.prev();
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (3)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Morphology");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Syntax");
+ expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (4)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Lemma");
+ expect(menu.shownItem(0).name()).toEqual("Lemma");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(2).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (5)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Constituency");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Lemma");
+ expect(menu.shownItem(1).name()).toEqual("Lemma");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Morphology");
+ expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Lemma");
+ expect(menu.shownItem(1).name()).toEqual("Lemma");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.shownItem(2).name).toEqual("Morphology");
+ expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
// Activate prev (6)
menu.prev();
// Activate prev (7)
menu.prev();
- expect(menu.shownItem(0).name).toEqual("Morphology");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.shownItem(2).name).toEqual("Syntax");
+ expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element.childNodes[3]).toBe(undefined);
+ expect(menu.element().childNodes[3]).toBe(undefined);
});
- it('should be navigatable and filterable (prefix = "o")', function () {
- var menu = KorAP.Menu.create("cnx/", list);
- KorAP.limit = 2;
+ it('should be navigatable and filterable (prefix = "o")', function () {
+ var menu = KorAP.HintMenu.create("cnx/", list);
+ menu.limit(2);
expect(menu.show("o")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
-
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Morphology");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(0).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-<em>o</em>f-Speech</strong>");
+ expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (3)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
+
it('should be navigatable and filterable (prefix = "ex", "e")', function () {
- var menu = KorAP.Menu.create("cnx/", list);
+ var menu = KorAP.HintMenu.create("cnx/", list);
- KorAP.limit = 2;
-
+ menu.limit(2);
expect(menu.show("ex")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Reset limit
- KorAP.limit = 5;
+ menu.limit(5);
// Change show
expect(menu.show("e")).toBe(undefined);
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (2)
menu.next();
- expect(menu.shownItem(0).name).toEqual("Constituency");
- expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+ expect(menu.shownItem(0).name()).toEqual("Constituency");
+ expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.shownItem(1).name).toEqual("Morphology");
- expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+ expect(menu.shownItem(1).name()).toEqual("Morphology");
+ expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
});
-
-describe('KorAP.ContextAnalyzer', function () {
-
- it('should be initializable', function () {
- var analyzer = KorAP.ContextAnalyzer.create(")");
- expect(analyzer).toBe(undefined);
-
- analyzer = KorAP.ContextAnalyzer.create(".+?");
- expect(analyzer).not.toBe(undefined);
-
- });
-
- it('should check correctly', function () {
- analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
- expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
- expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
- expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
- expect(analyzer.test("impcnx/")).toEqual("impcnx/");
- expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
- expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
- .toEqual("corenlp/ne_dewac_175m_600=");
- });
-});
-
-describe('KorAP.InputField', function () {
- var input;
-
- beforeAll(function () {
- input = document.createElement("input");
- input.setAttribute("type", "text");
- input.setAttribute("value", "abcdefghijklmno");
- input.style.position = 'absolute';
- input.style.top = "20px";
- input.style.left = "30px";
- input.focus();
- input.selectionStart = 5;
- });
-
- afterAll(function () {
- document.getElementsByTagName("body")[0].removeChild(input);
- document.getElementsByTagName("body")[0].removeChild(
- document.getElementById("searchMirror")
- );
- });
-
- it('should be initializable', function () {
- // Supports: context, searchField
- var inputField = KorAP.InputField.create(input);
- expect(inputField._element).not.toBe(undefined);
- });
-
- it('should have text', function () {
- var inputField = KorAP.InputField.create(input);
-
- expect(inputField.value).toEqual("abcdefghijklmno");
- expect(inputField.element.selectionStart).toEqual(5);
- expect(inputField.split()[0]).toEqual("abcde");
- expect(inputField.split()[1]).toEqual("fghijklmno");
-
- inputField.insert("xyz");
- expect(inputField.split()[0]).toEqual("abcdexyz");
- expect(inputField.split()[1]).toEqual("fghijklmno");
-
- });
-
- it('should be correctly positioned', function () {
- var inputField = KorAP.InputField.create(input);
- document.getElementsByTagName("body")[0].appendChild(input);
- inputField.reposition();
- expect(inputField.mirror.style.left).toEqual("30px");
- expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
- });
-});
-*/
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 49e9275..1a24fb6 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -35,37 +35,37 @@
};
var demoFactory = buildFactory(KorAP.VirtualCollection, {
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:and",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
},
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
@@ -75,7 +75,7 @@
]
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Untertitel",
"value":"huhu",
"match":"match:eq"
@@ -90,7 +90,7 @@
var stringFactory = buildFactory(KorAP.Doc, {
"key" : "author",
"value" : "Max Birkendale",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
// Create example factories
@@ -99,7 +99,7 @@
"type" : "type:date",
"match" : "match:eq",
"value" : "2014-11-05",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
// Create example factories
@@ -107,7 +107,7 @@
"key" : "title",
"type" : "type:regex",
"value" : "[^b]ee.+?",
- "@type" : "korap:doc"
+ "@type" : "koral:doc"
});
it('should be initializable', function () {
@@ -251,7 +251,7 @@
// Serialize string
doc = stringFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:string",
"key" : "author",
"value" : "Max Birkendale",
@@ -261,7 +261,7 @@
// Serialize regex
doc = regexFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:regex",
"value" : "[^b]ee.+?",
"match" : "match:eq",
@@ -272,7 +272,7 @@
match: "match:ne"
});
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:regex",
"value" : "[^b]ee.+?",
"match" : "match:ne",
@@ -281,7 +281,7 @@
doc = dateFactory.create();
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:date",
"value" : "2014-11-05",
"match" : "match:eq",
@@ -292,7 +292,7 @@
value : "2014"
});
expect(doc.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"type" : "type:date",
"value" : "2014",
"match" : "match:eq",
@@ -339,7 +339,7 @@
var docFactory = buildFactory(
KorAP.Doc,
{
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"match":"match:eq",
"key" : "author",
"value" : "Max Birkendale"
@@ -348,7 +348,7 @@
var docGroupFactory = buildFactory(
KorAP.DocGroup, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
docFactory.create().toJson(),
@@ -455,18 +455,18 @@
var docGroup = docGroupFactory.create();
expect(docGroup.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -481,36 +481,36 @@
expect(docGroup.toQuery()).toEqual('author = "Max Birkendale" & pubDate in 2014-12-05');
docGroup = docGroupFactory.create({
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'foo',
"match": 'match:ne',
"value": '[a]?bar',
@@ -545,7 +545,7 @@
expect(docGroup.operation()).toEqual('or');
docGroup.append({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -577,7 +577,7 @@
expect(docGroup.operation()).toEqual('or');
docGroup.append({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -643,7 +643,7 @@
describe('KorAP.Doc element', function () {
it('should be initializable', function () {
var docElement = KorAP.Doc.create(undefined, {
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -660,7 +660,7 @@
expect(docE.children[2].getAttribute('data-type')).toEqual('string');
expect(docElement.toJson()).toEqual(jasmine.objectContaining({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -672,18 +672,18 @@
it('should be initializable', function () {
var docGroup = KorAP.DocGroup.create(undefined, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -721,29 +721,29 @@
it('should be deserializable with nested groups', function () {
var docGroup = KorAP.DocGroup.create(undefined, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
@@ -787,18 +787,18 @@
describe('KorAP.VirtualCollection', function () {
var simpleGroupFactory = buildFactory(KorAP.DocGroup, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -808,29 +808,29 @@
});
var nestedGroupFactory = buildFactory(KorAP.VirtualCollection, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:or",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key" : 'author',
"match": 'match:eq',
"value": 'Max Birkendale',
"type": 'type:string'
},
{
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
@@ -842,25 +842,25 @@
});
var flatGroupFactory = buildFactory(KorAP.VirtualCollection, {
- "@type" : "korap:docGroup",
+ "@type" : "koral:docGroup",
"operation" : "operation:and",
"operands" : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:geq',
"value": '2014-05-12',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:leq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'foo',
"match": 'match:eq',
"value": 'bar',
@@ -880,7 +880,7 @@
it('should be based on a doc', function () {
var vc = KorAP.VirtualCollection.render({
- "@type" : "korap:doc",
+ "@type" : "koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -1115,37 +1115,37 @@
it('should flatten on import', function () {
var vc = KorAP.VirtualCollection.create().render({
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
},
{
- "@type":"korap:docGroup",
+ "@type":"koral:docGroup",
"operation":"operation:or",
"operands":[
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Veröffentlichungsort",
"value":"hihi",
"match":"match:eq"
@@ -1155,7 +1155,7 @@
]
},
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Untertitel",
"value":"huhu",
"match":"match:eq"
@@ -1211,27 +1211,27 @@
describe('KorAP._delete (event)', function () {
var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1242,7 +1242,7 @@
it('should clean on root docs', function () {
var vc = KorAP.VirtualCollection.render({
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1261,18 +1261,18 @@
it ('should remove on nested docs', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1291,18 +1291,18 @@
it ('should clean on doc groups', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1364,43 +1364,43 @@
it ('should remove on nested doc groups (list flattening)', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
},
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'yeah',
'value' : 'juhu'
}
@@ -1443,27 +1443,27 @@
describe('KorAP._add (event)', function () {
var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:docGroup',
+ "@type" : 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'title',
'value' : 'Hello World!'
},
{
- '@type' : 'korap:doc',
+ '@type' : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1475,18 +1475,18 @@
it ('should add new unspecified doc with "and"', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1520,18 +1520,18 @@
it ('should add new unspecified doc with "or"', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1710,18 +1710,18 @@
it ('should wrap on root', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
"type": 'type:date'
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'foo',
'value' : 'bar'
}
@@ -1744,7 +1744,7 @@
it ('should add on root (case "and")', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1766,7 +1766,7 @@
it ('should add on root (case "or")', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'pubDate',
"match": 'match:eq',
"value": '2014-12-05',
@@ -1787,36 +1787,36 @@
it ('should support multiple sub groups per group', function () {
var vc = KorAP.VirtualCollection.render(
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:or',
'operands' : [
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'title',
"value": 't1',
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'title',
'value' : 't2'
}
]
},
{
- "@type": 'korap:docGroup',
+ "@type": 'koral:docGroup',
'operation' : 'operation:and',
'operands' : [
{
- "@type": 'korap:doc',
+ "@type": 'koral:doc',
"key": 'title',
"value": 't3',
},
{
- "@type" : 'korap:doc',
+ "@type" : 'koral:doc',
'key' : 'title',
'value' : 't4'
}
@@ -1844,7 +1844,7 @@
it('should be initializable', function () {
var rewrite = KorAP.Rewrite.create({
- "@type" : "korap:rewrite",
+ "@type" : "koral:rewrite",
"operation" : "operation:modification",
"src" : "querySerializer",
"scope" : "tree"
@@ -1855,7 +1855,7 @@
it('should be deserialized by docs', function () {
var doc = KorAP.Doc.create(undefined,
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq"
@@ -1866,13 +1866,13 @@
doc = KorAP.Doc.create(undefined,
{
- "@type":"korap:doc",
+ "@type":"koral:doc",
"key":"Titel",
"value":"Baum",
"match":"match:eq",
"rewrites" : [
{
- "@type" : "korap:rewrite",
+ "@type" : "koral:rewrite",
"operation" : "operation:modification",
"src" : "querySerializer",
"scope" : "tree"
@@ -1888,3 +1888,11 @@
});
*/
});
+/*
+describe('KorAP.DocKey', function () {
+ it('should be initializable', function () {
+ var docKey = KorAP.DocKey.create();
+ expect(docKey.toString()).toEqual('...');
+ });
+});
+*/