jeudi 5 mars 2020

Vue JS Jest : mount() doesn't render properly

MyView.vue :

<template>
  <v-container fluid>
    <v-row>
      <v-col v-for="obj in myObjs" :key="obj.ref">
        <MyChild :obj="obj" />
      </v-col>
    </v-row>
  </v-container>
</template>

MyView.spec.ts :

it('should render', () => {
  wrapper = mount(MyView, {
    stubs: ['router-link']
  })
  expect(wrapper.findAll(MyChild).length).toBe(2)
})

Content of wrapper.html():

<v-container fluid=\"\"><v-container fluid=\"\"><v-row></v-row></v-container></v-container>

There is nothing inside "row" but there should be multiple MyChild ; so, I don't understand. Could you help me ?

Aucun commentaire:

Enregistrer un commentaire