Add and remove constraints from the corpusByMatch assistant
Change-Id: I508312e6c431d0602471eb75fd06e845ffd63631
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index b23e309..4b865bc 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -58,7 +58,7 @@
{
"@type": "koral:field",
"key": "textClass",
- "type": "type:keywords",
+ "type": "type:keywords", // May not be necessary
"value": ["kultur", "film"]
},
{
@@ -714,7 +714,8 @@
expect(mel.children[0].tagName).toEqual('DIV');
expect(mel.children[0].children[0].tagName).toEqual('DT');
expect(mel.children[0].children[0].attributes[0].name).toEqual('title');
- expect(mel.children[0].children[1].tagName).toEqual('DD');
+ expect(mel.children[0].children[1].tagName).toEqual('DD');
+ expect(mel.children[0].children[1].getAttribute('data-type')).toEqual('type:text')
expect(mel.children[0].children[0].firstChild.nodeValue).toEqual('author');
expect(mel.children[0].children[1].firstChild.nodeValue).toEqual('Sprachpfleger, u.a.');
@@ -727,6 +728,7 @@
it('keywords should be formatted', function(){
//type:string or type:keyword should b not relevant
+ expect(mel.children[1].children[1].getAttribute('data-type')).toEqual('type:string')
expect(mel.children[1].children[1].classList.contains('metakeyvalues')).toBeTruthy;
expect(mel.children[1].children[1].children[0].tagName).toEqual('DIV');
expect(mel.children[1].children[1].children[0].firstChild.nodeValue).toEqual('corenlp');
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 61c3099..5e813aa 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -2879,14 +2879,14 @@
var e = f.element();
expect(e.classList.contains('vc')).toBeTruthy();
expect(e.classList.contains('fragment')).toBeTruthy();
- expect(e.children.length).toEqual(0);
+ expect(e.firstChild.children.length).toEqual(0);
});
it('should be expansable', function () {
var f = fragmentClass.create();
f.add("author", "Peter");
- var root = f.element().firstChild;
+ var root = f.element().lastChild.firstChild;
expect(root.classList.contains("doc")).toBeTruthy();
expect(root.children[0].tagName).toEqual("SPAN");
@@ -2898,7 +2898,7 @@
f.add("title", "Example");
- root = f.element().firstChild;
+ root = f.element().lastChild.firstChild;
expect(root.classList.contains("docGroup")).toBeTruthy();
@@ -2924,14 +2924,14 @@
it('should be reducible', function () {
var f = fragmentClass.create();
- expect(f.element().children.length).toEqual(0);
+ expect(f.element().lastChild.children.length).toEqual(0);
f.add("author", "Peter");
f.add("title", "Example");
- expect(f.element().children.length).toEqual(1);
+ expect(f.element().lastChild.children.length).toEqual(1);
- var root = f.element().firstChild;
+ var root = f.element().lastChild.firstChild;
expect(root.classList.contains("docGroup")).toBeTruthy();
@@ -2939,7 +2939,7 @@
f.remove("author","Peter");
- root = f.element().firstChild;
+ root = f.element().lastChild.firstChild;
expect(root.classList.contains("doc")).toBeTruthy();
expect(root.children[0].tagName).toEqual("SPAN");
@@ -2951,7 +2951,7 @@
f.remove("title","Example");
- expect(f.element().children.length).toEqual(0);
+ expect(f.element().lastChild.children.length).toEqual(0);
});
});
});