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

import LineChart from '../../lib/components/echarts/line/index.vue'

describe('测试柱状图是否加载成功', () => {
  const wrapper = mount(LineChart, {
    propsData: {
      width: '300px',
      height: '300px',
      title: {
        text: '雷达图'
      },
      legend: {
        data: ['数据统计']
      },
      tooltip: {},
      radar: {
        name: {
          textStyle: {
            color: '#999999',
            fontSize: 12,
            borderRadius: 3,
            padding: [3, 5]
          }
        },
        splitNumber: 2,
        indicator: [
          { name: '宿迁', max: 30 },
          { name: '盐城', max: 30 },
          { name: '连云港', max: 40 },
          { name: '南京市', max: 50 },
          { name: '苏州市', max: 60 },
          { name: '淮安市', max: 65 },
          { name: '徐州市', max: 65 },
          { name: '常州市', max: 70 },
          { name: '无锡市', max: 70 },
          { name: '镇江市', max: 80 },
          { name: '南通市', max: 90 },
          { name: '泰州市', max: 100 },
          { name: '扬州市', max: 30 }
        ]
      },
      series: [{
        type: 'radar',
        data: [{
          value: [20, 20, 30, 40, 50, 55, 55, 60, 60, 70, 80, 90, 20],
          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')
  })
})
