From 524f5d45ec1b1e76ded0ae79ba1df5958cfa2bb0 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 14:51:42 -0700 Subject: [PATCH] Add test for unit menu structure. --- public/test/specs/kbn-format-specs.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index d7f97187716..feae3c261aa 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -4,6 +4,25 @@ define([ ], function(kbn, dateMath) { '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) { describe('value format: ' + desc, function() {