Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

421
Views
Error en vue-test-utils con método de componente de llamada por ref

Estoy tratando de probar un componente que usa vue-multiselect. El componente tiene un botón que borra la selección de opciones y hace que la selección se cierre a través de una llamada al método toggle(). Todo esto funciona en la propia aplicación, pero al probar este método, la prueba da un error asociado con llamar a este método toggle().

 <button class="btn-unselect-all small-button" type="button" @click="cleanSelect">{{ $t("students.clear") }}</button> cleanSelect: function (){ this.$emit('cleanSelectInstitutes', []) this.$refs.multiselectInstitutes.toggle(); }, import {config, mount} from "@vue/test-utils" import FiltersByStudents from '../../assets/src/components/FiltersByStudents' import Multiselect from 'vue-multiselect'; import translations from "../../assets/src/common-resources/translations/translations" const locale = "uk"; config.mocks["$t"] = msg => translations[locale][msg] describe('testing students filters methods', () => { let wrapper; beforeEach(() => { wrapper = mount(FiltersByStudents, { propsData: { filters: { "optionsInstitutes": [ { "id": 1, "name": "VNZ 1" }, { "id": 2, "name": "VNZ 2" }, ], "optionsStudents": [ { "type": 0, "name": "All" }, { "type": 1, "name": "Authorized" }, { "type": 2, "name": "Not Authorized" } ], "selectedInstitutes": [], "selectedStudents": [], "fio": "", "cardNumber": "" }, currentPage: 1, fnSearchStudents: jest.fn() }, stubs: ['Multiselect'] }) }); test('call method clear options and close select', async () => { let btnClearSelect = wrapper.find('.btn-unselect-all') await btnClearSelect.trigger('click') expect(wrapper.emitted().cleanSelectInstitutes[0]).toEqual([[]]) })

})

Prueba superada en consola me sale error

ingrese la descripción de la imagen aquí

Estaré agradecido por cualquier ayuda porque estoy en un callejón sin salida.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!