this is my component called Musics.vue:
<template>
<div class="flex flex-wrap mb-20 md:mb-32">
<div
v-for="(music, index) in musics"
:key="index"
class="w-full sm:w-6/12 lg:w-3/12 p-3"
>
<MusicCard :music="music" @play="setCurrent($event)" />
</div>
</div>
</template>
as you see MusicCard is in the loop. and each MusicCard emit play event to parent component. have can i write test for it? (i tried to use forEach but it failed)
this is my test:
it("commits a mutation when 'MusicCard' component emits play event", () => {
const components = wrapper.findAllComponents({ name: "MusicCard" });
expect(components.exists()).toBe(true);
});
thanks for your helping.
Aucun commentaire:
Enregistrer un commentaire