Add prop for inline plugins

This commit is contained in:
Daniel Shuy
2017-12-13 20:02:17 +08:00
parent ae13d71081
commit 5486560257
18 changed files with 297 additions and 45 deletions

View File

@@ -76,9 +76,31 @@ describe('PolarChart', () => {
components: { PolarChart }
}).$mount(el)
expect(vm.$children[0].plugins).to.exist
expect(vm.$children[0]._plugins).to.exist
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)
})
})