Open shadowgate15 opened 2 years ago
I am also experiencing the same issue, trying to add a custom directive to storybook using Vue 3.
I have found a workaround for this but I feel it should be handled from within the setGlobalConfig
function call.
If you are using @testing-library/vue
to render the component, you have to add the directive in the render
function call.
import { render } from '@testing-library/vue';
render(story(), {
global: {
directives: { DIRECTIVE }
}
});
Describe the bug
Adding a global directive to the 'preview.js' file is not available for the component when rendering.
Steps to reproduce the behavior
Add the following into
preview.js
and add to setup viasetGlobalConfig
.Expected behavior
I would expect the directive to be available in the component for rendering.
Screenshots and/or logs
Environment