Closed
Description
Version
1.0.0-beta.32
Reproduction link
https://github.com/kierans/vue-test-utils-bug
Steps to reproduce
- Create a SFC called
Card.vue
<template>
<v-card
outlined
flat
>
<v-list-item>
<v-list-item-avatar
color="grey"
/>
<v-list-item-content>
<v-list-item-title>{{ contents.title }}</v-list-item-title>
<v-list-item-subtitle>
{{ contents.subtitle }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-card-text
class="subtitle-1"
v-bind:class="{
'negative-amount': contents.amount < 0
}"
>
{{ contents.amount }}
</v-card-text>
</v-card>
</template>
<script>
export default {
name: "Card",
data() {
return {
contents: {
title: "Title",
subtitle: "Subtitle",
amount: -10
}
};
}
}
</script>
- Write the following test code
wrapper = shallowMount(Card);
const text: Wrapper<Vue> = wrapper.find(VCardText as ComponentOptions<Vue>);
expect(text.classes("negative-amount"), "Amount not marked as negative").to.be.true;
What is expected?
That the classes array/string will contain the value "negative-amount"
What is actually happening?
The classes array/string contains "[object Object]"
When running the app, the Card is correctly rendered with the "negative-amount" class being added.