diff --git a/src/ElementResolver.php b/src/ElementResolver.php index ff7e05701..92b1d1c71 100644 --- a/src/ElementResolver.php +++ b/src/ElementResolver.php @@ -410,12 +410,7 @@ public function format($selector) ); if (Str::startsWith($selector, '@') && $selector === $originalSelector) { - $segments = explode('@', $selector); - - return trim(sprintf('%s,%s', - $this->prefix.' [dusk="'.$segments[1].'"]', - $this->prefix.' [data-dusk="'.$segments[1].'"]' - )); + $selector = '[dusk="'.explode('@', $selector)[1].'"]'; } return trim($this->prefix.' '.$selector); diff --git a/tests/ComponentTest.php b/tests/ComponentTest.php index bed471cb3..9ed25ff55 100644 --- a/tests/ComponentTest.php +++ b/tests/ComponentTest.php @@ -94,7 +94,7 @@ public function test_root_selector_can_be_dusk_hook() $component->selector = '@dusk-hook-root'; $browser->within($component, function ($browser) { - $this->assertSame('body [dusk="dusk-hook-root"],body [data-dusk="dusk-hook-root"]', $browser->resolver->prefix); + $this->assertSame('body [dusk="dusk-hook-root"]', $browser->resolver->prefix); }); } diff --git a/tests/ElementResolverTest.php b/tests/ElementResolverTest.php index 6ea3be956..0ade5543d 100644 --- a/tests/ElementResolverTest.php +++ b/tests/ElementResolverTest.php @@ -146,7 +146,7 @@ public function test_format_correctly_formats_selectors() $this->assertSame('prefix #first', $resolver->format('@modal')); $this->assertSame('prefix #second', $resolver->format('@modal-second')); $this->assertSame('prefix #first-third', $resolver->format('@modal-third')); - $this->assertSame('prefix [dusk="missing-element"],prefix [data-dusk="missing-element"]', $resolver->format('@missing-element')); + $this->assertSame('prefix [dusk="missing-element"]', $resolver->format('@missing-element')); } public function test_find_by_id_with_colon() diff --git a/tests/MakesAssertionsTest.php b/tests/MakesAssertionsTest.php index 668184c9b..b41d22ea2 100644 --- a/tests/MakesAssertionsTest.php +++ b/tests/MakesAssertionsTest.php @@ -1134,7 +1134,7 @@ public function test_assert_vue_contains_formats_vue_prop_query() $driver = m::mock(stdClass::class); $driver->shouldReceive('executeScript') ->with( - 'var el = document.querySelector(\'body [dusk="vue-component"],body [data-dusk="vue-component"]\');'. + 'var el = document.querySelector(\'body [dusk="vue-component"]\');'. "if (typeof el.__vue__ !== 'undefined')". ' return el.__vue__.name;'. 'try {'.