import Vue from 'vue'
import VChartist from '../src/index'
Vue.use(VChartist)
describe('test vue plugin', () => {
let el
before(function () {
el = document.createElement('div')
el.id = 'app'
document.body.appendChild(el)
})
after(function () {
el.parentElement.removeChild(el)
})
it('should render correct contents', done => {
const vm = new Vue({
el,
replace: false,
template: `<chartist
type="Line"
:data="chartData"
:options="chartOptions">
</chartist>`,
data: {
chartData: {
labels: ['A', 'B', 'C'],
series: [
[1, 3, 2],
[4, 6, 5]
]
},
chartOptions: {
lineSmooth: false,
width: '600px',
height: '300px'
}
}
})
setTimeout(function () {
const svg = document.getElementsByTagName('svg')
expect(svg.length).to.be.equal(1)
done()
}, 50)
})
})
|