I have a problem in testing the components.
So i want to test a modal, however, when i try to test it, i get this error
expect(received).toBe(expected) // Object.is equality
Expected: true
Received: false
My modal is
<b-modal
id="plugin-google-analytics-webmag"
size="lg"
centered
ok-only
hide-header-close
no-close-on-esc
no-close-on-backdrop
>
and my test is
it ('opens a modal', (done) => {
const button = wrapper.findAll('[data-qa="button"]');
const modal = wrapper.findAll('#plugin-google-analytics-webmag');
expect(button.exists()).toBe(true);
expect(button.is('button')).toBe(true);
expect(modal.exists()).toBe(true);
expect(modal.is('div')).toBe(true);
expect(modal.isVisible()).toBe(false);
button.trigger('click');
Vue.nextTick(() => {
expect(modal.isVisible()).toBe(true);
done();
});
I use the code from How do you open a bootstrap-vue modal with vue-test-utils?
Do you have some suggestions?
Aucun commentaire:
Enregistrer un commentaire