Estoy tan confundido con lo que sucede con mi código. Soy nuevo en broma y pruebas unitarias, mientras desarrollo utilizo bootstrap-vue, nuxt y vue test utils (broma) para pruebas unitarias.
En breve, tengo un componente personalizado (CheckboxInput). este componente usa b-form-checkbox-group de bootstrap vue es mi código.
props : { ...another props, value : {default : () => ({}), }, computed : { local_value: { get: function () { return this.value }, set: function (value) { this.$emit('input', value) } }, } -------- <b-form-checkbox-group :id="id" :ref="id" :class="additional_class" v-model="local_value" :size="size" :indeterminate="is_indeterminate" :disabled="is_disabled" :stacked="is_vertical" > <b-form-checkbox v-for="(option, index) in options" :key="index" :value="option.value" :disabled="option.is_disabled" :checked="is_force_unchecked" :unchecked-value="option.unchecked_value ? option.unchecked_value : false" > {{ option.text }} </b-form-checkbox> </b-form-checkbox-group>Quiero crear una prueba simple para asegurarme de que el valor DOM de las opciones seleccionadas por el usuario coincida. es mi prueba
it("select one option", async () => { // options value is => [{list}, {of}, {object}] const random = Math.floor(Math.random() * options.length) const input = wrapper.find(`#${checkbox_id}`) let opt = input.find(`input[value='${options[random].value}']`) opt.trigger("click") // this wrapper still contain default value, but i can find that component properly console.log(wrapper.vm.local_value) console.log(options[random]) console.log(opt.html())No sé qué sucede con mi código y cómo activarlo correctamente. por favor ayúdame si tienes alguna solución para mí, también tengo otra pregunta. "Cómo verificar o intentar capturar la prueba si funciona o no en las utilidades de prueba jest/vue"
Gracias por tu tiempo.