Introduced text type to VC and improve test suite

Change-Id: Ic51f3de112af5ec8d35bbae3bd97e988dbdb1a47
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 1392a9b..0f454c4 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -2063,7 +2063,6 @@
 
     it('should have a classed element', function () {
       var sv = stringValClass.create();
-      console.log(sv.element());
       expect(sv.element().classList.contains('regex')).toBe(false);
       expect(sv.regex()).toBe(false);
       sv.toggleRegex();
@@ -2085,9 +2084,12 @@
   });
 
   describe('KorAP.VC.Menu', function () {
+
+    var vc;
+    
     it('should be initializable', function () {
 
-      var vc = vcClass.create([
+      vc = vcClass.create([
         ['a', 'text'],
         ['b', 'string'],
         ['c', 'date']
@@ -2121,6 +2123,34 @@
       expect(list.getElementsByTagName("LI")[1].innerText).toEqual('e');
       expect(list.getElementsByTagName("LI")[2].innerText).toEqual('f');
     });
+
+    // Reinitialize to make tests stable
+    vc = vcClass.create([
+      ['d', 'text'],
+      ['e', 'string'],
+      ['f', 'date']
+    ]).fromJson();
+
+    it('should be clickable on key', function () {
+
+      // Click on "d"
+      vc.element().firstChild.firstChild.getElementsByTagName("LI")[0].click();
+      expect(vc.element().firstChild.firstChild.tagName).toEqual('SPAN');
+      expect(vc.element().firstChild.firstChild.innerText).toEqual('d');
+      expect(vc.element().firstChild.children[1].innerText).toEqual('eq');
+      expect(vc.element().firstChild.children[1].getAttribute('data-type')).toEqual('text');
+    });
+
+    it('should be clickable on operation', function () {
+      vc.element().firstChild.children[1].click();
+      expect(vc.element().firstChild.children[1].tagName).toEqual('UL');
+      var ul = vc.element().firstChild.children[1];
+      expect(ul.getElementsByTagName('li')[0].innerText).toEqual("eq");
+      expect(ul.getElementsByTagName('li')[1].innerText).toEqual("ne");
+      expect(ul.getElementsByTagName('li')[2].innerText).toEqual("contains");
+      expect(ul.getElementsByTagName('li')[3].innerText).toEqual("containsnot");
+      expect(ul.getElementsByTagName('li')[4]).toBeUndefined();
+    })
   });
 
   
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 77f6a26..18c621a 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -138,7 +138,6 @@
      */
     create : function (keyList) {
       var obj = Object.create(this)._init(keyList);
-      console.log(keyList);
       obj._root = unspecDocClass.create(obj);
       return obj;
     },
diff --git a/dev/js/src/vc/array.js b/dev/js/src/vc/array.js
index 9c7bf4d..8a47a3d 100644
--- a/dev/js/src/vc/array.js
+++ b/dev/js/src/vc/array.js
@@ -2,19 +2,19 @@
   return [
     // layerInfo                   // stored
     // tokenSource                 // stored
-    ['author', 'string'],          // text
+    ['author', 'text'],            // text
     // ['biblEditionStatement', 'string'], // stored
-    ['corpusAuthor', 'string'],    // text
+    ['corpusAuthor', 'text'],      // text
     // ['corpusEditor', 'string'], // stored
     ['corpusSigle', 'string'],     // string 
-    ['corpusSubTitle', 'string'],  // text
-    ['corpusTitle', 'string'],     // text
+    ['corpusSubTitle', 'text']  ,  // text
+    ['corpusTitle', 'text'],       // text
     ['creationDate', 'date'],      // int
-    ['docAuthor', 'string'],       // text
+    ['docAuthor', 'text'],         // text
     // ['docEditor', 'string'],    // stored
     ['docSigle', 'string'],        // string
-    ['docSubTitle', 'string'],     // text
-    ['docTitle', 'string'],        // text
+    ['docSubTitle', 'text'],       // text
+    ['docTitle', 'text'],          // text
     // ['editor', 'string'],       // stored
     // ['fileEditionStatement', 'string'], // stored
     ['foundries', 'string'],       // keywords
@@ -26,7 +26,7 @@
     // ['publisher', 'string'],    // stored
     ['pubPlace', 'string'],        // string
     // ['reference', 'string'],    // stored
-    ['subTitle', 'string'],        // text
+    ['subTitle', 'text'],          // text
     ['textClass', 'string'],       // keyword
     ['textColumn', 'string'],      // string
     ['textDomain', 'string'],      // string
@@ -34,6 +34,6 @@
     ['textType', 'string'],        // string
     ['textTypeArt', 'string'],     // string
     ['textTypeRef', 'string'],     // string
-    ['title', 'string']            // text
+    ['title', 'text']              // text
   ]
 });
diff --git a/dev/js/src/vc/doc.js b/dev/js/src/vc/doc.js
index f3e5559..f173de8 100644
--- a/dev/js/src/vc/doc.js
+++ b/dev/js/src/vc/doc.js
@@ -9,7 +9,6 @@
   'util'
 ], function (jsonldClass, rewriteListClass, stringValClass) {
 
-  _validRegexMatchRE  = new RegExp("^(?:eq|ne)$");
 
   const loc = KorAP.Locale;
   loc.EMPTY = loc.EMPTY || '⋯';
@@ -253,7 +252,7 @@
             // Try to create a regular expression
             var check = new RegExp(json["value"]);
 
-            if (!_validRegexMatchRE.test(this.matchop())) {
+            if (!KorAP._validStringMatchRE.test(this.matchop())) {
               KorAP.log(802, "Match type is not supported by value type");
 
               // Rewrite method
diff --git a/dev/js/src/vc/item.js b/dev/js/src/vc/item.js
index d2c6fc1..f9267e8 100644
--- a/dev/js/src/vc/item.js
+++ b/dev/js/src/vc/item.js
@@ -80,7 +80,8 @@
 
       // Create list item
       var li = document.createElement("li");
-      li.setAttribute("data-type", this._type);
+      if (this._type)
+        li.setAttribute("data-type", this._type);
       li.setAttribute("data-key",  this._key);
 
       // Connect action
diff --git a/dev/js/src/vc/unspecified.js b/dev/js/src/vc/unspecified.js
index daa7c88..0395685 100644
--- a/dev/js/src/vc/unspecified.js
+++ b/dev/js/src/vc/unspecified.js
@@ -120,7 +120,6 @@
 
       // Get the key menu
       var menu = KorAP._vcKeyMenu;
-
       // Add key menu element at the correct position
       this._element.insertBefore(
 	      menu.element(),