diff --git a/src/Traits/Configuration/SearchConfiguration.php b/src/Traits/Configuration/SearchConfiguration.php index c746ef609..77590071f 100644 --- a/src/Traits/Configuration/SearchConfiguration.php +++ b/src/Traits/Configuration/SearchConfiguration.php @@ -156,7 +156,7 @@ public function setSearchPlaceholder(string $placeholder): self public function setSearchFieldAttributes(array $attributes = []): self { - $this->setCustomAttributes('searchFieldAttributes', $attributes); + $this->setCustomAttributes('searchFieldAttributes', array_merge(['default' => false, 'default-colors' => false, 'default-styling' => false], $attributes)); return $this; } diff --git a/src/Traits/Helpers/SearchHelpers.php b/src/Traits/Helpers/SearchHelpers.php index 4d4a540a4..059c17d32 100644 --- a/src/Traits/Helpers/SearchHelpers.php +++ b/src/Traits/Helpers/SearchHelpers.php @@ -137,7 +137,7 @@ public function hasSearchPlaceholder(): bool public function getSearchFieldAttributes(): array { - return $this->getCustomAttributes('searchFieldAttributes'); + return $this->getCustomAttributes('searchFieldAttributes', true); } public function shouldTrimSearchString(): bool diff --git a/tests/Traits/Configuration/SearchConfigurationTest.php b/tests/Traits/Configuration/SearchConfigurationTest.php index 0f0815faa..ad47d954b 100644 --- a/tests/Traits/Configuration/SearchConfigurationTest.php +++ b/tests/Traits/Configuration/SearchConfigurationTest.php @@ -180,7 +180,7 @@ public function test_can_set_search_placeholder(): void public function test_can_set_search_field_attributes(): void { - $this->assertSame(['default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getSearchFieldAttributes()); + $this->assertSame(['default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getSearchFieldAttributes()); $this->basicTable->setSearchFieldAttributes(['class' => 'bg-blue', 'style' => 'font-size: 3em;']);