Skip to content

Commit

Permalink
update vselect tests for new location of .vs__dropdown-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
13twelve committed Jan 7, 2025
1 parent 66eef00 commit 2a5f93c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/DuskServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,28 @@ public function boot(): void
Browser::macro('assertVselectHasOptions', function (string $wrapperClass, array $optionLabels) {
$this->with($wrapperClass, function (Browser $element) use ($optionLabels) {
$element->click('.vs__search');
$browser->waitFor('.vs__dropdown-menu');
$this->waitFor('.vs__dropdown-menu');

foreach ($optionLabels as $optionLabel) {
$browser->assertSeeIn('.vs__dropdown-menu', $optionLabel);
$this->assertSeeIn('.vs__dropdown-menu', $optionLabel);
}
});
});

Browser::macro('selectVselectOption', function (string $wrapperClass, string $optionLabel) {
$this->with($wrapperClass, function (Browser $element) use ($optionLabel, $wrapperClass) {
$element->click('.vs__search');
$browser->waitFor('.vs__dropdown-menu');
$this->waitFor('.vs__dropdown-menu');

$browser->clickAtXPath('//li[contains(.,"' . $optionLabel . '")]');
$this->clickAtXPath('//.vs__dropdown-menu li[contains(.,"' . $optionLabel . '")]');

$this->assertVselectHasOptionSelected($wrapperClass, $optionLabel);
});
});

Browser::macro('assertVselectHasOptionSelected', function (string $wrapperClass, string $optionLabel) {
$this->with($wrapperClass, function (Browser $element) use ($optionLabel) {
$browser->assertSeeIn('.vs__selected-options', $optionLabel);
$element->assertSeeIn('.vs__selected-options', $optionLabel);
});
});

Expand Down

0 comments on commit 2a5f93c

Please sign in to comment.