import $ from 'jquery'
import init from '../../init'
import {TestUtil} from 'vue-client'
import Edit from 'src/components/Authorization/Edit'
import Vue from 'vue'
import * as Util from 'src/components/Util'

describe('授权测试', () => {
  let vm = null
  before(() => {
    init()
    vm = TestUtil.createTest(Edit, {data: {id: '1531'}})
  })

  after(function () {
  })

  it('组件能够正确显示', (done) => {
    vm.$login = {f: {id: '11'}}
    Util.loadRightResource(vm).then(() => {
      vm.getRightData().then(() => {
        vm.model = Util.f
        vm.$nextTick(() => {
          done()
        })
      })
    })
  })

  it('选择资源', (done) => {
    // 选中呼叫系统
    let res = Util.getResourceById('633')
    vm.modifyMark(res)
    // 取消两项
    res = Util.getResourceById('645')
    vm.modifyMark(res)
    res = Util.getResourceById('653')
    vm.modifyMark(res)
    // 选中档案系统
    res = Util.getResourceById('741')
    vm.modifyMark(res)
    // 选中报表系统
    res = Util.getResourceById('23125')
    vm.modifyMark(res)
    // 取消一项
    res = Util.getResourceById('23129')
    vm.modifyMark(res)
    done()
  })

  it('保存', (done) => {
    // 保存
    vm.save()
    done()
  })
})
