Correctly handle XML in KoralQuery highlighter
Change-Id: Id3f53e8409c2f898c6585e58e0a66563aeec0d13
diff --git a/dev/js/spec/kqViewSpec.js b/dev/js/spec/kqViewSpec.js
new file mode 100644
index 0000000..3870324
--- /dev/null
+++ b/dev/js/spec/kqViewSpec.js
@@ -0,0 +1,37 @@
+define(['view/result/koralquery','util'], function (kqClass) {
+ describe('KorAP.View.Result.KoralQuery', function () {
+
+ beforeEach(
+ function () {
+ KorAP.koralQuery = {}
+ }
+ );
+
+ afterEach(
+ function () {
+ KorAP.koralQuery = {}
+ }
+ );
+
+ it('should be initializable', function () {
+ KorAP.koralQuery = {
+ "test" : "cool"
+ };
+ var kq = kqClass.create();
+ var content = kq.element().firstChild.textContent;
+ expect(content).toMatch(/test/);
+ expect(content).toMatch(/cool/);
+ });
+
+ it('should deal with XML fragments', function () {
+ KorAP.koralQuery = {
+ "test" : "Das ist <b>Super!</b>"
+ };
+ var kq = kqClass.create();
+ var content = kq.element().firstChild.textContent;
+ expect(content).toMatch(/test/);
+ expect(content).toMatch(/Das ist <b>Super!<\/b>/);
+ });
+
+ });
+});