import { mount } from '@vue/test-utils'
import LineChart from '../../lib/components/echarts/line/index.vue'

describe('测试柱状图是否加载成功', () => {
  const wrapper = mount(LineChart, {
    propsData: {
      xAxis: [
        {
          boundaryGap: false,
          type: 'category',
          data: ['宿迁', '盐城', '连云港', '南京市', '苏州市', '淮安市', '徐州市', '常州市', '无锡市'
          ],
          axisPointer: {
            type: 'shadow'
          }
        }
      ],
      yAxis: [
        {
          name: '单位:（家）',
          type: 'value'
        }
      ],
      width: '400px',
      height: '300px',
      title: {
        text: '数据统计',
        left: 'center'
      },
      tooltip: {},
      legend: {
        data: ['企业数量'],
        left: 'right'
      },
      series: {
        name: '企业数量',
        data: ['26', '27', '28', '30', '35', '31', '18', '12', '1']
      }
    }
  })
  it('测试是否渲染成功', () => {
    expect(wrapper.find('canvas')).toBeTruthy()
  })

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

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