Fix Query Creator

Change-Id: I55e48f3f73b36c9afe6647091829935d792d9c1d
diff --git a/dev/js/spec/queryCreatorSpec.js b/dev/js/spec/queryCreatorSpec.js
index c0953ba..09189bc 100644
--- a/dev/js/spec/queryCreatorSpec.js
+++ b/dev/js/spec/queryCreatorSpec.js
@@ -681,5 +681,31 @@
       expect(cell.classList.contains("chosen")).toBeFalsy();
       expect(qc.toString()).toEqual("[orth=Baum]");
     });
+
+    it('should add fragment to QueryBar', 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]");
+
+      // May break
+      qc._ql = document.createElement('select');
+      let opt = qc._ql.appendChild(document.createElement('option'));
+      opt.value='cosmas 2';
+      let opt2 = qc._ql.appendChild(document.createElement('option'));
+      opt2.value='poliqarp';
+
+      qc._q = document.createElement('input');
+      
+      qc._element.click();
+
+      expect(qc._ql.selectedIndex).toEqual(1);
+      expect(qc._q.value).toEqual("[orth=Baum]");
+    });
   });
 });