index.js 690 B

12345678910111213141516171819202122232425262728
  1. import { shallowMount } from '@vue/test-utils'
  2. import CpuRadio from '../index.vue'
  3. describe('CpuRadio', () => {
  4. const decorator = [
  5. 'vcpu',
  6. {
  7. initialValue: 2,
  8. },
  9. ]
  10. const options = [1, 2, 4]
  11. it('check show ...', () => {
  12. const max = 2
  13. const wrapper = shallowMount(CpuRadio, {
  14. propsData: { decorator, options, max },
  15. })
  16. expect(wrapper.html()).toContain('...')
  17. })
  18. it('check cpu item2 is disabled', () => {
  19. const disableOptions = [2]
  20. const wrapper = shallowMount(CpuRadio, {
  21. propsData: { decorator, options, disableOptions },
  22. })
  23. expect(wrapper.find('a-radio-button-stub[disabled="true"]').exists()).toBe(true)
  24. })
  25. })