Skip to content

Commit

Permalink
Add autofocus in AbstractSelect::class Widget. (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Nov 8, 2023
1 parent 95ba79b commit 852207d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Base/AbstractSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
abstract class AbstractSelect extends Element
{
use Attribute\Aria\HasAriaLabel;
use Attribute\CanBeAutofocus;
use Attribute\Custom\HasAttributes;
use Attribute\Custom\HasLabel;
use Attribute\Custom\HasPrefixAndSuffix;
Expand Down
13 changes: 13 additions & 0 deletions tests/Select/RenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ public function testAriaLabel(): void
);
}

public function testAutofocus(): void
{
Assert::equalsWithoutLE(
<<<HTML
<select autofocus>
<option>Select an option</option>
<option value="1">Moscu</option>
</select>
HTML,
Select::widget()->items([1 => 'Moscu'])->autofocus()->render(),
);
}

public function testElement(): void
{
Assert::equalsWithoutLE(
Expand Down

0 comments on commit 852207d

Please sign in to comment.