Fixed querycreator to ignore empty cells when selecting a whole row (2)
Change-Id: I9e18d236defa1262494bae92c3e695fc16aa1833
diff --git a/dev/js/spec/queryCreatorSpec.js b/dev/js/spec/queryCreatorSpec.js
index a95b127..71a567f 100644
--- a/dev/js/spec/queryCreatorSpec.js
+++ b/dev/js/spec/queryCreatorSpec.js
@@ -357,5 +357,32 @@
expect(qc.toString()).toEqual("[corenlp/p=ART & opennlp/p=ART][corenlp/p=ADJA][corenlp/p=NN]");
});
+
+ it('should ignore empty terms in whole rows', function () {
+ var matchInfo = matchInfoFactory();
+ var qc = qcClass.create(matchInfo);
+ expect(qc.toString()).toEqual("");
+
+ var opennlpRow = matchInfo.querySelector("tbody > tr:nth-child(2)");
+
+ expect(opennlpRow.querySelector("td:nth-child(3).chosen")).toBeNull();
+ expect(opennlpRow.querySelector("td:nth-child(4).chosen")).toBeNull();
+ expect(opennlpRow.querySelector("td:nth-child(5).chosen")).toBeNull();
+ expect(opennlpRow.querySelector("td:nth-child(6).chosen")).toBeNull();
+
+ expect(qc.toString()).toEqual("");
+
+ // Mark all opennlp lists
+ cell = opennlpRow.querySelector("th:nth-child(1)");
+ expect(cell.innerText).toEqual("opennlp");
+ expect(cell.classList.contains("chosen")).toBe(false);
+ cell.click();
+ expect(cell.classList.contains("chosen")).toBe(false);
+
+ expect(opennlpRow.querySelector("td:nth-child(3).chosen")).toBeTruthy();
+ expect(opennlpRow.querySelector("td:nth-child(4).chosen")).toBeTruthy();
+ expect(opennlpRow.querySelector("td:nth-child(5).chosen")).toBeNull();
+ expect(opennlpRow.querySelector("td:nth-child(6).chosen")).toBeTruthy();
+ });
});
});