Przeglądaj źródła

Add test for unit menu structure.

Greg Look 10 lat temu
rodzic
commit
524f5d45ec
1 zmienionych plików z 19 dodań i 0 usunięć
  1. 19 0
      public/test/specs/kbn-format-specs.js

+ 19 - 0
public/test/specs/kbn-format-specs.js

@@ -4,6 +4,25 @@ define([
 ], function(kbn, dateMath) {
 ], function(kbn, dateMath) {
   'use strict';
   'use strict';
 
 
+  describe('unit format menu', function() {
+    var menu = kbn.getUnitFormats();
+    menu.map(function(submenu) {
+      describe('submenu ' + submenu.text, function() {
+        it('should have a title', function() { expect(submenu.text).to.be.a('string'); });
+        it('should have a submenu', function() { expect(submenu.submenu).to.be.an('array'); });
+        submenu.submenu.map(function(entry) {
+          describe('entry ' + entry.text, function() {
+            it('should have a title', function() { expect(entry.text).to.be.a('string'); });
+            it('should have a format', function() { expect(entry.value).to.be.a('string'); });
+            it('should have a valid format', function() {
+              expect(kbn.valueFormats[entry.value]).to.be.a('function');
+            });
+          });
+        });
+      });
+    });
+  });
+
   function describeValueFormat(desc, value, tickSize, tickDecimals, result) {
   function describeValueFormat(desc, value, tickSize, tickDecimals, result) {
 
 
     describe('value format: ' + desc, function() {
     describe('value format: ' + desc, function() {