From 1817b9fb8054c98a0c6d8806373140f006e09a56 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Sun, 22 Sep 2024 07:29:25 +0100 Subject: [PATCH] Fix for Search Field Attribute Defaults (#1962) * Fix for Search Field Attribute Defaults * SearchFieldAttributes -> Defaults To False --- src/Traits/Configuration/SearchConfiguration.php | 2 +- src/Traits/Helpers/SearchHelpers.php | 2 +- tests/Traits/Configuration/SearchConfigurationTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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;']);