-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
I wrote a simple method for App\Tests\Support\Helper\Acceptance
to check if an HTML element has a certain CSS class. Does the same as JavaScript .classList.contains()
:
public function seeElementHasClass(array|string $element, string $class): void
{
$I = $this->getModule('WebDriver');
$classesString = $I->grabAttributeFrom($element, 'class');
$classesArray = explode(' ', $classesString);
$this->assertContains($class, $classesArray);
}
public function dontSeeElementHasClass(array|string $element, string $class): void
{
$I = $this->getModule('WebDriver');
$classesString = $I->grabAttributeFrom($element, 'class');
$classesArray = explode(' ', $classesString);
$this->assertNotContains($class, $classesArray);
}
Maybe somebody could add it to the module? :-)
Metadata
Metadata
Assignees
Labels
No labels