预期的:true收到的:false

问题描述

我在测试组件时遇到问题。

所以我想测试一个模态,但是,当我尝试对其进行测试时,出现此错误

expect(received).toBe(expected) // Object.is equality

    Expected: true
    Received: false

我的模态是

<b-modal
        id="plugin-google-analytics-webmag"
        size="lg"
        centered
        ok-only
        hide-header-close
        no-close-on-esc
        no-close-on-backdrop
        
    >

我的考试是

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();
    });

我使用了How do you open a bootstrap-vue modal with vue-test-utils?中的代码

您有什么建议吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)