Modernize match object and improve test coverage

Change-Id: Ifde30d7eb9f985c14bb3c885a93c991790ff204e
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index ddd482d..6166138 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -451,7 +451,35 @@
       expect(e.classList.contains('active')).toBe(false);
       expect(e["_match"]).not.toBe(undefined);
     });
-   
+
+    it('should toggle', function () {
+      var e = matchElementFactory();
+
+      expect(e.classList.contains('active')).toBe(false);
+      expect(e["_match"]).toBe(undefined);
+
+      var m = matchClass.create(e);
+
+      expect(e.classList.contains('active')).toBe(false);
+      expect(e["_match"]).not.toBe(undefined);
+      
+      // Open the match
+      m.open();
+      
+      expect(e.classList.contains('active')).toBe(true);
+      expect(e["_match"]).not.toBe(undefined);
+
+      m.toggle();
+
+      expect(e.classList.contains('active')).toBe(false);
+      expect(e["_match"]).not.toBe(undefined);
+
+      m.toggle();
+
+      expect(e.classList.contains('active')).toBe(true);
+      expect(e["_match"]).not.toBe(undefined);
+    });
+    
     it('should open tree menu', function () {      
       var e = matchElementFactory();
       var m = matchClass.create(e);