Skip to content

Commit

Permalink
[6.x] Fixed vueAttribute for older Vue 2.x projects (#970)
Browse files Browse the repository at this point in the history
* Fixed vueAttribute for older Vue 2.X projects

* Update MakesAssertionsTest.php
  • Loading branch information
myMartek authored Apr 4, 2022
1 parent 38cd370 commit f42844d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Concerns/MakesAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public function vueAttribute($componentSelector, $key)
return $this->driver->executeScript(
"var el = document.querySelector('".$fullSelector."');".
"if (typeof el.__vue__ !== 'undefined')".
' return el.__vue.'.$key.';'.
' return el.__vue__.'.$key.';'.
'try {'.
' var attr = el.__vueParentComponent.ctx.'.$key.';'.
" if (typeof attr !== 'undefined')".
Expand Down
6 changes: 3 additions & 3 deletions tests/MakesAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ public function test_assert_vue()
->with(
"var el = document.querySelector('body foo');".
"if (typeof el.__vue__ !== 'undefined')".
' return el.__vue.foo;'.
' return el.__vue__.foo;'.
'try {'.
' var attr = el.__vueParentComponent.ctx.foo;'.
" if (typeof attr !== 'undefined')".
Expand Down Expand Up @@ -1078,7 +1078,7 @@ public function test_assert_vue_is_not()
->with(
"var el = document.querySelector('body foo');".
"if (typeof el.__vue__ !== 'undefined')".
' return el.__vue.foo;'.
' return el.__vue__.foo;'.
'try {'.
' var attr = el.__vueParentComponent.ctx.foo;'.
" if (typeof attr !== 'undefined')".
Expand Down Expand Up @@ -1136,7 +1136,7 @@ public function test_assert_vue_contains_formats_vue_prop_query()
->with(
'var el = document.querySelector(\'body [dusk="vue-component"]\');'.
"if (typeof el.__vue__ !== 'undefined')".
' return el.__vue.name;'.
' return el.__vue__.name;'.
'try {'.
' var attr = el.__vueParentComponent.ctx.name;'.
" if (typeof attr !== 'undefined')".
Expand Down

0 comments on commit f42844d

Please sign in to comment.