Fix reinitialization of VC creator singleton list

Change-Id: Ife24bf168fafc821c086b2ce6efba38b5f2f6688
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 89bd897..1392a9b 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -17,14 +17,14 @@
   buildFactory = function (objClass, defaults) {
     return {
       create : function (overwrites) {
-	      var newObj = {};
-	      for (var prop in defaults) {
-	        newObj[prop] = defaults[prop];
-	      };
-	      for (var prop in overwrites) {
-	        newObj[prop] = overwrites[prop];
-	      };
-	      return objClass.create().fromJson(newObj);
+        var newObj = {};
+        for (var prop in defaults) {
+          newObj[prop] = defaults[prop];
+        };
+        for (var prop in overwrites) {
+          newObj[prop] = overwrites[prop];
+        };
+        return objClass.create().fromJson(newObj);
       }
     }
   };
@@ -46,9 +46,9 @@
     "operation":"operation:or",
     "operands":[
       {
-	"@type":"koral:docGroup",
-	"operation":"operation:and",
-	"operands":[
+        "@type":"koral:docGroup",
+        "operation":"operation:and",
+        "operands":[
           {
             "@type":"koral:doc",
             "key":"Titel",
@@ -66,26 +66,26 @@
             "operation":"operation:or",
             "operands":[
               {
-		"@type":"koral:doc",
-		"key":"Titel",
-		"value":"Baum",
-		"match":"match:eq"
+                "@type":"koral:doc",
+                "key":"Titel",
+                "value":"Baum",
+                "match":"match:eq"
               },
               {
-		"@type":"koral:doc",
-		"key":"Veröffentlichungsort",
-		"value":"hihi",
-		"match":"match:eq"
+                "@type":"koral:doc",
+                "key":"Veröffentlichungsort",
+                "value":"hihi",
+                "match":"match:eq"
               }
             ]
           }
-	]
+        ]
       },
       {
-	"@type":"koral:doc",
-	"key":"Untertitel",
-	"value":"huhu",
-	"match":"match:eq"
+        "@type":"koral:doc",
+        "key":"Untertitel",
+        "value":"huhu",
+        "match":"match:contains"
       }
     ]
   });
@@ -99,6 +99,14 @@
     });
 
     // Create example factories
+    var textFactory = buildFactory(docClass, {
+      "key"   : "author",
+      "value" : "Birkendale",
+      "match" : "match:contains",
+      "@type" : "koral:doc"
+    });
+
+    // Create example factories
     var dateFactory = buildFactory(docClass, {
       "key"   : "pubDate",
       "type"  : "type:date",
@@ -150,19 +158,19 @@
 
       // No valid string
       doc = stringFactory.create({
-	      value : undefined
+        value : undefined
       });
       expect(doc).toBeUndefined();
 
       // No valid string
       doc = stringFactory.create({
-	      value : { "foo" : "bar" }
+        value : { "foo" : "bar" }
       });
       expect(doc).toBeUndefined();
 
       // Change match type
       doc = stringFactory.create({
-	      "match" : "match:ne"
+        "match" : "match:ne"
       });
 
       expect(doc.matchop()).toEqual('ne');
@@ -172,7 +180,7 @@
 
       // Invalid match type
       doc = stringFactory.create({
-	      "match" : { "foo" : "bar" }
+        "match" : { "foo" : "bar" }
       });
       expect(doc).toBeUndefined();
     });
@@ -186,21 +194,21 @@
 
       // change matcher
       doc = regexFactory.create({
-	      match : "match:ne"
+        match : "match:ne"
       });
       expect(doc.matchop()).toEqual('ne');
       expect(doc.rewrites()).toBeUndefined();
 
       // Invalid matcher
       doc = regexFactory.create({
-	      match : "match:chook"
+        match : "match:chook"
       });
       expect(doc.matchop()).toEqual('eq');
       expect(doc.rewrites()).toBeDefined();
 
       // Invalid regex
       doc = regexFactory.create({
-	      value : "[^b"
+        value : "[^b"
       });
       expect(doc).toBeUndefined();
     });
@@ -217,7 +225,7 @@
 
       // Short date 1
       doc = dateFactory.create({
-	      "value" : "2014-11"
+        "value" : "2014-11"
       });
 
       expect(doc.matchop()).toEqual('eq');
@@ -227,7 +235,7 @@
 
       // Short date 2
       doc = dateFactory.create({
-	      "value" : "2014"
+        "value" : "2014"
       });
 
       expect(doc.matchop()).toEqual('eq');
@@ -237,13 +245,13 @@
 
       // Invalid date!
       doc = dateFactory.create({
-	      "value" : "2014-11-050"
+        "value" : "2014-11-050"
       });
       expect(doc).toBeUndefined();
 
       // Invalid matcher!
       doc = dateFactory.create({
-	      "match" : "match:ne",
+        "match" : "match:ne",
       });
       expect(doc).toBeDefined();
       expect(doc.rewrites()).toBeDefined();
@@ -259,52 +267,52 @@
       // Serialize string
       doc = stringFactory.create();
       expect(doc.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:doc",
-	"type" : "type:string",
-	"key" : "author",
-	"value" : "Max Birkendale",
-	"match" : "match:eq"
+        "@type" : "koral:doc",
+        "type" : "type:string",
+        "key" : "author",
+        "value" : "Max Birkendale",
+        "match" : "match:eq"
       }));
 
       // Serialize regex
       doc = regexFactory.create();
       expect(doc.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:doc",
-	"type" : "type:regex",
-	"value" : "[^b]ee.+?",
-	"match" : "match:eq",
-	"key" : 'title'
+        "@type" : "koral:doc",
+        "type" : "type:regex",
+        "value" : "[^b]ee.+?",
+        "match" : "match:eq",
+        "key" : 'title'
       }));
 
       doc = regexFactory.create({
-	match: "match:ne"
+        match: "match:ne"
       });
       expect(doc.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:doc",
-	"type" : "type:regex",
-	"value" : "[^b]ee.+?",
-	"match" : "match:ne",
-	"key" : 'title'
+        "@type" : "koral:doc",
+        "type" : "type:regex",
+        "value" : "[^b]ee.+?",
+        "match" : "match:ne",
+        "key" : 'title'
       }));
 
       doc = dateFactory.create();
       expect(doc.toJson()).toEqual(jasmine.objectContaining({
-	      "@type" : "koral:doc",
-	      "type" : "type:date",
-	      "value" : "2014-11-05",
-	      "match" : "match:eq",
-	      "key" : 'pubDate'
+        "@type" : "koral:doc",
+        "type" : "type:date",
+        "value" : "2014-11-05",
+        "match" : "match:eq",
+        "key" : 'pubDate'
       }));
 
       doc = dateFactory.create({
-	value : "2014"
+        value : "2014"
       });
       expect(doc.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:doc",
-	"type" : "type:date",
-	"value" : "2014",
-	"match" : "match:eq",
-	"key" : 'pubDate'
+        "@type" : "koral:doc",
+        "type" : "type:date",
+        "value" : "2014",
+        "match" : "match:eq",
+        "key" : 'pubDate'
       }));
     });
 
@@ -327,12 +335,12 @@
       expect(doc.toQuery()).toEqual('title = /[^b]ee.+?/');
 
       doc = regexFactory.create({
-	      match: "match:ne"
+        match: "match:ne"
       });
       expect(doc.toQuery()).toEqual('title != /[^b]ee.+?/');
 
       doc = regexFactory.create({
-	      value: "WPD/AAA/00001"
+        value: "WPD/AAA/00001"
       });
       expect(doc.toQuery()).toEqual('title = /WPD\\/AAA\\/00001/');
 
@@ -340,7 +348,7 @@
       expect(doc.toQuery()).toEqual('pubDate in 2014-11-05');
 
       doc = dateFactory.create({
-	      value : "2014"
+        value : "2014"
       });
       expect(doc.toQuery()).toEqual('pubDate in 2014');
     });
@@ -352,25 +360,25 @@
     var docFactory = buildFactory(
       docClass,
       {
-	"@type" : "koral:doc",
-	"match":"match:eq",
-	"key" : "author",
-	"value" : "Max Birkendale"
+        "@type" : "koral:doc",
+        "match":"match:eq",
+        "key" : "author",
+        "value" : "Max Birkendale"
       }
     );
 
     var docGroupFactory = buildFactory(
       docGroupClass, {
-	"@type" : "koral:docGroup",
-	"operation" : "operation:and",
-	"operands" : [
-	  docFactory.create().toJson(),
-	  docFactory.create({
-	    "key" : "pubDate",
-	    "type" : "type:date",
-	    "value" : "2014-12-05"
-	  }).toJson()
-	]
+        "@type" : "koral:docGroup",
+        "operation" : "operation:and",
+        "operands" : [
+          docFactory.create().toJson(),
+          docFactory.create({
+            "key" : "pubDate",
+            "type" : "type:date",
+            "value" : "2014-12-05"
+          }).toJson()
+        ]
       });
 
     it('should be initializable', function () {
@@ -421,10 +429,10 @@
       newGroup.operation('or');
       newGroup.append(docFactory.create());
       newGroup.append(docFactory.create({
-	"type" : "type:regex",
-	"key" : "title",
-	"value" : "^e.+?$",
-	"match" : "match:ne"
+        "type" : "type:regex",
+        "key" : "title",
+        "value" : "^e.+?$",
+        "match" : "match:ne"
       }));
 
       expect(docGroup.operation()).toEqual("and");
@@ -467,77 +475,77 @@
       var docGroup = docGroupFactory.create();
 
       expect(docGroup.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:docGroup",
-	"operation" : "operation:and",
-	"operands" : [
-	  {
-	    "@type": 'koral:doc',
-	    "key" : 'author',
-	    "match": 'match:eq',
-	    "value": 'Max Birkendale',
-	    "type": 'type:string'
-	  },
-	  {
-	    "@type": 'koral:doc',
-	    "key": 'pubDate',
-	    "match": 'match:eq',
-	    "value": '2014-12-05',
-	    "type": 'type:date'
-	  }
-	]
+        "@type" : "koral:docGroup",
+        "operation" : "operation:and",
+        "operands" : [
+          {
+            "@type": 'koral:doc',
+            "key" : 'author',
+            "match": 'match:eq',
+            "value": 'Max Birkendale',
+            "type": 'type:string'
+          },
+          {
+            "@type": 'koral:doc',
+            "key": 'pubDate',
+            "match": 'match:eq',
+            "value": '2014-12-05',
+            "type": 'type:date'
+          }
+        ]
       }));
     });
 
     it('should be serializable to String', function () {
       var docGroup = docGroupFactory.create();
       expect(docGroup.toQuery()).toEqual(
-	'author = "Max Birkendale" & pubDate in 2014-12-05'
+        'author = "Max Birkendale" & pubDate in 2014-12-05'
       );
 
       docGroup = docGroupFactory.create({
-	"@type" : "koral:docGroup",
-	"operation" : "operation:or",
-	"operands" : [
-	  {
-	    "@type": 'koral:doc',
-	    "key" : 'author',
-	    "match": 'match:eq',
-	    "value": 'Max Birkendale',
-	    "type": 'type:string'
-	  },
-	  {
-	    "@type" : "koral:docGroup",
-	    "operation" : "operation:and",
-	    "operands" : [
-	      {
-		"@type": 'koral:doc',
-		"key": 'pubDate',
-		"match": 'match:geq',
-		"value": '2014-05-12',
-		"type": 'type:date'
-	      },
-	      {
-		"@type": 'koral:doc',
-		"key": 'pubDate',
-		"match": 'match:leq',
-		"value": '2014-12-05',
-		"type": 'type:date'
-	      },
-	      {
-		"@type": 'koral:doc',
-		"key": 'foo',
-		"match": 'match:ne',
-		"value": '[a]?bar',
-		"type": 'type:regex'
-	      }
-	    ]
-	  }
-	]
+        "@type" : "koral:docGroup",
+        "operation" : "operation:or",
+        "operands" : [
+          {
+            "@type": 'koral:doc',
+            "key" : 'author',
+            "match": 'match:eq',
+            "value": 'Max Birkendale',
+            "type": 'type:string'
+          },
+          {
+            "@type" : "koral:docGroup",
+            "operation" : "operation:and",
+            "operands" : [
+              {
+                "@type": 'koral:doc',
+                "key": 'pubDate',
+                "match": 'match:geq',
+                "value": '2014-05-12',
+                "type": 'type:date'
+              },
+              {
+                "@type": 'koral:doc',
+                "key": 'pubDate',
+                "match": 'match:leq',
+                "value": '2014-12-05',
+                "type": 'type:date'
+              },
+              {
+                "@type": 'koral:doc',
+                "key": 'foo',
+                "match": 'match:ne',
+                "value": '[a]?bar',
+                "type": 'type:regex'
+              }
+            ]
+          }
+        ]
       });
       expect(docGroup.toQuery()).toEqual(
-	'author = "Max Birkendale" | ' +
-	  '(pubDate since 2014-05-12 & ' +
-	  'pubDate until 2014-12-05 & foo != /[a]?bar/)'
+        'author = "Max Birkendale" | ' +
+          '(pubDate since 2014-05-12 & ' +
+          'pubDate until 2014-12-05 & foo != /[a]?bar/)'
       );
     });
   });
@@ -561,11 +569,11 @@
       expect(docGroup.operation()).toEqual('or');
 
       docGroup.append({
-	"@type": 'koral:doc',
-	"key": 'pubDate',
-	"match": 'match:eq',
-	"value": '2014-12-05',
-	"type": 'type:date'      
+        "@type": 'koral:doc',
+        "key": 'pubDate',
+        "match": 'match:eq',
+        "value": '2014-12-05',
+        "type": 'type:date'      
       });
 
       // Add unspecified object
@@ -593,11 +601,11 @@
       expect(docGroup.operation()).toEqual('or');
 
       docGroup.append({
-	"@type": 'koral:doc',
-	"key": 'pubDate',
-	"match": 'match:eq',
-	"value": '2014-12-05',
-	"type": 'type:date'      
+        "@type": 'koral:doc',
+        "key": 'pubDate',
+        "match": 'match:eq',
+        "value": '2014-12-05',
+        "type": 'type:date'      
       });
 
       expect(docGroup.toQuery()).toEqual("pubDate in 2014-12-05");
@@ -659,10 +667,10 @@
   describe('KorAP.Doc element', function () {
     it('should be initializable', function () {
       var docElement = docClass.create(undefined, {
-	"@type" : "koral:doc",
-	"key":"Titel",
-	"value":"Baum",
-	"match":"match:eq"
+        "@type" : "koral:doc",
+        "key":"Titel",
+        "value":"Baum",
+        "match":"match:eq"
       });
       expect(docElement.key()).toEqual('Titel');
       expect(docElement.matchop()).toEqual('eq');
@@ -676,10 +684,10 @@
       expect(docE.children[2].getAttribute('data-type')).toEqual('string');
       
       expect(docElement.toJson()).toEqual(jasmine.objectContaining({
-	"@type" : "koral:doc",
-	"key":"Titel",
-	"value":"Baum",
-	"match":"match:eq"
+        "@type" : "koral:doc",
+        "key":"Titel",
+        "value":"Baum",
+        "match":"match:eq"
       }));
     });
   });
@@ -688,24 +696,24 @@
     it('should be initializable', function () {
 
       var docGroup = docGroupClass.create(undefined, {
-	"@type" : "koral:docGroup",
-	"operation" : "operation:and",
-	"operands" : [
-	  {
-	    "@type": 'koral:doc',
-	    "key" : 'author',
-	    "match": 'match:eq',
-	    "value": 'Max Birkendale',
-	    "type": 'type:string'
-	  },
-	  {
-	    "@type": 'koral:doc',
-	    "key": 'pubDate',
-	    "match": 'match:eq',
-	    "value": '2014-12-05',
-	    "type": 'type:date'
-	  }
-	]
+        "@type" : "koral:docGroup",
+        "operation" : "operation:and",
+        "operands" : [
+          {
+            "@type": 'koral:doc',
+            "key" : 'author',
+            "match": 'match:eq',
+            "value": 'Max Birkendale',
+            "type": 'type:string'
+          },
+          {
+            "@type": 'koral:doc',
+            "key": 'pubDate',
+            "match": 'match:eq',
+            "value": '2014-12-05',
+            "type": 'type:date'
+          }
+        ]
       });
 
       expect(docGroup.operation()).toEqual('and');
@@ -736,37 +744,37 @@
 
     it('should be deserializable with nested groups', function () {
       var docGroup = docGroupClass.create(undefined, {
-	"@type" : "koral:docGroup",
-	"operation" : "operation:or",
-	"operands" : [
-	  {
-	    "@type": 'koral:doc',
-	    "key" : 'author',
-	    "match": 'match:eq',
-	    "value": 'Max Birkendale',
-	    "type": 'type:string'
-	  },
-	  {
-	    "@type" : "koral:docGroup",
-	    "operation" : "operation:and",
-	    "operands" : [
-	      {
-		"@type": 'koral:doc',
-		"key": 'pubDate',
-		"match": 'match:geq',
-		"value": '2014-05-12',
-		"type": 'type:date'
-	      },
-	      {
-		"@type": 'koral:doc',
-		"key": 'pubDate',
-		"match": 'match:leq',
-		"value": '2014-12-05',
-		"type": 'type:date'
-	      }
-	    ]
-	  }
-	]
+        "@type" : "koral:docGroup",
+        "operation" : "operation:or",
+        "operands" : [
+          {
+            "@type": 'koral:doc',
+            "key" : 'author',
+            "match": 'match:eq',
+            "value": 'Max Birkendale',
+            "type": 'type:string'
+          },
+          {
+            "@type" : "koral:docGroup",
+            "operation" : "operation:and",
+            "operands" : [
+              {
+                "@type": 'koral:doc',
+                "key": 'pubDate',
+                "match": 'match:geq',
+                "value": '2014-05-12',
+                "type": 'type:date'
+              },
+              {
+                "@type": 'koral:doc',
+                "key": 'pubDate',
+                "match": 'match:leq',
+                "value": '2014-12-05',
+                "type": 'type:date'
+              }
+            ]
+          }
+        ]
       });
 
       expect(docGroup.operation()).toEqual('or');
@@ -803,20 +811,20 @@
       "@type" : "koral:docGroup",
       "operation" : "operation:and",
       "operands" : [
-	{
-	  "@type": 'koral:doc',
-	  "key" : 'author',
-	  "match": 'match:eq',
-	  "value": 'Max Birkendale',
-	  "type": 'type:string'
-	},
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:eq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	}
+        {
+          "@type": 'koral:doc',
+          "key" : 'author',
+          "match": 'match:eq',
+          "value": 'Max Birkendale',
+          "type": 'type:string'
+        },
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:eq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        }
       ]
     });
 
@@ -824,33 +832,33 @@
       "@type" : "koral:docGroup",
       "operation" : "operation:or",
       "operands" : [
-	{
-	  "@type": 'koral:doc',
-	  "key" : 'author',
-	  "match": 'match:eq',
-	  "value": 'Max Birkendale',
-	  "type": 'type:string'
-	},
-	{
-	  "@type" : "koral:docGroup",
-	  "operation" : "operation:and",
-	  "operands" : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:geq',
-	      "value": '2014-05-12',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:leq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:doc',
+          "key" : 'author',
+          "match": 'match:eq',
+          "value": 'Max Birkendale',
+          "type": 'type:string'
+        },
+        {
+          "@type" : "koral:docGroup",
+          "operation" : "operation:and",
+          "operands" : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:geq',
+              "value": '2014-05-12',
+              "type": 'type:date'
+            },
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:leq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            }
+          ]
+        }
       ]
     });
 
@@ -858,27 +866,27 @@
       "@type" : "koral:docGroup",
       "operation" : "operation:and",
       "operands" : [
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:geq',
-	  "value": '2014-05-12',
-	  "type": 'type:date'
-	},
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:leq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	},
-	{
-	  "@type": 'koral:doc',
-	  "key": 'foo',
-	  "match": 'match:eq',
-	  "value": 'bar',
-	  "type": 'type:string'
-	}
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:geq',
+          "value": '2014-05-12',
+          "type": 'type:date'
+        },
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:leq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        },
+        {
+          "@type": 'koral:doc',
+          "key": 'foo',
+          "match": 'match:eq',
+          "value": 'bar',
+          "type": 'type:string'
+        }
       ]
     });
     
@@ -893,10 +901,10 @@
 
     it('should be based on a doc', function () {
       var vc = vcClass.create().fromJson({
-	"@type" : "koral:doc",
-	"key":"Titel",
-	"value":"Baum",
-	"match":"match:eq"
+        "@type" : "koral:doc",
+        "key":"Titel",
+        "value":"Baum",
+        "match":"match:eq"
       });
 
       expect(vc.element().getAttribute('class')).toEqual('vc');
@@ -987,7 +995,7 @@
       var vc = nestedGroupFactory.create();
 
       expect(vc.toQuery()).toEqual(
-	'author = "Max Birkendale" | (pubDate since 2014-05-12 & pubDate until 2014-12-05)'
+        'author = "Max Birkendale" | (pubDate since 2014-05-12 & pubDate until 2014-12-05)'
       );
 
       var docGroup = vc.root();
@@ -1015,9 +1023,9 @@
 
       // Remove first operand so everything becomes root
       expect(
-	vc.root().delOperand(
-	  vc.root().getOperand(0)
-	).update().ldType()
+        vc.root().delOperand(
+          vc.root().getOperand(0)
+        ).update().ldType()
       ).toEqual("docGroup");
 
       expect(vc.root().ldType()).toEqual("docGroup");
@@ -1025,7 +1033,7 @@
       expect(vc.root().getOperand(0).ldType()).toEqual("doc");
 
       expect(vc.toQuery()).toEqual(
-	'pubDate since 2014-05-12 & pubDate until 2014-12-05'
+        'pubDate since 2014-05-12 & pubDate until 2014-12-05'
       );
     });
 
@@ -1057,7 +1065,7 @@
       // Get nested group
       var firstGroup = vc.root().getOperand(1);
       firstGroup.append(simpleGroupFactory.create({
-	"operation" : "operation:or"
+        "operation" : "operation:or"
       }));
       var oldAuthor = firstGroup.getOperand(2).getOperand(0);
       oldAuthor.key("title");
@@ -1066,11 +1074,11 @@
       // Structur is now:
       // or(doc, and(doc, doc, or(doc, doc)))
       expect(vc.toQuery()).toEqual(
-	'author = "Max Birkendale" | ' +
-	  '(pubDate since 2014-05-12 & ' +
-	  'pubDate until 2014-12-05 & ' +
-	  '(title = "Der Birnbaum" | ' +
-	  'pubDate in 2014-12-05))'
+        'author = "Max Birkendale" | ' +
+          '(pubDate since 2014-05-12 & ' +
+          'pubDate until 2014-12-05 & ' +
+          '(title = "Der Birnbaum" | ' +
+          'pubDate in 2014-12-05))'
       );
 
       var andGroup = vc.root().getOperand(1);
@@ -1085,15 +1093,15 @@
 
       // Remove 2
       expect(
-	andGroup.delOperand(doc2).update().operation()
+        andGroup.delOperand(doc2).update().operation()
       ).toEqual("and");
       // Structur is now:
       // or(doc, and(doc, or(doc, doc)))
 
       expect(vc.toQuery()).toEqual(
-	'author = "Max Birkendale"' +
-	  ' | (pubDate since 2014-05-12 & ' +
-	  '(title = "Der Birnbaum" | pubDate in 2014-12-05))'
+        'author = "Max Birkendale"' +
+          ' | (pubDate since 2014-05-12 & ' +
+          '(title = "Der Birnbaum" | pubDate in 2014-12-05))'
       );
 
 
@@ -1103,7 +1111,7 @@
       // or(doc, doc, doc)
 
       expect(vc.toQuery()).toEqual(
-	'author = "Max Birkendale" | title = "Der Birnbaum" | pubDate in 2014-12-05'
+        'author = "Max Birkendale" | title = "Der Birnbaum" | pubDate in 2014-12-05'
       );
     });
 
@@ -1112,13 +1120,13 @@
 
       expect(vc.toQuery()).toEqual(vc.root().toQuery());
       expect(vc.toQuery()).toEqual(
-	'(Titel = "Baum" & Veröffentlichungsort = "hihi" & ' +
-	  '(Titel = "Baum" | Veröffentlichungsort = "hihi")) ' +
-	  '| Untertitel = "huhu"');
+        '(Titel = "Baum" & Veröffentlichungsort = "hihi" & ' +
+          '(Titel = "Baum" | Veröffentlichungsort = "hihi")) ' +
+          '| Untertitel ~ "huhu"');
       expect(vc.root().element().lastChild.children[0].firstChild.nodeValue).toEqual('and');
       expect(vc.root().element().lastChild.children[1].firstChild.nodeValue).toEqual('×');
       expect(vc.root().delOperand(vc.root().getOperand(0)).update()).not.toBeUndefined();
-      expect(vc.toQuery()).toEqual('Untertitel = "huhu"');
+      expect(vc.toQuery()).toEqual('Untertitel ~ "huhu"');
 
       var lc = vc.root().element().lastChild;
       expect(lc.children[0].firstChild.nodeValue).toEqual('and');
@@ -1132,56 +1140,56 @@
 
     it('should flatten on import', function () {
       var vc = vcClass.create().fromJson({
-	"@type":"koral:docGroup",
-	"operation":"operation:or",
-	"operands":[
-	  {
-	    "@type":"koral:docGroup",
-	    "operation":"operation:or",
-	    "operands":[
+        "@type":"koral:docGroup",
+        "operation":"operation:or",
+        "operands":[
+          {
+            "@type":"koral:docGroup",
+            "operation":"operation:or",
+            "operands":[
               {
-		"@type":"koral:doc",
-		"key":"Titel",
-		"value":"Baum",
-		"match":"match:eq"
+                "@type":"koral:doc",
+                "key":"Titel",
+                "value":"Baum",
+                "match":"match:eq"
               },
               {
-		"@type":"koral:doc",
-		"key":"Veröffentlichungsort",
-		"value":"hihi",
-		"match":"match:eq"
+                "@type":"koral:doc",
+                "key":"Veröffentlichungsort",
+                "value":"hihi",
+                "match":"match:eq"
               },
               {
-		"@type":"koral:docGroup",
-		"operation":"operation:or",
-		"operands":[
-		  {
-		    "@type":"koral:doc",
-		    "key":"Titel",
-		    "value":"Baum",
-		    "match":"match:eq"
-		  },
-		  {
-		    "@type":"koral:doc",
-		    "key":"Veröffentlichungsort",
-		    "value":"hihi",
-		    "match":"match:eq"
-		  }
-		]
+                "@type":"koral:docGroup",
+                "operation":"operation:or",
+                "operands":[
+                  {
+                    "@type":"koral:doc",
+                    "key":"Titel",
+                    "value":"Baum",
+                    "match":"match:eq"
+                  },
+                  {
+                    "@type":"koral:doc",
+                    "key":"Veröffentlichungsort",
+                    "value":"hihi",
+                    "match":"match:eq"
+                  }
+                ]
               }
-	    ]
-	  },
-	  {
-	    "@type":"koral:doc",
-	    "key":"Untertitel",
-	    "value":"huhu",
-	    "match":"match:eq"
-	  }
-	]
+            ]
+          },
+          {
+            "@type":"koral:doc",
+            "key":"Untertitel",
+            "value":"huhu",
+            "match":"match:contains"
+          }
+        ]
       });
 
       expect(vc.toQuery()).toEqual(
-	'Titel = "Baum" | Veröffentlichungsort = "hihi" | Untertitel = "huhu"'
+        'Titel = "Baum" | Veröffentlichungsort = "hihi" | Untertitel ~ "huhu"'
       );
     });
   });
@@ -1229,39 +1237,39 @@
       "@type": 'koral:docGroup',
       'operation' : 'operation:and',
       'operands' : [
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:eq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	},
-	{
-	  "@type" : 'koral:docGroup',
-	  'operation' : 'operation:or',
-	  'operands' : [
-	    {
-	      '@type' : 'koral:doc',
-	      'key' : 'title',
-	      'value' : 'Hello World!'
-	    },
-	    {
-	      '@type' : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:eq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        },
+        {
+          "@type" : 'koral:docGroup',
+          'operation' : 'operation:or',
+          'operands' : [
+            {
+              '@type' : 'koral:doc',
+              'key' : 'title',
+              'value' : 'Hello World!'
+            },
+            {
+              '@type' : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       ]
     });
 
     it('should clean on root docs', function () {
       var vc = vcClass.create().fromJson({
-	"@type": 'koral:doc',
-	"key": 'pubDate',
-	"match": 'match:eq',
-	"value": '2014-12-05',
-	"type": 'type:date'
+        "@type": 'koral:doc',
+        "key": 'pubDate',
+        "match": 'match:eq',
+        "value": '2014-12-05',
+        "type": 'type:date'
       });
       expect(vc.root().toQuery()).toEqual('pubDate in 2014-12-05');
       expect(vc.root().element().lastChild.getAttribute('class')).toEqual('operators button-group');
@@ -1275,24 +1283,24 @@
 
     it('should remove on nested docs', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:and',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:and',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       );
 
       // Delete with direct element access
@@ -1305,24 +1313,24 @@
 
     it('should clean on doc groups', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:and',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:and',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       );
 
       // Cleanwith direct element access
@@ -1337,7 +1345,7 @@
 
       // Delete with direct element access
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+        'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
       );
 
       // Remove hello world:
@@ -1351,7 +1359,7 @@
 
       // Delete with direct element access
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+        'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
       );
 
       // Remove bar
@@ -1366,8 +1374,8 @@
 
       // Delete with direct element access
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 & ' +
-	  '(title = "Hello World!" | foo = "bar")'
+        'pubDate in 2014-12-05 & ' +
+          '(title = "Hello World!" | foo = "bar")'
       );
 
       // Remove bar
@@ -1379,60 +1387,60 @@
 
     it('should remove on nested doc groups (list flattening)', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:or',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    },
-	    {
-	      "@type": 'koral:docGroup',
-	      'operation' : 'operation:and',
-	      'operands' : [
-		{
-		  "@type": 'koral:doc',
-		  "key": 'pubDate',
-		  "match": 'match:eq',
-		  "value": '2014-12-05',
-		  "type": 'type:date'
-		},
-		{
-		  "@type" : 'koral:docGroup',
-		  'operation' : 'operation:or',
-		  'operands' : [
-		    {
-		      '@type' : 'koral:doc',
-		      'key' : 'title',
-		      'value' : 'Hello World!'
-		    },
-		    {
-		      '@type' : 'koral:doc',
-		      'key' : 'yeah',
-		      'value' : 'juhu'
-		    }
-		  ]
-		}
-	      ]
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:or',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            },
+            {
+              "@type": 'koral:docGroup',
+              'operation' : 'operation:and',
+              'operands' : [
+                {
+                  "@type": 'koral:doc',
+                  "key": 'pubDate',
+                  "match": 'match:eq',
+                  "value": '2014-12-05',
+                  "type": 'type:date'
+                },
+                {
+                  "@type" : 'koral:docGroup',
+                  'operation' : 'operation:or',
+                  'operands' : [
+                    {
+                      '@type' : 'koral:doc',
+                      'key' : 'title',
+                      'value' : 'Hello World!'
+                    },
+                    {
+                      '@type' : 'koral:doc',
+                      'key' : 'yeah',
+                      'value' : 'juhu'
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
       );
 
       // Delete with direct element access
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 | foo = "bar" | ' +
-	  '(pubDate in 2014-12-05 & ' +
-	  '(title = "Hello World!" | yeah = "juhu"))'
+        'pubDate in 2014-12-05 | foo = "bar" | ' +
+          '(pubDate in 2014-12-05 & ' +
+          '(title = "Hello World!" | yeah = "juhu"))'
       );
 
       expect(vc.root().ldType()).toEqual('docGroup');
@@ -1446,7 +1454,7 @@
       _delOn(vc.root().getOperand(2).getOperand(0));
 
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 | foo = "bar" | title = "Hello World!" | yeah = "juhu"'
+        'pubDate in 2014-12-05 | foo = "bar" | title = "Hello World!" | yeah = "juhu"'
       );
       expect(vc.root().ldType()).toEqual('docGroup');
       expect(vc.root().operation()).toEqual('or');
@@ -1462,52 +1470,52 @@
       "@type": 'koral:docGroup',
       'operation' : 'operation:and',
       'operands' : [
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:eq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	},
-	{
-	  "@type" : 'koral:docGroup',
-	  'operation' : 'operation:or',
-	  'operands' : [
-	    {
-	      '@type' : 'koral:doc',
-	      'key' : 'title',
-	      'value' : 'Hello World!'
-	    },
-	    {
-	      '@type' : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:eq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        },
+        {
+          "@type" : 'koral:docGroup',
+          'operation' : 'operation:or',
+          'operands' : [
+            {
+              '@type' : 'koral:doc',
+              'key' : 'title',
+              'value' : 'Hello World!'
+            },
+            {
+              '@type' : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       ]
     });
 
     it('should add new unspecified doc with "and"', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:and',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:and',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       );
 
       expect(vc.toQuery()).toEqual('pubDate in 2014-12-05 & foo = "bar"');
@@ -1535,24 +1543,24 @@
 
     it('should add new unspecified doc with "or"', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:and',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:and',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       );
 
       expect(vc.toQuery()).toEqual('pubDate in 2014-12-05 & foo = "bar"');
@@ -1589,11 +1597,11 @@
 
       // Wrap with direct element access
       expect(vc.toQuery()).toEqual(
-	'(Titel = "Baum" & ' +
-	  'Veröffentlichungsort = "hihi" & ' +
-	  '(Titel = "Baum" | ' +
-	  'Veröffentlichungsort = "hihi")) | ' +
-	  'Untertitel = "huhu"'
+        '(Titel = "Baum" & ' +
+          'Veröffentlichungsort = "hihi" & ' +
+          '(Titel = "Baum" | ' +
+          'Veröffentlichungsort = "hihi")) | ' +
+          'Untertitel ~ "huhu"'
       );
 
       expect(vc.root().getOperand(0).ldType()).toEqual('docGroup');
@@ -1625,7 +1633,7 @@
 
       // Wrap with direct element access
       expect(vc.toQuery()).toEqual(
-	'(Titel = "Baum" & Veröffentlichungsort = "hihi" & (Titel = "Baum" | Veröffentlichungsort = "hihi")) | Untertitel = "huhu"'
+        '(Titel = "Baum" & Veröffentlichungsort = "hihi" & (Titel = "Baum" | Veröffentlichungsort = "hihi")) | Untertitel ~ "huhu"'
       );
 
       var fo = vc.root().getOperand(0).getOperand(0);
@@ -1651,16 +1659,16 @@
     });
 
 
-    it('should remove an unspecified doc with an doc in a nested group', function () {
+    it('should remove an unspecified doc with a doc in a nested group', function () {
       var vc = demoFactory.create();
 
       // Wrap with direct element access
       expect(vc.toQuery()).toEqual(
-	'(Titel = "Baum" & ' +
-	  'Veröffentlichungsort = "hihi" & ' +
-	  '(Titel = "Baum" ' +
-	  '| Veröffentlichungsort = "hihi")) | ' +
-	  'Untertitel = "huhu"'
+        '(Titel = "Baum" & ' +
+          'Veröffentlichungsort = "hihi" & ' +
+          '(Titel = "Baum" ' +
+          '| Veröffentlichungsort = "hihi")) | ' +
+          'Untertitel ~ "huhu"'
       );
 
       var fo = vc.root().getOperand(0).getOperand(0);
@@ -1694,7 +1702,7 @@
 
       // Wrap with direct element access
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+        'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
       );
 
       expect(vc.root().operands().length).toEqual(2);
@@ -1702,7 +1710,7 @@
       // Add unspecified on the root group
       _andOn(vc.root().getOperand(1));
       expect(vc.toQuery()).toEqual(
-	'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+        'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
       );
 
       expect(vc.root().ldType()).toEqual('docGroup');
@@ -1734,24 +1742,24 @@
 
     it('should wrap on root', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:and',
-	  'operands' : [
-	    {
-	      "@type": 'koral:doc',
-	      "key": 'pubDate',
-	      "match": 'match:eq',
-	      "value": '2014-12-05',
-	      "type": 'type:date'
-	    },
-	    {
-	      "@type" : 'koral:doc',
-	      'key' : 'foo',
-	      'value' : 'bar'
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:and',
+          'operands' : [
+            {
+              "@type": 'koral:doc',
+              "key": 'pubDate',
+              "match": 'match:eq',
+              "value": '2014-12-05',
+              "type": 'type:date'
+            },
+            {
+              "@type" : 'koral:doc',
+              'key' : 'foo',
+              'value' : 'bar'
+            }
+          ]
+        }
       );
 
       // Wrap on root
@@ -1768,13 +1776,13 @@
 
     it('should add on root (case "and")', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:eq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	}
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:eq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        }
       );
 
       expect(vc.toQuery()).toEqual('pubDate in 2014-12-05');
@@ -1790,13 +1798,13 @@
 
     it('should add on root (case "or")', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:doc',
-	  "key": 'pubDate',
-	  "match": 'match:eq',
-	  "value": '2014-12-05',
-	  "type": 'type:date'
-	}
+        {
+          "@type": 'koral:doc',
+          "key": 'pubDate',
+          "match": 'match:eq',
+          "value": '2014-12-05',
+          "type": 'type:date'
+        }
       );
 
       expect(vc.toQuery()).toEqual('pubDate in 2014-12-05');
@@ -1811,48 +1819,48 @@
 
     it('should support multiple sub groups per group', function () {
       var vc = vcClass.create().fromJson(
-	{
-	  "@type": 'koral:docGroup',
-	  'operation' : 'operation:or',
-	  'operands' : [
-	    {
-	      "@type": 'koral:docGroup',
-	      'operation' : 'operation:and',
-	      'operands' : [
-		{
-		  "@type": 'koral:doc',
-		  "key": 'title',
-		  "value": 't1',
-		},
-		{
-		  "@type" : 'koral:doc',
-		  'key' : 'title',
-		  'value' : 't2'
-		}
-	      ]
-	    },
-	    {
-	      "@type": 'koral:docGroup',
-	      'operation' : 'operation:and',
-	      'operands' : [
-		{
-		  "@type": 'koral:doc',
-		  "key": 'title',
-		  "value": 't3',
-		},
-		{
-		  "@type" : 'koral:doc',
-		  'key' : 'title',
-		  'value' : 't4'
-		}
-	      ]
-	    }
-	  ]
-	}
+        {
+          "@type": 'koral:docGroup',
+          'operation' : 'operation:or',
+          'operands' : [
+            {
+              "@type": 'koral:docGroup',
+              'operation' : 'operation:and',
+              'operands' : [
+                {
+                  "@type": 'koral:doc',
+                  "key": 'title',
+                  "value": 't1',
+                },
+                {
+                  "@type" : 'koral:doc',
+                  'key' : 'title',
+                  'value' : 't2'
+                }
+              ]
+            },
+            {
+              "@type": 'koral:docGroup',
+              'operation' : 'operation:and',
+              'operands' : [
+                {
+                  "@type": 'koral:doc',
+                  "key": 'title',
+                  "value": 't3',
+                },
+                {
+                  "@type" : 'koral:doc',
+                  'key' : 'title',
+                  'value' : 't4'
+                }
+              ]
+            }
+          ]
+        }
       );
       expect(vc.toQuery()).toEqual(
-	'(title = "t1" & title = "t2") | ' +
-	  '(title = "t3" & title = "t4")'
+        '(title = "t1" & title = "t2") | ' +
+          '(title = "t3" & title = "t4")'
       );
       expect(vc.root().operation()).toEqual('or');
       expect(vc.root().getOperand(0).toQuery()).toEqual('title = "t1" & title = "t2"');
@@ -1874,10 +1882,10 @@
         {
           "@type" : "koral:doc",
           "rewrites" : [{
-	          "@type" : "koral:rewrite",
-	          "operation" : "operation:modification",
-	          "src" : "querySerializer",
-	          "scope" : "tree"
+            "@type" : "koral:rewrite",
+            "operation" : "operation:modification",
+            "src" : "querySerializer",
+            "scope" : "tree"
           }]
         }
       )).toBeTruthy();
@@ -1905,10 +1913,10 @@
       expect(vcClass.checkRewrite(nested)).toBe(false);
 
       nested["operands"][1]["operands"][1]["rewrites"] = [{
-	      "@type" : "koral:rewrite",
-	      "operation" : "operation:modification",
-	      "src" : "querySerializer",
-	      "scope" : "tree"
+        "@type" : "koral:rewrite",
+        "operation" : "operation:modification",
+        "src" : "querySerializer",
+        "scope" : "tree"
       }];
 
       expect(vcClass.checkRewrite(nested)).toBeTruthy();
@@ -1918,43 +1926,43 @@
   describe('KorAP.Rewrite', function () {
     it('should be initializable', function () {
       var rewrite = rewriteClass.create({
-	"@type" : "koral:rewrite",
-	"operation" : "operation:modification",
-	"src" : "querySerializer",
-	"scope" : "tree"
+        "@type" : "koral:rewrite",
+        "operation" : "operation:modification",
+        "src" : "querySerializer",
+        "scope" : "tree"
       });
       expect(rewrite.toString()).toEqual('Modification of "tree" by "querySerializer"');
     });
 
     it('should be deserialized by docs', function () {
       var doc = docClass.create(
-	undefined,
-	{
-	  "@type":"koral:doc",
-	  "key":"Titel",
-	  "value":"Baum",
-	  "match":"match:eq"
-	});
+        undefined,
+        {
+          "@type":"koral:doc",
+          "key":"Titel",
+          "value":"Baum",
+          "match":"match:eq"
+        });
 
       expect(doc.element().classList.contains('doc')).toBeTruthy();
       expect(doc.element().classList.contains('rewritten')).toBe(false);
 
       doc = docClass.create(
-	undefined,
-	{
-	  "@type":"koral:doc",
-	  "key":"Titel",
-	  "value":"Baum",
-	  "match":"match:eq",
-	  "rewrites" : [
-	    {
-	      "@type" : "koral:rewrite",
-	      "operation" : "operation:modification",
-	      "src" : "querySerializer",
-	      "scope" : "tree"
-	    }
-	  ]
-	});
+        undefined,
+        {
+          "@type":"koral:doc",
+          "key":"Titel",
+          "value":"Baum",
+          "match":"match:eq",
+          "rewrites" : [
+            {
+              "@type" : "koral:rewrite",
+              "operation" : "operation:modification",
+              "src" : "querySerializer",
+              "scope" : "tree"
+            }
+          ]
+        });
       
       expect(doc.element().classList.contains('doc')).toBeTruthy();
       expect(doc.element().classList.contains('rewritten')).toBeTruthy();
@@ -1962,53 +1970,39 @@
 
     xit('should be deserialized by docGroups', function () {
       var docGroup = docGroupClass.create(
-	undefined,
-	{
-	  "@type" : "koral:docGroup",
-	  "operation" : "operation:or",
-	  "operands" : [
-	    {
-	      "@type" : "doc",
-	      "key" : "pubDate",
-	      "type" : "type:date",
-	      "value" : "2014-12-05"
-	    },
-	    {
-	      "@type" : "doc",
-	      "key" : "pubDate",
-	      "type" : "type:date",
-	      "value" : "2014-12-06"
-	    }
-	  ],
-	  "rewrites" : [
-	    {
-	      "@type" : "koral:rewrite",
-	      "operation" : "operation:modification",
-	      "src" : "querySerializer",
-	      "scope" : "tree"
-	    }
-	  ]
-	}
+        undefined,
+        {
+          "@type" : "koral:docGroup",
+          "operation" : "operation:or",
+          "operands" : [
+            {
+              "@type" : "doc",
+              "key" : "pubDate",
+              "type" : "type:date",
+              "value" : "2014-12-05"
+            },
+            {
+              "@type" : "doc",
+              "key" : "pubDate",
+              "type" : "type:date",
+              "value" : "2014-12-06"
+            }
+          ],
+          "rewrites" : [
+            {
+              "@type" : "koral:rewrite",
+              "operation" : "operation:modification",
+              "src" : "querySerializer",
+              "scope" : "tree"
+            }
+          ]
+        }
       );
 
       expect(doc.element().classList.contains('docgroup')).toBeTruthy();
       expect(doc.element().classList.contains('rewritten')).toBe(false);
     });
   });
-  /*
-    describe('KorAP.DocKey', function () {
-    it('should be initializable', function () {
-    var docKey = KorAP.DocKey.create();
-    expect(docKey.toString()).toEqual('...');
-    });
-    });
-
-      expect(
-	function() { menuItemClass.create([]) }
-      ).toThrow(new Error("Missing parameters"));
-
-
-  */
 
   describe('KorAP.stringValue', function () {
     it('should be initializable', function () {
@@ -2080,15 +2074,56 @@
       var sv = stringValClass.create();
       var count = 1;
       sv.store = function (value, regex) {
-	      expect(regex).toBe(true);
-	      expect(value).toBe('tree');
+        expect(regex).toBe(true);
+        expect(value).toBe('tree');
       };
       sv.regex(true);
       sv.value('tree');
       sv.element().lastChild.click();
     });
+
   });
 
+  describe('KorAP.VC.Menu', function () {
+    it('should be initializable', function () {
+
+      var vc = vcClass.create([
+        ['a', 'text'],
+        ['b', 'string'],
+        ['c', 'date']
+      ]).fromJson();
+      expect(vc.element().firstChild.classList.contains('unspecified')).toBeTruthy();
+      expect(vc.element().firstChild.firstChild.tagName).toEqual('SPAN');
+
+      // Click on unspecified
+      vc.element().firstChild.firstChild.click();
+      expect(vc.element().firstChild.firstChild.tagName).toEqual('UL');
+
+      var list = vc.element().firstChild.firstChild;
+      expect(list.getElementsByTagName("LI")[0].innerText).toEqual('a');
+      expect(list.getElementsByTagName("LI")[1].innerText).toEqual('b');
+      expect(list.getElementsByTagName("LI")[2].innerText).toEqual('c');
+
+      vc = vcClass.create([
+        ['d', 'text'],
+        ['e', 'string'],
+        ['f', 'date']
+      ]).fromJson();
+      expect(vc.element().firstChild.classList.contains('unspecified')).toBeTruthy();
+      expect(vc.element().firstChild.firstChild.tagName).toEqual('SPAN');
+
+      // Click on unspecified
+      vc.element().firstChild.firstChild.click();
+      expect(vc.element().firstChild.firstChild.tagName).toEqual('UL');
+
+      list = vc.element().firstChild.firstChild;
+      expect(list.getElementsByTagName("LI")[0].innerText).toEqual('d');
+      expect(list.getElementsByTagName("LI")[1].innerText).toEqual('e');
+      expect(list.getElementsByTagName("LI")[2].innerText).toEqual('f');
+    });
+  });
+
+  
   // Check prefix
   describe('KorAP.VC.Prefix', function () {
 
@@ -2101,10 +2136,10 @@
 
     it('should be clickable', function () {
       var vc = vcClass.create([
-	      ['a', null],
-	      ['b', null],
-	      ['c', null]
-	    ]).fromJson();
+        ['a', null],
+        ['b', null],
+        ['c', null]
+      ]).fromJson();
       expect(vc.element().firstChild.classList.contains('unspecified')).toBeTruthy();
 
       // This should open up the menu