audio.test.tsx 794 B

12345678910111213141516171819202122232425
  1. import { ref } from 'vue'
  2. import { mount } from '@vue/test-utils'
  3. import { describe, expect, test } from 'vitest'
  4. import Audio from '../src/audio.vue'
  5. // import type { VNode } from 'vue';
  6. // const _mount = (render: () => VNode) => {
  7. // return mount(render, { attachTo: document.body })
  8. // }
  9. describe('Audio.vue', () => {
  10. // test('render test', async () => {
  11. // const AudioSrc = '';
  12. // const wrapper = mount(() => <Audio src={AudioSrc}></Audio>);
  13. // await nextTick();
  14. // });
  15. test('play', async () => {
  16. const radio = ref('')
  17. const wrapper = mount(() => <Audio v-model={radio.value} />)
  18. await wrapper.trigger('click')
  19. expect(radio.value).toBe('')
  20. expect(wrapper.classes()).toContain('is-disabled')
  21. })
  22. })