import { mount } from '@vue/test-utils'

import PieChart from '../../lib/components/echarts/pie/index.vue'

describe('测试柱状图是否加载成功', () => {
  const wrapper = mount(PieChart, {
    propsData: {
      width: '300px',
      height: '300px',
      backgroundColor: '#FFF',
      tooltip: {},
      title: {
        text: '数据统计',
        top: 'top',
        left: 'left'
      },
      series: {
        data: [
          { value: 335, name: '宿迁' },
          { value: 310, name: '盐城' },
          { value: 234, name: '连云港' },
          { value: 135, name: '南京市' },
          { value: 548, name: '苏州市' },
          { value: 548, name: '淮安市' },
          { value: 548, name: '徐州市' },
          { value: 548, name: '常州市' },
          { value: 548, name: '无锡市' }
        ]
      }
    }
  })
  it('测试是否渲染成功', () => {
    expect(wrapper.find('canvas')).toBeTruthy()
  })

  it('测试宽度值', () => {
    expect(wrapper.find('div').attributes('style')).toContain('width: 300px')
  })

  it('测试高度值', () => {
    expect(wrapper.find('div').attributes('style')).toContain('height: 300px')
  })
})
