Would someone have an idea on how to properly test floating-vue implementation using jest/vue-test-utils ?
I was using v-tooltip and testing the tooltip content text with the following assertion as advised here.
it('displays an explanation tooltip when a book cannot be rent', async () => {
const wrapper = renderedComponent({ isAvailableForRent: false });
const button = wrapper.get('[data-testid="rent-button"]');
await button.trigger('mouseenter');
await new Promise((resolve) => {
requestAnimationFrame(() => {
expect(wrapper.text()).toContain('the book is currently taken');
resolve();
});
});
});
It worked.
I am upgrading to floating-vue, while using it as a directive the test no longer pass, reading from the source is that nextFrame() requestAnimationFrame is used in Popper.vue component which is itself used by the directive, so I dont get why it does not work.
I'd love to add a "how to test" section to the docs if anyone has a clue?
Hello,
Would someone have an idea on how to properly test floating-vue implementation using jest/vue-test-utils ?
I was using v-tooltip and testing the tooltip content text with the following assertion as advised here.
It worked.
I am upgrading to floating-vue, while using it as a
directive
the test no longer pass, reading from the source is thatnextFrame() requestAnimationFrame
is used inPopper.vue
component which is itself used by the directive, so I dont get why it does not work.I'd love to add a "how to test" section to the docs if anyone has a clue?