1

I have a component like this text-box.vue

<template>
    <3rd-party-text v-bind="$attrs" />
</template>

using it like

...
<text-box :value="my value" />
...

Now the issue is how to write a unit test for text-box.vue so that I can validate if the $attrs is updated, something like

wrapper = mount(TextBox, {
    attrs: { value: 'test value' }
});
wrapper.vm.$attrs.value = 'update';
console.log(wrapper.vm.$refs.tb.value);
// still showing the 'test value' i.e. the one which was provided on mount

I see there are methods like setData and setProps but how to update $attrs?

4

0 に答える 0