From ac5faf450fc4aaf0072aa6a4dc22a1915ebbe679 Mon Sep 17 00:00:00 2001 From: myMartek Date: Mon, 4 Apr 2022 05:25:14 +0200 Subject: [PATCH 1/2] Fixed vueAttribute for older Vue 2.X projects --- src/Concerns/MakesAssertions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Concerns/MakesAssertions.php b/src/Concerns/MakesAssertions.php index f868332fc..1435d2284 100644 --- a/src/Concerns/MakesAssertions.php +++ b/src/Concerns/MakesAssertions.php @@ -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')". From 2ef71f8b0662c95212d7c1d623f485be4efea169 Mon Sep 17 00:00:00 2001 From: myMartek Date: Mon, 4 Apr 2022 05:31:40 +0200 Subject: [PATCH 2/2] Update MakesAssertionsTest.php --- tests/MakesAssertionsTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/MakesAssertionsTest.php b/tests/MakesAssertionsTest.php index 1e09adbb8..b41d22ea2 100644 --- a/tests/MakesAssertionsTest.php +++ b/tests/MakesAssertionsTest.php @@ -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')". @@ -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')". @@ -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')".