From 2f32b8b2a6a14a6eccd23b6f4041f4c64121cc01 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Mon, 19 Jan 2015 17:24:31 -0700 Subject: [PATCH 1/2] fix updateParams call, fix config side effects --- src/kibana/components/vislib/vis.js | 2 +- test/unit/specs/plugins/vis_types/vislib/_renderbot.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/kibana/components/vislib/vis.js b/src/kibana/components/vislib/vis.js index aeb035d681ba2c..05aa71a1b404d2 100644 --- a/src/kibana/components/vislib/vis.js +++ b/src/kibana/components/vislib/vis.js @@ -25,7 +25,7 @@ define(function (require) { Vis.Super.apply(this, arguments); this.el = $el.get ? $el.get(0) : $el; this.ChartClass = chartTypes[config.type]; - this._attr = _.defaults(config || {}, { + this._attr = _.defaults({}, config || {}, { defaultYMin: true }); this.eventTypes = { diff --git a/test/unit/specs/plugins/vis_types/vislib/_renderbot.js b/test/unit/specs/plugins/vis_types/vislib/_renderbot.js index e7ccdc20dfcda8..ec60f3418f740e 100644 --- a/test/unit/specs/plugins/vis_types/vislib/_renderbot.js +++ b/test/unit/specs/plugins/vis_types/vislib/_renderbot.js @@ -24,7 +24,6 @@ define(function (require) { Renderbot = Private(require('plugins/vis_types/_renderbot')); VislibRenderbot = Private(require('plugins/vis_types/vislib/_vislib_renderbot')); normalizeChartData = Private(require('components/agg_response/index')); - }); } @@ -100,7 +99,7 @@ define(function (require) { it('should create a new Vis object when params change', function () { // called on init expect(createVisSpy.callCount).to.be(1); - renderbot.updateParams(_.clone(params)); + renderbot.updateParams(); // not called again, same params expect(createVisSpy.callCount).to.be(1); renderbot.vis.params = { one: 'fishy', two: 'fishy' }; From 7e8c9f12b3f46794eea341c25492987d315eecc4 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Mon, 19 Jan 2015 17:30:10 -0700 Subject: [PATCH 2/2] use a real node for el --- test/unit/specs/plugins/vis_types/vislib/_renderbot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/specs/plugins/vis_types/vislib/_renderbot.js b/test/unit/specs/plugins/vis_types/vislib/_renderbot.js index ec60f3418f740e..ba902aa5f10961 100644 --- a/test/unit/specs/plugins/vis_types/vislib/_renderbot.js +++ b/test/unit/specs/plugins/vis_types/vislib/_renderbot.js @@ -84,7 +84,7 @@ define(function (require) { } }, mockVisType) }; - var $el = 'element'; + var $el = $('
testing
'); var createVisSpy; var getParamsStub; var renderbot;