From 4109fb30f354900387c65bce5f497da16bd3761b Mon Sep 17 00:00:00 2001 From: Jakub Juszczak Date: Tue, 4 Jul 2017 10:31:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Update=20tests=20for=20addPlugin=20?= =?UTF-8?q?method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unit/specs/Bar.spec.js | 22 +++++++++++++++++++++- test/unit/specs/Bubble.spec.js | 20 ++++++++++++++++++++ test/unit/specs/Doughnut.spec.js | 20 ++++++++++++++++++++ test/unit/specs/HorizontalBar.spec.js | 20 ++++++++++++++++++++ test/unit/specs/Line.spec.js | 20 ++++++++++++++++++++ test/unit/specs/Pie.spec.js | 20 ++++++++++++++++++++ test/unit/specs/PolarArea.spec.js | 20 ++++++++++++++++++++ test/unit/specs/Radar.spec.js | 20 ++++++++++++++++++++ test/unit/specs/Scatter.spec.js | 20 ++++++++++++++++++++ 9 files changed, 181 insertions(+), 1 deletion(-) diff --git a/test/unit/specs/Bar.spec.js b/test/unit/specs/Bar.spec.js index ee4439a1..542c4f48 100644 --- a/test/unit/specs/Bar.spec.js +++ b/test/unit/specs/Bar.spec.js @@ -57,8 +57,28 @@ describe('BarChart', () => { vm.$nextTick(() => { vm.$forceUpdate() - expect(vm.$children[0]._chart.chart.ctx).to.be.null + expect(vm.$children[0]._chart.chart.ctx).to.equal done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + BarChart + ) + }, + components: { BarChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Bubble.spec.js b/test/unit/specs/Bubble.spec.js index 690a2a34..3f5ac052 100644 --- a/test/unit/specs/Bubble.spec.js +++ b/test/unit/specs/Bubble.spec.js @@ -61,4 +61,24 @@ describe('BubbleChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + BubbleChart + ) + }, + components: { BubbleChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Doughnut.spec.js b/test/unit/specs/Doughnut.spec.js index 3288a370..8630a9a6 100644 --- a/test/unit/specs/Doughnut.spec.js +++ b/test/unit/specs/Doughnut.spec.js @@ -61,4 +61,24 @@ describe('DoughnutChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + DoughnutChart + ) + }, + components: { DoughnutChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/HorizontalBar.spec.js b/test/unit/specs/HorizontalBar.spec.js index 34c7600a..20c9d4a8 100644 --- a/test/unit/specs/HorizontalBar.spec.js +++ b/test/unit/specs/HorizontalBar.spec.js @@ -61,4 +61,24 @@ describe('HorizontalBarChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + HorizontalBarChart + ) + }, + components: { HorizontalBarChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Line.spec.js b/test/unit/specs/Line.spec.js index be81aa7f..ad6d225f 100644 --- a/test/unit/specs/Line.spec.js +++ b/test/unit/specs/Line.spec.js @@ -61,4 +61,24 @@ describe('LineChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + LineChart + ) + }, + components: { LineChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Pie.spec.js b/test/unit/specs/Pie.spec.js index 2d5c17ea..402d7392 100644 --- a/test/unit/specs/Pie.spec.js +++ b/test/unit/specs/Pie.spec.js @@ -60,4 +60,24 @@ describe('PieChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + PieChart + ) + }, + components: { PieChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/PolarArea.spec.js b/test/unit/specs/PolarArea.spec.js index 868bcc8b..a8d083a8 100644 --- a/test/unit/specs/PolarArea.spec.js +++ b/test/unit/specs/PolarArea.spec.js @@ -61,4 +61,24 @@ describe('PolarChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + PolarChart + ) + }, + components: { PolarChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Radar.spec.js b/test/unit/specs/Radar.spec.js index 47e81ef8..796661bb 100644 --- a/test/unit/specs/Radar.spec.js +++ b/test/unit/specs/Radar.spec.js @@ -60,4 +60,24 @@ describe('RadarChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + RadarChart + ) + }, + components: { RadarChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) }) diff --git a/test/unit/specs/Scatter.spec.js b/test/unit/specs/Scatter.spec.js index 72207b54..df329b55 100644 --- a/test/unit/specs/Scatter.spec.js +++ b/test/unit/specs/Scatter.spec.js @@ -61,4 +61,24 @@ describe('ScatterChart', () => { done() }) }) + + it('should add an inline plugin to the array', () => { + const testPlugin = { + id: 'test' + } + + const vm = new Vue({ + render: function (createElement) { + return createElement( + ScatterChart + ) + }, + components: { ScatterChart } + }).$mount(el) + + expect(vm.$children[0].plugins).to.exist + vm.$children[0].addPlugin(testPlugin) + + expect(vm.$children[0].plugins.length).to.equal(1) + }) })