mirror of
https://github.com/KevinMidboe/vue-chartjs.git
synced 2025-10-29 18:00:20 +00:00
Add prop for inline plugins
This commit is contained in:
@@ -41,6 +41,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -65,13 +71,13 @@ export default {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -80,7 +86,7 @@ export default {
|
|||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -67,13 +73,13 @@ export default {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -83,7 +89,7 @@ export default {
|
|||||||
type: 'bubble',
|
type: 'bubble',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -50,13 +56,13 @@ export default {
|
|||||||
_chart: null,
|
_chart: null,
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -66,7 +72,7 @@ export default {
|
|||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -67,13 +73,13 @@ export default {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options, type) {
|
renderChart (data, options, type) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -82,7 +88,7 @@ export default {
|
|||||||
type: 'horizontalBar',
|
type: 'horizontalBar',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -65,13 +71,13 @@ export default {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -81,7 +87,7 @@ export default {
|
|||||||
type: 'line',
|
type: 'line',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -50,13 +56,13 @@ export default {
|
|||||||
_chart: null,
|
_chart: null,
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -66,7 +72,7 @@ export default {
|
|||||||
type: 'pie',
|
type: 'pie',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -50,13 +56,13 @@ export default {
|
|||||||
_chart: null,
|
_chart: null,
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -66,7 +72,7 @@ export default {
|
|||||||
type: 'polarArea',
|
type: 'polarArea',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -50,13 +56,13 @@ export default {
|
|||||||
_chart: null,
|
_chart: null,
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -66,7 +72,7 @@ export default {
|
|||||||
type: 'radar',
|
type: 'radar',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export default {
|
|||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -56,13 +62,13 @@ export default {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: []
|
_plugins: this.plugins
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addPlugin (plugin) {
|
addPlugin (plugin) {
|
||||||
this.plugins.push(plugin)
|
this._plugins.push(plugin)
|
||||||
},
|
},
|
||||||
renderChart (data, options) {
|
renderChart (data, options) {
|
||||||
let chartOptions = mergeOptions(this.defaultOptions, options)
|
let chartOptions = mergeOptions(this.defaultOptions, options)
|
||||||
@@ -72,7 +78,7 @@ export default {
|
|||||||
type: 'scatter',
|
type: 'scatter',
|
||||||
data: data,
|
data: data,
|
||||||
options: chartOptions,
|
options: chartOptions,
|
||||||
plugins: this.plugins
|
plugins: this._plugins
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('BarChart', () => {
|
|||||||
components: { BarChart }
|
components: { BarChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
BarChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { BarChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('BubbleChart', () => {
|
|||||||
components: { BubbleChart }
|
components: { BubbleChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
BubbleChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { BubbleChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('DoughnutChart', () => {
|
|||||||
components: { DoughnutChart }
|
components: { DoughnutChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
DoughnutChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { DoughnutChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('HorizontalBarChart', () => {
|
|||||||
components: { HorizontalBarChart }
|
components: { HorizontalBarChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
HorizontalBarChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { HorizontalBarChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('LineChart', () => {
|
|||||||
components: { LineChart }
|
components: { LineChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
LineChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { LineChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -75,9 +75,31 @@ describe('PieChart', () => {
|
|||||||
components: { PieChart }
|
components: { PieChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
PieChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { PieChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('PolarChart', () => {
|
|||||||
components: { PolarChart }
|
components: { PolarChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
PolarChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { PolarChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -75,9 +75,31 @@ describe('RadarChart', () => {
|
|||||||
components: { RadarChart }
|
components: { RadarChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
RadarChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { RadarChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -76,9 +76,31 @@ describe('ScatterChart', () => {
|
|||||||
components: { ScatterChart }
|
components: { ScatterChart }
|
||||||
}).$mount(el)
|
}).$mount(el)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins).to.exist
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
vm.$children[0].addPlugin(testPlugin)
|
vm.$children[0].addPlugin(testPlugin)
|
||||||
|
|
||||||
expect(vm.$children[0].plugins.length).to.equal(1)
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add inline plugins based on prop', () => {
|
||||||
|
const testPlugin = {
|
||||||
|
id: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
const vm = new Vue({
|
||||||
|
render: function (createElement) {
|
||||||
|
return createElement(
|
||||||
|
ScatterChart, {
|
||||||
|
props: {
|
||||||
|
plugins: [testPlugin]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
components: { ScatterChart }
|
||||||
|
}).$mount(el)
|
||||||
|
|
||||||
|
expect(vm.$children[0]._plugins).to.exist
|
||||||
|
expect(vm.$children[0]._plugins.length).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user