Skip to content
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

[6.x] Add Vue 3 support to the assertVue*() methods #834

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Nov 19, 2020

Fixes: #832

Vue 3 no longer adds a __vue__ property to DOM nodes to allow querying for props. Instead the __vueParentComponent must be inspected. Its 'ctx' property is an object containing the:

  • passed in component props
  • data() defined within the component
  • any computed props

The above three items would be checked by Laravel Dusk to assert v-model value bindings.

When Dusk is looking up the Vue prop value of a DOM node, it will first look for a Vue 2 __vue__ property, then fallback to __vueParentComponent.ctx for Vue 3.

Vue 3 no longer adds a __vue__ property to
DOM nodes to allow querying for props. Instead
the __vueParentComponent must be inspected.
Its 'ctx' property will return the:

* passed in component props
* data()
* computed props

When Dusk is looking up the Vue prop value
of a DOM node, it will first look for a Vue 2
__vue__ property, then fallback to
__vueParentComponent.ctx for Vue 3.
@taylorotwell taylorotwell merged commit 601652e into laravel:6.x Nov 20, 2020
@taylorotwell
Copy link
Member

This would have been hard to figure out on my own. Thank you ❤️

@derekmd derekmd deleted the vue-3-support branch November 20, 2020 01:44
@driesvints
Copy link
Member

Thanks @derekmd!

@lk77
Copy link
Contributor

lk77 commented Mar 22, 2022

@derekmd For me, this vue3 support does not always work, it can cause TypeError: Converting circular structure to JSON
because of the JSON.stringify call

i've created an issue for that : #968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[6.x] assertVue no longer works with Vue 3.x
4 participants