Show cut info at the end of token views
Change-Id: I316fd6a5c6fe30b93b43cb4de997804f4a2e9501
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 2004d4f..1a4bd2b 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -486,7 +486,7 @@
it('should parse into a table (async)', function () {
expect(table).toBeTruthy();
- expect(table.length()).toBe(4);
+ expect(table.length()).toBe(5);
expect(table.getToken(0)).toBe("meist");
expect(table.getToken(1)).toBe("deutlich");
@@ -518,9 +518,10 @@
expect(tr.children[3].classList.contains('mark')).toBeTruthy();
expect(tr.children[4].firstChild.nodeValue).toBe('leistungsfähiger');
expect(tr.children[4].classList.contains('mark')).toBeFalsy();
- expect(tr.children[4].hasAttribute("title").toBeFalsy();
+ expect(tr.children[4].hasAttribute("title")).toBeFalsy();
expect(tr.children[5].firstChild.nodeValue).toBe(longString);
expect(tr.children[5].getAttribute("title")).toBe(longString);
+ expect(tr.children[6].classList.contains('cutted')).toBeTruthy();
// first row
tr = e.children[1].children[0];
diff --git a/dev/js/spec/queryCreatorSpec.js b/dev/js/spec/queryCreatorSpec.js
index 5c5cddf..70f3f34 100644
--- a/dev/js/spec/queryCreatorSpec.js
+++ b/dev/js/spec/queryCreatorSpec.js
@@ -101,6 +101,40 @@
};
+function matchTableCuttedFactory () {
+ var table = document.createElement('div');
+ table.className = 'matchtable';
+ table.innerHTML =
+ " <table>" +
+ " <thead>" +
+ " <tr>" +
+ " <th>Foundry</th>" +
+ " <th>Layer</th>" +
+ " <th>Baum</th>" +
+ " <th class=\"cutted\"></th>" +
+ " </tr>" +
+ " </thead>" +
+ " <tbody>" +
+ " <tr tabindex=\"0\">" +
+ " <th>corenlp</th>" +
+ " <th>p</th>" +
+ " <td>NN</td>" +
+ " <td></td>" +
+ " </tr>" +
+ " <tr tabindex=\"0\">" +
+ " <th>opennlp</th>" +
+ " <th>p</th>" +
+ " <td>NN</td>" +
+ " <td></td>" +
+ " </tr>" +
+ " </tbody>" +
+ " </table>";
+ var info = document.createElement('div');
+ info.appendChild(table);
+ return table;
+};
+
+
define(['match/querycreator'], function (qcClass) {
describe('KorAP.QueryCreator', function () {
@@ -599,5 +633,24 @@
expect(cell.classList.contains("mark")).toBeTruthy();
expect(cell.classList.contains("chosen")).toBeFalsy();
});
+
+ it('should ignore cutted columns', function () {
+ var matchTable = matchTableCuttedFactory();
+ var qc = qcClass.create(matchTable);
+ expect(qc.toString()).toEqual("");
+
+ var cell = matchTable.querySelector("thead > tr > th:nth-child(3)");
+ expect(cell.classList.contains("chosen")).toBeFalsy();
+ cell.click();
+ expect(cell.classList.contains("chosen")).toBeTruthy();
+ expect(qc.toString()).toEqual("[orth=Baum]");
+
+ cell = matchTable.querySelector("thead > tr > th:nth-child(4)");
+ expect(cell.classList.contains("chosen")).toBeFalsy();
+ expect(cell.classList.contains("cutted")).toBeTruthy();
+ cell.click();
+ expect(cell.classList.contains("chosen")).toBeFalsy();
+ expect(qc.toString()).toEqual("[orth=Baum]");
+ });
});
});