Compare commits

..

34 Commits

Author SHA1 Message Date
Jakub Juszczak
53fb0d80d4 💎 Release new version 2.3.4 2017-02-11 12:53:57 +01:00
Jakub Juszczak
f373d47b4c ⬆️ Update dependency chart.js to 2.5.0 2017-02-11 12:40:03 +01:00
Jakub Juszczak
97acbcadd5 🔥 Remove npm dependencies badge
Because it's broken most of the time
2017-02-02 13:27:56 +01:00
Jakub Juszczak
07f4466114 Change svg to png 2017-01-29 15:46:28 +01:00
Jakub Juszczak
14a2c9a4b8 🐛 Fix filename 2017-01-29 15:45:02 +01:00
Jakub Juszczak
00589e7f64 📝 Add Logo to docs 2017-01-29 15:43:52 +01:00
Jakub Juszczak
7d9d514589 📝 Add npm downloads badge to README 2017-01-21 15:42:42 +01:00
Jakub Juszczak
e35d21641e 📝 Update CHANGELOG 2017-01-19 10:35:06 +01:00
Jakub Juszczak
3e77f40043 💎 Release new version v2.3.3 2017-01-19 10:25:58 +01:00
Jakub
158f29d5c9 Merge pull request #31 from apertureless/hotfix/vuedep
🐛 Fix #30 type error
2017-01-19 10:19:46 +01:00
Jakub Juszczak
b1ca492b33 🐛 Fix #30 type error 2017-01-19 10:15:44 +01:00
Jakub Juszczak
88cc75c614 💎 Release new version 2.3.2 2016-12-23 12:34:34 +01:00
Jakub
cba152c7f8 Merge pull request #27 from apertureless/develop
 Add minimal release webpack config
2016-12-23 12:32:36 +01:00
Jakub Juszczak
b2f0a5ba03 Add minimal release webpack config without minimize and without production tags 2016-12-23 12:28:28 +01:00
Jakub
b76236cf9b Merge pull request #25 from apertureless/develop
📝 Update README
2016-12-21 13:22:34 +01:00
Jakub Juszczak
2a1377c01d 📝 Update README 2016-12-21 13:10:37 +01:00
Jakub Juszczak
c3f10a51f5 📝 Update README and CHANGELOG
Signed-off-by: Jakub Juszczak <netghost03@gmail.com>
2016-12-20 20:17:56 +01:00
Jakub Juszczak
7ffefe4454 💎 Release new version 2.3.1
Signed-off-by: Jakub Juszczak <netghost03@gmail.com>
2016-12-20 20:15:53 +01:00
Jakub
ca95e0f146 Merge pull request #24 from apertureless/feature/tests
 Add tests for chart instance destroying
2016-12-20 20:07:09 +01:00
Jakub Juszczak
988d8f13b4 Add tests for chart instance destroying 2016-12-20 20:03:17 +01:00
Jakub
52c1c50206 Merge pull request #23 from apertureless/feature/runtimebuild
Feature/runtimebuild #22
2016-12-20 19:07:45 +01:00
Jakub Juszczak
482048b746 🐛 Fix tests 2016-12-20 18:26:49 +01:00
Jakub Juszczak
bb21a40506 Rewrite template option to render function 2016-12-20 14:36:35 +01:00
Jakub Juszczak
e4ba9ea5a3 Add dependency: template-compiler 2016-12-20 14:34:05 +01:00
Jakub Juszczak
fee32b57df 🔥 Remove vue standalone alias from webpack 2016-12-20 14:33:47 +01:00
Jakub Juszczak
c0b854bd83 Merge branch 'develop'
* develop:
  Replace package quality badge with shield like version
   Add license badge
   Add package quality and liscense badge
2016-12-17 18:33:34 +01:00
Jakub Juszczak
14413e438d Replace package quality badge with shield like version 2016-12-17 18:33:11 +01:00
Jakub Juszczak
7ddc385edb Add license badge 2016-12-17 18:31:31 +01:00
Jakub Juszczak
a62a108318 Add package quality and liscense badge 2016-12-17 18:31:13 +01:00
Jakub Juszczak
a1633c0d19 Merge branch 'develop'
* develop:
  📝 Update changelog
2016-12-17 18:22:40 +01:00
Jakub Juszczak
5ec1f31a4b 📝 Update changelog 2016-12-17 18:22:33 +01:00
Jakub Juszczak
ced81a58cc Merge branch 'hotfix/minification'
* hotfix/minification:
  ⬆️ Update npm version
  💎 Release new version v2.3.0
  📝 Update README
   Add mixins to alias
  ⬆️ Update dependencies
  Change mixins exports to be seperate
2016-12-17 18:20:03 +01:00
Jakub Juszczak
193b5cac33 Merge branch 'hotfix/minification' into develop
* hotfix/minification:
  ⬆️ Update npm version
  💎 Release new version v2.3.0
  📝 Update README
   Add mixins to alias
  ⬆️ Update dependencies
  Change mixins exports to be seperate
2016-12-17 18:20:03 +01:00
Jakub Juszczak
dde366c154 ⬆️ Update npm version 2016-12-17 18:19:06 +01:00
24 changed files with 43639 additions and 91 deletions

View File

@@ -1,8 +1,68 @@
# Change Log
## [Unreleased](https://github.com/apertureless/vue-chartjs/tree/HEAD)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.3.3...HEAD)
**Fixed bugs:**
- Compatibility with Vue 2.1.10 [\#30](https://github.com/apertureless/vue-chartjs/issues/30)
## [v2.3.3](https://github.com/apertureless/vue-chartjs/tree/v2.3.3) (2017-01-19)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.3.2...v2.3.3)
**Closed issues:**
- How to create mixed chart types [\#29](https://github.com/apertureless/vue-chartjs/issues/29)
- hello a q about reactivity [\#28](https://github.com/apertureless/vue-chartjs/issues/28)
- chart do not render after build [\#26](https://github.com/apertureless/vue-chartjs/issues/26)
**Merged pull requests:**
- 🐛 Fix \#30 type error [\#31](https://github.com/apertureless/vue-chartjs/pull/31) ([apertureless](https://github.com/apertureless))
## [v2.3.2](https://github.com/apertureless/vue-chartjs/tree/v2.3.2) (2016-12-23)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.3.1...v2.3.2)
**Implemented enhancements:**
- Content Security Policy [\#22](https://github.com/apertureless/vue-chartjs/issues/22)
**Merged pull requests:**
- ✨ Add minimal release webpack config [\#27](https://github.com/apertureless/vue-chartjs/pull/27) ([apertureless](https://github.com/apertureless))
- 📝 Update README [\#25](https://github.com/apertureless/vue-chartjs/pull/25) ([apertureless](https://github.com/apertureless))
## [v2.3.1](https://github.com/apertureless/vue-chartjs/tree/v2.3.1) (2016-12-20)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.3.0...v2.3.1)
**Fixed bugs:**
- Issues after using gulp-- production [\#19](https://github.com/apertureless/vue-chartjs/issues/19)
**Closed issues:**
- Error in rendering [\#21](https://github.com/apertureless/vue-chartjs/issues/21)
**Merged pull requests:**
- ✅ Add tests for chart instance destroying [\#24](https://github.com/apertureless/vue-chartjs/pull/24) ([apertureless](https://github.com/apertureless))
- Feature/runtimebuild \#22 [\#23](https://github.com/apertureless/vue-chartjs/pull/23) ([apertureless](https://github.com/apertureless))
## [v2.3.0](https://github.com/apertureless/vue-chartjs/tree/v2.3.0) (2016-12-17)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.2.1...v2.3.0)
**Closed issues:**
- Uncaught TypeError: \_c is not a function [\#20](https://github.com/apertureless/vue-chartjs/issues/20)
## [v2.2.1](https://github.com/apertureless/vue-chartjs/tree/v2.2.1) (2016-12-07)
[Full Changelog](https://github.com/apertureless/vue-chartjs/compare/v2.2.0...v2.2.1)
**Fixed bugs:**
- Uncaught TypeError: Cannot read property 'draw' of null [\#15](https://github.com/apertureless/vue-chartjs/issues/15)
**Merged pull requests:**
- Update README.md [\#16](https://github.com/apertureless/vue-chartjs/pull/16) ([Ag47](https://github.com/Ag47))
@@ -73,4 +133,4 @@
## [1.0.2](https://github.com/apertureless/vue-chartjs/tree/1.0.2) (2016-07-27)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

View File

@@ -1,8 +1,21 @@
# Vue-ChartJs
<div align="center">
<img width="256" heigth="256" src="/assets/vue-chartjs.png" alt="vue-chartjs logo">
</div>
[![npm version](https://badge.fury.io/js/vue-chartjs.svg)](https://badge.fury.io/js/vue-chartjs) ![npm dependencies](https://david-dm.org/apertureless/vue-chartjs.svg) [![codecov](https://codecov.io/gh/apertureless/vue-chartjs/branch/master/graph/badge.svg)](https://codecov.io/gh/apertureless/vue-chartjs) [![Build Status](https://travis-ci.org/apertureless/vue-chartjs.svg?branch=master)](https://travis-ci.org/apertureless/vue-chartjs)
[![npm version](https://badge.fury.io/js/vue-chartjs.svg)](https://badge.fury.io/js/vue-chartjs)
[![codecov](https://codecov.io/gh/apertureless/vue-chartjs/branch/master/graph/badge.svg)](https://codecov.io/gh/apertureless/vue-chartjs)
[![Build Status](https://travis-ci.org/apertureless/vue-chartjs.svg?branch=master)](https://travis-ci.org/apertureless/vue-chartjs)
[![Package Quality](http://npm.packagequality.com/shield/vue-chartjs.svg)](http://packagequality.com/#?package=vue-chartjs)
[![npm](https://img.shields.io/npm/dm/localeval.svg)](https://www.npmjs.com/package/vue-chartjs)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/apertureless/vue-chartjs/blob/master/LICENSE.txt)
Is a vue.js wrapper for chart.js. You can easily create your chart components. [See in action](https://apertureless.github.io/vue-chartjs/)
# vue-chartjs
**vue-chartjs** is a wrapper for [Chart.js](https://github.com/chartjs/Chart.js) in vue. You can easily create reuseable chart components.
## Demo
[Demo](https://apertureless.github.io/vue-chartjs/)
### Compatibility

BIN
assets/vue-chartjs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

1
assets/vue-chartjs.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><defs><linearGradient id="a" x1="100%" x2="0%" y1="4.18%" y2="65.116%"><stop stop-color="#FAFAFA" offset="0%"/><stop stop-color="#D9D9D9" offset="100%"/></linearGradient><linearGradient id="b" x1="108.208%" x2="5.433%" y1="12.265%" y2="86.92%"><stop stop-color="#FAFAFA" offset="0%"/><stop stop-color="#D9D9D9" offset="100%"/></linearGradient></defs><g fill="none"><path fill="#fff" stroke="#EBEBEB" stroke-width="8.456" d="M128.744 13l99.745 57.46v114.921l-99.745 57.46-99.744-57.46v-114.921z"/><path fill="url(#a)" d="M129 17.941l90.395 51.432-4.057 117.675-86.903 4.653z"/><path fill="url(#b)" d="M129 17.814l-90.961 51.559-3.191 113.538 93.587 8.79z"/><path fill="#41B883" d="M32.955 72.755l95.789 54.681v110.49l-95.789-54.681z"/><path fill="#35495E" d="M224.48 71.627l-95.789 55.809v110.49l95.789-54.681z"/><path fill="#596F85" d="M224.48 71.627l-95.789 55.809v-7.892l88.445-51.299z"/><path fill="#61D09F" d="M32.955 72.755l95.789 54.681v-7.892l-89.575-50.171z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -16,7 +16,6 @@ module.exports = {
extensions: ['', '.js', '.vue'],
fallback: [path.join(__dirname, '../node_modules')],
alias: {
'vue': 'vue/dist/vue.common.js',
'src': path.resolve(__dirname, '../src'),
'mixins': path.resolve(__dirname, '../src/mixins'),
'BaseCharts': path.resolve(__dirname, '../src/BaseCharts')

78
build/webpack.release.js Normal file
View File

@@ -0,0 +1,78 @@
var vue = require('vue-loader')
var path = require('path')
var webpack = require("webpack")
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var projectRoot = path.resolve(__dirname, '../')
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
module.exports = {
entry: {
'vue-chartjs': './src/index.js'
},
output: {
filename: './dist/[name].js',
library: 'VueChartJs',
libraryTarget: 'umd'
},
module: {
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
}
],
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.css$/,
loader: cssLoader
},
{
test: /\.s[a|c]ss$/,
loader: ExtractTextPlugin.extract('style-loader','css-loader!sass-loader')
}
]
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime']
}
}
if (process.env.NODE_ENV === 'production') {
delete module.exports.devtool
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
// new ExtractTextPlugin('build.css')
]
}

43111
dist/vue-chartjs.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "vue-chartjs",
"version": "2.2.1",
"description": "Vue wrapper for chart.js",
"version": "2.3.4",
"description": "vue.js wrapper for chart.js",
"author": "Jakub Juszczak <jakub@nextindex.de>",
"repository": {
"type": "git",
@@ -22,12 +22,12 @@
"e2e": "node test/e2e/runner.js",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"prepublish": "node build/build.js"
"release": "webpack --progress --hide-modules --config ./build/webpack.release.js"
},
"dependencies": {
"babel-runtime": "^6.11.6",
"chart.js": "^2.4.0",
"vue": "^2.1.6"
"chart.js": "^2.5.0",
"vue": "^2.1.10"
},
"devDependencies": {
"babel-core": "^6.10.4",
@@ -67,7 +67,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "^1.7.0",
"lodash": "^4.16.3",
"lodash": "^4.17.4",
"lolex": "^1.4.0",
"mocha": "^3.1.0",
"nightwatch": "^0.9.8",
@@ -82,6 +82,7 @@
"vue-html-loader": "^1.2.3",
"vue-loader": "^10.0.2",
"vue-style-loader": "^1.0.0",
"vue-template-compiler": "^2.1.10",
"webpack": "^1.13.2",
"webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0",

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {
@@ -51,7 +63,6 @@ export default Vue.extend({
methods: {
renderChart (data, options, type) {
let chartOptions = mergeOptions(this.defaultOptions, options)
this._chart = new Chart(
this.$refs.canvas.getContext('2d'), {
type: type || 'bar',

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -3,11 +3,23 @@ import Chart from 'chart.js'
import { mergeOptions } from '../helpers/options'
export default Vue.extend({
template: `
<div>
<canvas :id="chartId" :width="width" :height="height" ref="canvas"></canvas>
</div>
`,
render: function (createElement) {
return createElement(
'div',
[
createElement(
'canvas', {
attrs: {
id: this.chartId,
width: this.width,
height: this.height
},
ref: 'canvas'
}
)
]
)
},
props: {
chartId: {

View File

@@ -10,7 +10,11 @@ describe('BarChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<bar-chart></bar-chart>',
render: function (createElement) {
return createElement(
BarChart
)
},
components: { BarChart }
}).$mount(el)
@@ -22,10 +26,39 @@ describe('BarChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<bar-chart chartId="barchartprop"></bar-chart>',
render: function (createElement) {
return createElement(
BarChart, {
props: {
chartId: 'barchartprop'
}
}
)
},
components: { BarChart }
}).$mount(el)
expect(vm.$el.querySelector('#barchartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
BarChart
)
},
components: { BarChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('BubbleChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<bubble-chart></bubble-chart>',
render: function (createElement) {
return createElement(
BubbleChart
)
},
components: { BubbleChart }
}).$mount(el)
@@ -22,10 +26,39 @@ describe('BubbleChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<bubble-chart chartId="bubblechartprop"></bubble-chart>',
render: function (createElement) {
return createElement(
BubbleChart, {
props: {
chartId: 'bubblechartprop'
}
}
)
},
components: { BubbleChart }
}).$mount(el)
expect(vm.$el.querySelector('#bubblechartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
BubbleChart
)
},
components: { BubbleChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('DoughnutChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<doughnut-chart></doughnut-chart>',
render: function (createElement) {
return createElement(
DoughnutChart
)
},
components: { DoughnutChart }
}).$mount(el)
@@ -22,10 +26,39 @@ describe('DoughnutChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<doughnut-chart chartId="doughnutchartprop"></doughnut-chart>',
render: function (createElement) {
return createElement(
DoughnutChart, {
props: {
chartId: 'doughnutchartprop'
}
}
)
},
components: { DoughnutChart }
}).$mount(el)
expect(vm.$el.querySelector('#doughnutchartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
DoughnutChart
)
},
components: { DoughnutChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('LineChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<line-chart></line-chart>',
render: function (createElement) {
return createElement(
LineChart
)
},
components: { LineChart }
}).$mount(el)
@@ -22,10 +26,39 @@ describe('LineChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<line-chart chartId="linechartprop"></line-chart>',
render: function (createElement) {
return createElement(
LineChart, {
props: {
chartId: 'linechartprop'
}
}
)
},
components: { LineChart }
}).$mount(el)
expect(vm.$el.querySelector('#linechartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
LineChart
)
},
components: { LineChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('PieChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<pie-chart></pie-chart>',
render: function (createElement) {
return createElement(
PieChart
)
},
components: { PieChart }
}).$mount(el)
@@ -22,10 +26,38 @@ describe('PieChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<pie-chart chartId="piechartprop"></pie-chart>',
render: function (createElement) {
return createElement(
PieChart, {
props: {
chartId: 'piechartprop'
}
}
)
},
components: { PieChart }
}).$mount(el)
expect(vm.$el.querySelector('#piechartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
PieChart
)
},
components: { PieChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('PolarChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<polar-chart></polar-chart>',
render: function (createElement) {
return createElement(
PolarChart
)
},
components: { PolarChart }
}).$mount(el)
@@ -22,10 +26,39 @@ describe('PolarChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<polar-chart chartId="polarchartprop"></polar-chart>',
render: function (createElement) {
return createElement(
PolarChart, {
props: {
chartId: 'polarchartprop'
}
}
)
},
components: { PolarChart }
}).$mount(el)
expect(vm.$el.querySelector('#polarchartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
PolarChart
)
},
components: { PolarChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -10,7 +10,11 @@ describe('RadarChart', () => {
it('should render a canvas', () => {
const vm = new Vue({
template: '<radar-chart></radar-chart>',
render: function (createElement) {
return createElement(
RadarChart
)
},
components: { RadarChart }
}).$mount(el)
@@ -22,10 +26,38 @@ describe('RadarChart', () => {
it('should change id based on prop', () => {
const vm = new Vue({
template: '<radar-chart chartId="rodarchartprop"></radar-chart>',
render: function (createElement) {
return createElement(
RadarChart, {
props: {
chartId: 'rodarchartprop'
}
}
)
},
components: { RadarChart }
}).$mount(el)
expect(vm.$el.querySelector('#rodarchartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
RadarChart
)
},
components: { RadarChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})

View File

@@ -1066,9 +1066,9 @@ change-case@3.0.x:
upper-case "^1.1.1"
upper-case-first "^1.1.0"
chart.js@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.4.0.tgz#44198073f0f43e5e16662e108420d92652a3c9a3"
chart.js@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.5.0.tgz#fe6e751a893769f56e72bee5ad91207e1c592957"
dependencies:
chartjs-color "^2.0.0"
moment "^2.10.6"
@@ -1535,6 +1535,10 @@ dateformat@^1.0.6:
get-stdin "^4.0.1"
meow "^3.3.0"
de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
debug@0.7.4:
version "0.7.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"
@@ -2527,7 +2531,7 @@ hawk@~3.1.3:
hoek "2.x.x"
sntp "1.x.x"
he@1.1.x:
he@1.1.x, he@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.0.tgz#29319d49beec13a9b1f3c4f9b2a6dde4859bb2a7"
@@ -3378,9 +3382,9 @@ lodash@^3.8.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.16.3, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
log-symbols@^1.0.2:
version "1.0.2"
@@ -5501,13 +5505,20 @@ vue-style-loader@^1.0.0:
dependencies:
loader-utils "^0.2.7"
vue-template-compiler@^2.1.10:
version "2.1.10"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.1.10.tgz#cb89643adc395e97435585522e43d0a9b1913257"
dependencies:
de-indent "^1.0.2"
he "^1.1.0"
vue-template-es2015-compiler@^1.2.2:
version "1.4.0"
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.4.0.tgz#7b88853ca4bf8d84ae54ab9e56771de271e60198"
vue@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.1.6.tgz#2fc0024c07479ac6bc7d34a2cd5ef9ca5e90b143"
vue@^2.1.10:
version "2.1.10"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.1.10.tgz#c9235ca48c7925137be5807832ac4e3ac180427b"
watchpack@^0.2.1:
version "0.2.9"