Add appending of unspecified documents
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 5f7d3ad..767f010 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -237,32 +237,32 @@
// Empty doc
var doc = KorAP.Doc.create();
- expect(doc.toString()).toEqual("");
+ expect(doc.toQuery()).toEqual("");
// Serialize string
doc = stringFactory.create();
- expect(doc.toString()).toEqual('author = "Max Birkendale"');
+ expect(doc.toQuery()).toEqual('author = "Max Birkendale"');
// Serialize string with quotes
doc = stringFactory.create({ "value" : 'Max "Der Coole" Birkendate'});
- expect(doc.toString()).toEqual('author = "Max \\"Der Coole\\" Birkendate"');
+ expect(doc.toQuery()).toEqual('author = "Max \\"Der Coole\\" Birkendate"');
// Serialize regex
doc = regexFactory.create();
- expect(doc.toString()).toEqual('title = /[^b]ee.+?/');
+ expect(doc.toQuery()).toEqual('title = /[^b]ee.+?/');
doc = regexFactory.create({
match: "match:ne"
});
- expect(doc.toString()).toEqual('title != /[^b]ee.+?/');
+ expect(doc.toQuery()).toEqual('title != /[^b]ee.+?/');
doc = dateFactory.create();
- expect(doc.toString()).toEqual('pubDate in 2014-11-05');
+ expect(doc.toQuery()).toEqual('pubDate in 2014-11-05');
doc = dateFactory.create({
value : "2014"
});
- expect(doc.toString()).toEqual('pubDate in 2014');
+ expect(doc.toQuery()).toEqual('pubDate in 2014');
});
});
@@ -411,7 +411,7 @@
it('should be serializable to String', function () {
var docGroup = docGroupFactory.create();
- expect(docGroup.toString()).toEqual('author = "Max Birkendale" & pubDate in 2014-12-05');
+ expect(docGroup.toQuery()).toEqual('author = "Max Birkendale" & pubDate in 2014-12-05');
docGroup = docGroupFactory.create({
"@type" : "korap:docGroup",
@@ -453,7 +453,7 @@
}
]
});
- expect(docGroup.toString()).toEqual(
+ expect(docGroup.toQuery()).toEqual(
'author = "Max Birkendale" | (pubDate since 2014-05-12 & pubDate until 2014-12-05 & foo != /[a]?bar/)'
);
});
@@ -463,10 +463,10 @@
it('should be initializable', function () {
var doc = KorAP.UnspecifiedDoc.create();
var docElement = doc.element();
- expect(docElement.getAttribute('class')).toEqual('unspecified');
+ expect(docElement.getAttribute('class')).toEqual('doc unspecified');
expect(docElement.firstChild.firstChild.data).toEqual('⋯');
expect(docElement.lastChild.getAttribute('class')).toEqual('operators');
- expect(doc.toString()).toEqual('⋯');
+ expect(doc.toQuery()).toEqual('⋯');
// Only removable
expect(docElement.lastChild.children.length).toEqual(0);
@@ -492,7 +492,7 @@
expect(docGroup.element().children[0].getAttribute('class')).toEqual('doc');
var unspec = docGroup.element().children[1];
- expect(unspec.getAttribute('class')).toEqual('unspecified');
+ expect(unspec.getAttribute('class')).toEqual('doc unspecified');
// Removable
expect(unspec.lastChild.children.length).toEqual(1);
@@ -781,7 +781,7 @@
it('should be initializable', function () {
var vc = KorAP.VirtualCollection.render();
expect(vc.element().getAttribute('class')).toEqual('vc');
- expect(vc.root().element().getAttribute('class')).toEqual('unspecified');
+ expect(vc.root().element().getAttribute('class')).toEqual('doc unspecified');
// Not removable
expect(vc.root().element().lastChild.children.length).toEqual(0);
@@ -882,7 +882,7 @@
it('should be modifiable by deletion in nested docGroups (root case)', function () {
var vc = nestedGroupFactory.create();
- expect(vc.toString()).toEqual(
+ expect(vc.toQuery()).toEqual(
'author = "Max Birkendale" | (pubDate since 2014-05-12 & pubDate until 2014-12-05)'
);
@@ -920,7 +920,7 @@
expect(vc.root().operation()).toEqual("and");
expect(vc.root().getOperand(0).ldType()).toEqual("doc");
- expect(vc.toString()).toEqual(
+ expect(vc.toQuery()).toEqual(
'pubDate since 2014-05-12 & pubDate until 2014-12-05'
);
});
@@ -961,7 +961,7 @@
// Structur is now:
// or(doc, and(doc, doc, or(doc, doc)))
- expect(vc.toString()).toEqual(
+ expect(vc.toQuery()).toEqual(
'author = "Max Birkendale" | (pubDate since 2014-05-12 & pubDate until 2014-12-05 & (title = "Der Birnbaum" | pubDate in 2014-12-05))'
);
@@ -980,8 +980,10 @@
// Structur is now:
// or(doc, and(doc, or(doc, doc)))
- expect(vc.toString()).toEqual(
- 'author = "Max Birkendale" | (pubDate since 2014-05-12 & (title = "Der Birnbaum" | pubDate in 2014-12-05))'
+ expect(vc.toQuery()).toEqual(
+ 'author = "Max Birkendale"' +
+ ' | (pubDate since 2014-05-12 & ' +
+ '(title = "Der Birnbaum" | pubDate in 2014-12-05))'
);
@@ -990,7 +992,7 @@
// Structur is now:
// or(doc, doc, doc)
- expect(vc.toString()).toEqual(
+ expect(vc.toQuery()).toEqual(
'author = "Max Birkendale" | title = "Der Birnbaum" | pubDate in 2014-12-05'
);
});
@@ -998,25 +1000,26 @@
it('should be reducible to unspecification', function () {
var vc = demoFactory.create();
- expect(vc.toString()).toEqual(vc.root().toString());
+ expect(vc.toQuery()).toEqual(vc.root().toQuery());
- expect(vc.toString()).toEqual('(Titel = "Baum" & Veröffentlichungsort = "hihi" & (Titel = "Baum" | Veröffentlichungsort = "hihi")) | Untertitel = "huhu"');
+ expect(vc.toQuery()).toEqual(
+ '(Titel = "Baum" & Veröffentlichungsort = "hihi" & ' +
+ '(Titel = "Baum" | Veröffentlichungsort = "hihi")) ' +
+ '| Untertitel = "huhu"');
expect(vc.root().element().lastChild.children[0].firstChild.nodeValue).toEqual('and');
expect(vc.root().element().lastChild.children[1].firstChild.nodeValue).toEqual('×');
-
expect(vc.root().delOperand(vc.root().getOperand(0)).update()).not.toBeUndefined();
+ expect(vc.toQuery()).toEqual('Untertitel = "huhu"');
- expect(vc.toString()).toEqual('Untertitel = "huhu"');
-
- expect(vc.root().element().lastChild.children[0].firstChild.nodeValue).toEqual('and');
- expect(vc.root().element().lastChild.children[1].firstChild.nodeValue).toEqual('or');
- expect(vc.root().element().lastChild.children[2].firstChild.nodeValue).toEqual('×');
+ var lc = vc.root().element().lastChild;
+ expect(lc.children[0].firstChild.nodeValue).toEqual('and');
+ expect(lc.children[1].firstChild.nodeValue).toEqual('or');
+ expect(lc.children[2].firstChild.nodeValue).toEqual('×');
// Clean everything
vc.clean();
- expect(vc.toString()).toEqual('⋯');
-
+ expect(vc.toQuery()).toEqual('⋯');
});
});