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

Revert "feat: add alternative tag for element selection" #1013

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/ElementResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ElementResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/MakesAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {'.
Expand Down