-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: vue2 global directives in component testing #24488
fix: vue2 global directives in component testing #24488
Conversation
Thanks for taking the time to open a PR!
|
650d142
to
7e34a54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good... I guess this is a bug in Test Utils, I wonder if we should patch it there, too. Happy to do it here, though - thanks for the PR and test.
@@ -13,4 +15,30 @@ describe('<Logo />', () => { | |||
|
|||
cy.contains('h1', slotContent) | |||
}) | |||
|
|||
it('Vue2 custom directive should work ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job figuring out where to add a test 👍
Hmmm looks like some CI failures. I will take a look. |
I pushed a commit to fix the tests. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
mount()
now accept a extensions.directives option, which will be registered globally for Vue2 component testingAdditional details
To register custom vue directive you should pass option like
and this works but only for first level mounted component.
If you test component with nested components which have custom directive, you see error in console
[Vue warn]: Failed to resolve directive: customDirective
Steps to test
How has the user experience changed?
Now you can pass
And it will be registered globally and works everywhere.
See example /system-tests/projects/vueclivue2-configured/src/components/HelloWorld.cy.js
cypress-documentation
?type definitions
?