import Vue from 'vue'
import VChartist from 'vchartist'
import vctTitle from '../src/index'
Vue.use(VChartist, {
messageNoData: 'You have not enough data'
})
describe('test title plugin', function () {
let el
beforeEach(function () {
el = document.createElement('div')
el.id = 'app'
document.body.appendChild(el)
})
afterEach(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: [{
name: 'test',
data: [1, 3, 2]
}]
},
chartOptions: {
lineSmooth: false,
width: '100%',
height: '300px',
chartPadding: {
top: 40,
right: 400,
bottom: 30,
left: 30
},
plugins: [
vctTitle({
title: 'hello'
})
]
}
}
})
setTimeout(function () {
const legend = document.querySelectorAll('.ct-title')
expect(legend.length).to.be.equal(1)
done()
}, 50)
})
})
|