From f1a65411e04a94d66cc3043f811f1a6be7074a7b Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 24 Dec 2024 03:18:56 +0000 Subject: [PATCH 1/8] Initial Commit --- src/Traits/HasAllTraits.php | 2 + .../Styling/HasDefaultFilterInputStyling.php | 76 +++++++++++++++++++ .../Styling/FilterInputDefaultStylingTest.php | 41 ++++++++++ 3 files changed, 119 insertions(+) create mode 100644 src/Traits/Styling/HasDefaultFilterInputStyling.php create mode 100644 tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php diff --git a/src/Traits/HasAllTraits.php b/src/Traits/HasAllTraits.php index ebbe7a815..c2c5c6970 100644 --- a/src/Traits/HasAllTraits.php +++ b/src/Traits/HasAllTraits.php @@ -4,6 +4,7 @@ use Rappasoft\LaravelLivewireTables\Traits\Core\{HasCustomAttributes, HasLocalisations}; use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasTheme; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasDefaultFilterInputStyling; trait HasAllTraits { @@ -13,6 +14,7 @@ trait HasAllTraits use WithLoadingPlaceholder; use HasTheme; use ComponentUtilities, + HasDefaultFilterInputStyling, WithActions, WithData, WithQueryString, diff --git a/src/Traits/Styling/HasDefaultFilterInputStyling.php b/src/Traits/Styling/HasDefaultFilterInputStyling.php new file mode 100644 index 000000000..52b135408 --- /dev/null +++ b/src/Traits/Styling/HasDefaultFilterInputStyling.php @@ -0,0 +1,76 @@ +defaultFilterInputColors = $defaultFilterInputColors; + + return $this; + } + + protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self + { + $this->defaultFilterInputStyling = $defaultFilterInputStyling; + + return $this; + } + + public function hasDefaultFilterInputColors(): bool + { + return isset($this->defaultFilterInputColors); + } + + #[Computed] + public function getDefaultFilterInputColors(): string + { + if (isset($this->defaultFilterInputColors)) + { + return $this->defaultFilterInputColors; + } + else + { + if ($this->isTailwind()) + { + return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; + } + else + { + return ''; + } + } + } + + public function hasDefaultFilterInputStyling(): bool + { + return isset($this->defaultFilterInputStyling); + } + + #[Computed] + public function getDefaultFilterInputStyling(): string + { + if (isset($this->defaultFilterInputStyling)) + { + return $this->defaultFilterInputStyling; + } + else + { + if ($this->isTailwind()) + { + return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; + } + else + { + return 'form-control'; + } + } + } + +} \ No newline at end of file diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php new file mode 100644 index 000000000..5a60c9b04 --- /dev/null +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -0,0 +1,41 @@ +assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + } + + public function test_has_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + } + + public function test_can_set_filter_default_input_styling(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + + $this->basicTable->setDefaultFilterInputStyling('p-4'); + + $this->assertTrue($this->basicTable->hasDefaultFilterInputStyling()); + } + + public function test_can_set_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + + $this->basicTable->setDefaultFilterInputColors('bg-blue-500'); + + $this->assertTrue($this->basicTable->hasDefaultFilterInputColors()); + } + +} \ No newline at end of file From dde327e6419cdde8edf3b712991b17546c1fa813 Mon Sep 17 00:00:00 2001 From: lrljoe Date: Tue, 24 Dec 2024 03:19:25 +0000 Subject: [PATCH 2/8] Fix styling --- src/Traits/HasAllTraits.php | 2 +- .../Styling/HasDefaultFilterInputStyling.php | 140 ++++++++---------- .../Styling/FilterInputDefaultStylingTest.php | 80 +++++----- 3 files changed, 104 insertions(+), 118 deletions(-) diff --git a/src/Traits/HasAllTraits.php b/src/Traits/HasAllTraits.php index c2c5c6970..97ed8b513 100644 --- a/src/Traits/HasAllTraits.php +++ b/src/Traits/HasAllTraits.php @@ -3,8 +3,8 @@ namespace Rappasoft\LaravelLivewireTables\Traits; use Rappasoft\LaravelLivewireTables\Traits\Core\{HasCustomAttributes, HasLocalisations}; -use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasTheme; use Rappasoft\LaravelLivewireTables\Traits\Styling\HasDefaultFilterInputStyling; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasTheme; trait HasAllTraits { diff --git a/src/Traits/Styling/HasDefaultFilterInputStyling.php b/src/Traits/Styling/HasDefaultFilterInputStyling.php index 52b135408..ee0ecf639 100644 --- a/src/Traits/Styling/HasDefaultFilterInputStyling.php +++ b/src/Traits/Styling/HasDefaultFilterInputStyling.php @@ -1,76 +1,64 @@ -defaultFilterInputColors = $defaultFilterInputColors; - - return $this; - } - - protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self - { - $this->defaultFilterInputStyling = $defaultFilterInputStyling; - - return $this; - } - - public function hasDefaultFilterInputColors(): bool - { - return isset($this->defaultFilterInputColors); - } - - #[Computed] - public function getDefaultFilterInputColors(): string - { - if (isset($this->defaultFilterInputColors)) - { - return $this->defaultFilterInputColors; - } - else - { - if ($this->isTailwind()) - { - return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; - } - else - { - return ''; - } - } - } - - public function hasDefaultFilterInputStyling(): bool - { - return isset($this->defaultFilterInputStyling); - } - - #[Computed] - public function getDefaultFilterInputStyling(): string - { - if (isset($this->defaultFilterInputStyling)) - { - return $this->defaultFilterInputStyling; - } - else - { - if ($this->isTailwind()) - { - return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; - } - else - { - return 'form-control'; - } - } - } - -} \ No newline at end of file +defaultFilterInputColors = $defaultFilterInputColors; + + return $this; + } + + protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self + { + $this->defaultFilterInputStyling = $defaultFilterInputStyling; + + return $this; + } + + public function hasDefaultFilterInputColors(): bool + { + return isset($this->defaultFilterInputColors); + } + + #[Computed] + public function getDefaultFilterInputColors(): string + { + if (isset($this->defaultFilterInputColors)) { + return $this->defaultFilterInputColors; + } else { + if ($this->isTailwind()) { + return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; + } else { + return ''; + } + } + } + + public function hasDefaultFilterInputStyling(): bool + { + return isset($this->defaultFilterInputStyling); + } + + #[Computed] + public function getDefaultFilterInputStyling(): string + { + if (isset($this->defaultFilterInputStyling)) { + return $this->defaultFilterInputStyling; + } else { + if ($this->isTailwind()) { + return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; + } else { + return 'form-control'; + } + } + } +} diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php index 5a60c9b04..dd5b5f0b4 100644 --- a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -1,41 +1,39 @@ -assertFalse($this->basicTable->hasDefaultFilterInputStyling()); - } - - public function test_has_filter_default_input_colors(): void - { - $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); - } - - public function test_can_set_filter_default_input_styling(): void - { - $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); - - $this->basicTable->setDefaultFilterInputStyling('p-4'); - - $this->assertTrue($this->basicTable->hasDefaultFilterInputStyling()); - } - - public function test_can_set_filter_default_input_colors(): void - { - $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); - - $this->basicTable->setDefaultFilterInputColors('bg-blue-500'); - - $this->assertTrue($this->basicTable->hasDefaultFilterInputColors()); - } - -} \ No newline at end of file +assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + } + + public function test_has_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + } + + public function test_can_set_filter_default_input_styling(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + + $this->basicTable->setDefaultFilterInputStyling('p-4'); + + $this->assertTrue($this->basicTable->hasDefaultFilterInputStyling()); + } + + public function test_can_set_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + + $this->basicTable->setDefaultFilterInputColors('bg-blue-500'); + + $this->assertTrue($this->basicTable->hasDefaultFilterInputColors()); + } +} From 08eff50dc87ccd653ae00f7fca1fb33c7ad9bb1b Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 24 Dec 2024 03:28:30 +0000 Subject: [PATCH 3/8] Move to new Defaults directory, update docs --- docs/start/configuration.md | 2 + docs/start/recommended.md | 1 + src/Traits/HasAllTraits.php | 2 +- .../HasDefaultFilterInputStyling.php | 128 +++++++++--------- 4 files changed, 68 insertions(+), 65 deletions(-) rename src/Traits/Styling/{ => Defaults}/HasDefaultFilterInputStyling.php (93%) diff --git a/docs/start/configuration.md b/docs/start/configuration.md index 01725843f..919a508ea 100644 --- a/docs/start/configuration.md +++ b/docs/start/configuration.md @@ -48,6 +48,7 @@ module.exports = { purge: [ ... './vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php', + './vendor/rappasoft/laravel-livewire-tables/src/Traits/Styling/Defaults/**/*.php', ], ... }; @@ -57,6 +58,7 @@ module.exports = { content: [ ... './vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php', + './vendor/rappasoft/laravel-livewire-tables/src/Traits/Styling/Defaults/**/*.php', ], ... }; diff --git a/docs/start/recommended.md b/docs/start/recommended.md index e0b1ca3ff..5ca4a9909 100644 --- a/docs/start/recommended.md +++ b/docs/start/recommended.md @@ -68,6 +68,7 @@ If using Tailwind, you should update your tailwind.config.js file, adding the fo ```js './vendor/rappasoft/laravel-livewire-tables/resources/views/*.blade.php', './vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php', + './vendor/rappasoft/laravel-livewire-tables/src/Traits/Styling/Defaults/**/*.php', ``` It is also recommended to add the paths to any Livewire Tables components, for example: diff --git a/src/Traits/HasAllTraits.php b/src/Traits/HasAllTraits.php index 97ed8b513..0705aaccb 100644 --- a/src/Traits/HasAllTraits.php +++ b/src/Traits/HasAllTraits.php @@ -3,7 +3,7 @@ namespace Rappasoft\LaravelLivewireTables\Traits; use Rappasoft\LaravelLivewireTables\Traits\Core\{HasCustomAttributes, HasLocalisations}; -use Rappasoft\LaravelLivewireTables\Traits\Styling\HasDefaultFilterInputStyling; +use Rappasoft\LaravelLivewireTables\Traits\Styling\Defaults\{HasDefaultFilterInputStyling}; use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasTheme; trait HasAllTraits diff --git a/src/Traits/Styling/HasDefaultFilterInputStyling.php b/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php similarity index 93% rename from src/Traits/Styling/HasDefaultFilterInputStyling.php rename to src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php index ee0ecf639..bc544abe7 100644 --- a/src/Traits/Styling/HasDefaultFilterInputStyling.php +++ b/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php @@ -1,64 +1,64 @@ -defaultFilterInputColors = $defaultFilterInputColors; - - return $this; - } - - protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self - { - $this->defaultFilterInputStyling = $defaultFilterInputStyling; - - return $this; - } - - public function hasDefaultFilterInputColors(): bool - { - return isset($this->defaultFilterInputColors); - } - - #[Computed] - public function getDefaultFilterInputColors(): string - { - if (isset($this->defaultFilterInputColors)) { - return $this->defaultFilterInputColors; - } else { - if ($this->isTailwind()) { - return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; - } else { - return ''; - } - } - } - - public function hasDefaultFilterInputStyling(): bool - { - return isset($this->defaultFilterInputStyling); - } - - #[Computed] - public function getDefaultFilterInputStyling(): string - { - if (isset($this->defaultFilterInputStyling)) { - return $this->defaultFilterInputStyling; - } else { - if ($this->isTailwind()) { - return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; - } else { - return 'form-control'; - } - } - } -} +defaultFilterInputColors = $defaultFilterInputColors; + + return $this; + } + + protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self + { + $this->defaultFilterInputStyling = $defaultFilterInputStyling; + + return $this; + } + + public function hasDefaultFilterInputColors(): bool + { + return isset($this->defaultFilterInputColors); + } + + #[Computed] + public function getDefaultFilterInputColors(): string + { + if (isset($this->defaultFilterInputColors)) { + return $this->defaultFilterInputColors; + } else { + if ($this->isTailwind()) { + return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; + } else { + return ''; + } + } + } + + public function hasDefaultFilterInputStyling(): bool + { + return isset($this->defaultFilterInputStyling); + } + + #[Computed] + public function getDefaultFilterInputStyling(): string + { + if (isset($this->defaultFilterInputStyling)) { + return $this->defaultFilterInputStyling; + } else { + if ($this->isTailwind()) { + return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; + } else { + return 'form-control'; + } + } + } +} From aeef0d027940dd6d3f14c07bbbc81dd6746607e8 Mon Sep 17 00:00:00 2001 From: lrljoe Date: Tue, 24 Dec 2024 03:28:57 +0000 Subject: [PATCH 4/8] Fix styling --- .../Defaults/HasDefaultFilterInputStyling.php | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php b/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php index bc544abe7..47395e2f7 100644 --- a/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php +++ b/src/Traits/Styling/Defaults/HasDefaultFilterInputStyling.php @@ -1,64 +1,64 @@ -defaultFilterInputColors = $defaultFilterInputColors; - - return $this; - } - - protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self - { - $this->defaultFilterInputStyling = $defaultFilterInputStyling; - - return $this; - } - - public function hasDefaultFilterInputColors(): bool - { - return isset($this->defaultFilterInputColors); - } - - #[Computed] - public function getDefaultFilterInputColors(): string - { - if (isset($this->defaultFilterInputColors)) { - return $this->defaultFilterInputColors; - } else { - if ($this->isTailwind()) { - return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; - } else { - return ''; - } - } - } - - public function hasDefaultFilterInputStyling(): bool - { - return isset($this->defaultFilterInputStyling); - } - - #[Computed] - public function getDefaultFilterInputStyling(): string - { - if (isset($this->defaultFilterInputStyling)) { - return $this->defaultFilterInputStyling; - } else { - if ($this->isTailwind()) { - return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; - } else { - return 'form-control'; - } - } - } -} +defaultFilterInputColors = $defaultFilterInputColors; + + return $this; + } + + protected function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self + { + $this->defaultFilterInputStyling = $defaultFilterInputStyling; + + return $this; + } + + public function hasDefaultFilterInputColors(): bool + { + return isset($this->defaultFilterInputColors); + } + + #[Computed] + public function getDefaultFilterInputColors(): string + { + if (isset($this->defaultFilterInputColors)) { + return $this->defaultFilterInputColors; + } else { + if ($this->isTailwind()) { + return 'border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600'; + } else { + return ''; + } + } + } + + public function hasDefaultFilterInputStyling(): bool + { + return isset($this->defaultFilterInputStyling); + } + + #[Computed] + public function getDefaultFilterInputStyling(): string + { + if (isset($this->defaultFilterInputStyling)) { + return $this->defaultFilterInputStyling; + } else { + if ($this->isTailwind()) { + return 'block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50'; + } else { + return 'form-control'; + } + } + } +} From e04777d9abeec7b97c72cf73655f18b0d9332854 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 24 Dec 2024 03:40:31 +0000 Subject: [PATCH 5/8] Add Get Defaults --- .../Styling/FilterInputDefaultStylingTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php index dd5b5f0b4..4d31d1e1b 100644 --- a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -14,9 +14,11 @@ public function test_has_filter_default_input_styling(): void $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); } - public function test_has_filter_default_input_colors(): void + public function test_can_get_filter_default_input_styling(): void { - $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + + $this->assertSame('block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50', $this->getDefaultFilterInputStyling()); } public function test_can_set_filter_default_input_styling(): void @@ -28,6 +30,11 @@ public function test_can_set_filter_default_input_styling(): void $this->assertTrue($this->basicTable->hasDefaultFilterInputStyling()); } + public function test_has_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + } + public function test_can_set_filter_default_input_colors(): void { $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); @@ -36,4 +43,12 @@ public function test_can_set_filter_default_input_colors(): void $this->assertTrue($this->basicTable->hasDefaultFilterInputColors()); } + + public function test_can_get_filter_default_input_colors(): void + { + $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); + + $this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->getDefaultFilterInputColors()); + } + } From aaf76158a8178425525a5100fab6f2158b82f0c6 Mon Sep 17 00:00:00 2001 From: lrljoe Date: Tue, 24 Dec 2024 03:40:55 +0000 Subject: [PATCH 6/8] Fix styling --- tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php index 4d31d1e1b..50b391525 100644 --- a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -50,5 +50,4 @@ public function test_can_get_filter_default_input_colors(): void $this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->getDefaultFilterInputColors()); } - } From 0fb5a1c776bb7d84cef69e834c92c62b281fe698 Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Tue, 24 Dec 2024 03:57:17 +0000 Subject: [PATCH 7/8] Adjust Tests --- .../Styling/FilterInputDefaultStylingTest.php | 79 +++++++++++++++++-- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php index 50b391525..75d6f70b6 100644 --- a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -4,6 +4,7 @@ use PHPUnit\Framework\Attributes\Group; use Rappasoft\LaravelLivewireTables\Tests\TestCase; +use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; #[Group('Filters')] #[Group('Styling')] @@ -18,16 +19,47 @@ public function test_can_get_filter_default_input_styling(): void { $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); - $this->assertSame('block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50', $this->getDefaultFilterInputStyling()); + $this->assertSame('block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50', $this->basicTable->getDefaultFilterInputStyling()); } public function test_can_set_filter_default_input_styling(): void { - $this->assertFalse($this->basicTable->hasDefaultFilterInputStyling()); + $testTableDefault = new class extends PetsTable + { + public function configure(): void + { + parent::configure(); + + } + + public function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self + { + parent::setDefaultFilterInputStyling($defaultFilterInputStyling); + + return $this; + } + + + + }; + + $testTableDefault->configure(); + $testTableDefault->boot(); + $testTableDefault->bootedComponentUtilities(); + $testTableDefault->bootedWithData(); + $testTableDefault->bootedWithColumns(); + $testTableDefault->bootedWithColumnSelect(); + $testTableDefault->bootedWithSecondaryHeader(); + $testTableDefault->booted(); + + $this->assertFalse($testTableDefault->hasDefaultFilterInputStyling()); + + $testTableDefault->setDefaultFilterInputStyling('p-4'); + + $this->assertTrue($testTableDefault->hasDefaultFilterInputStyling()); - $this->basicTable->setDefaultFilterInputStyling('p-4'); + $this->assertSame('p-4', $testTableDefault->getDefaultFilterInputStyling()); - $this->assertTrue($this->basicTable->hasDefaultFilterInputStyling()); } public function test_has_filter_default_input_colors(): void @@ -37,17 +69,48 @@ public function test_has_filter_default_input_colors(): void public function test_can_set_filter_default_input_colors(): void { - $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); - $this->basicTable->setDefaultFilterInputColors('bg-blue-500'); + $testTableDefault = new class extends PetsTable + { + public function configure(): void + { + parent::configure(); + + } + + + public function setDefaultFilterInputColors(string $defaultFilterInputColors): self + { + parent::setDefaultFilterInputColors($defaultFilterInputColors); + + return $this; + } + + + }; + + $testTableDefault->configure(); + $testTableDefault->boot(); + $testTableDefault->bootedComponentUtilities(); + $testTableDefault->bootedWithData(); + $testTableDefault->bootedWithColumns(); + $testTableDefault->bootedWithColumnSelect(); + $testTableDefault->bootedWithSecondaryHeader(); + $testTableDefault->booted(); + $this->assertFalse($testTableDefault->hasDefaultFilterInputColors()); + + $testTableDefault->setDefaultFilterInputColors('bg-blue-500'); + + $this->assertTrue($testTableDefault->hasDefaultFilterInputColors()); + + $this->assertSame('bg-blue-500', $testTableDefault->getDefaultFilterInputColors()); - $this->assertTrue($this->basicTable->hasDefaultFilterInputColors()); } public function test_can_get_filter_default_input_colors(): void { $this->assertFalse($this->basicTable->hasDefaultFilterInputColors()); - $this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->getDefaultFilterInputColors()); + $this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->basicTable->getDefaultFilterInputColors()); } } From 5f78054479727a6b899a689d385814e37f04ffac Mon Sep 17 00:00:00 2001 From: lrljoe Date: Tue, 24 Dec 2024 03:57:45 +0000 Subject: [PATCH 8/8] Fix styling --- .../Unit/Traits/Styling/FilterInputDefaultStylingTest.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php index 75d6f70b6..a61f62b1c 100644 --- a/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php @@ -3,8 +3,8 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Unit\Traits\Styling; use PHPUnit\Framework\Attributes\Group; -use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; +use Rappasoft\LaravelLivewireTables\Tests\TestCase; #[Group('Filters')] #[Group('Styling')] @@ -38,9 +38,6 @@ public function setDefaultFilterInputStyling(string $defaultFilterInputStyling): return $this; } - - - }; $testTableDefault->configure(); @@ -78,15 +75,12 @@ public function configure(): void } - public function setDefaultFilterInputColors(string $defaultFilterInputColors): self { parent::setDefaultFilterInputColors($defaultFilterInputColors); return $this; } - - }; $testTableDefault->configure();