Ways to resolve tooltip warnings in test cases in Vue Test Utils
P粉293341969
P粉293341969 2023-08-26 19:41:24
0
1
475
<p>When using bootstrap-vue's v-b-tooltip.hover, a warning always appears in the unit test: </p><p><strong>[BootstrapVue warn]: tooltip - the provided target is not valid HTML element. </strong></p>
P粉293341969
P粉293341969

reply all(1)
P粉163465905

I found that using attachTo: createContainer() when defining componentData can solve the problem. At the same time, whenever the wrapper is redefined, it must also be redefined.

const createContainer = (tag = "div") => {
  const container = document.createElement(tag);
  document.body.appendChild(container);

  return container;
};

const componentData = {
  attachTo: createContainer(),
  store,
  localVue
};

const wrapper = shallowMount(Index, componentData);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template