diff --git a/src/Traits/Styling/Configuration/FilterMenuStylingConfiguration.php b/src/Traits/Styling/Configuration/FilterMenuStylingConfiguration.php index 0c6f9b76e..4a68532d5 100644 --- a/src/Traits/Styling/Configuration/FilterMenuStylingConfiguration.php +++ b/src/Traits/Styling/Configuration/FilterMenuStylingConfiguration.php @@ -26,7 +26,6 @@ public function setFilterSlidedownWrapperAttributes(array $filterSlidedownWrappe return $this; } - /** * Set a list of attributes to override on the th sort button elements */ diff --git a/src/Traits/Styling/HasFilterMenuStyling.php b/src/Traits/Styling/HasFilterMenuStyling.php index d13aaac28..03a6737b4 100644 --- a/src/Traits/Styling/HasFilterMenuStyling.php +++ b/src/Traits/Styling/HasFilterMenuStyling.php @@ -22,5 +22,4 @@ trait HasFilterMenuStyling protected array $filterSlidedownWrapperAttributes = ['class' => '', 'default-colors' => true, 'default-styling' => true]; protected ?\Closure $filterSlidedownRowCallback; - } diff --git a/src/Traits/Styling/Helpers/FilterMenuStylingHelpers.php b/src/Traits/Styling/Helpers/FilterMenuStylingHelpers.php index 3ee896f2d..9833809d6 100644 --- a/src/Traits/Styling/Helpers/FilterMenuStylingHelpers.php +++ b/src/Traits/Styling/Helpers/FilterMenuStylingHelpers.php @@ -42,14 +42,12 @@ public function getFilterSlidedownRowAttributes(string $rowIndex): array { if (isset($this->filterSlidedownRowCallback)) { - return array_merge( ['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => (int) $rowIndex], call_user_func($this->filterSlidedownRowCallback, (int) $rowIndex)); + return array_merge(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => (int) $rowIndex], call_user_func($this->filterSlidedownRowCallback, (int) $rowIndex)); } - return ['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => (int) $rowIndex]; + return ['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => (int) $rowIndex]; } - - public function getFilterSlideDownDefaultStatus(): bool { return $this->filterSlideDownDefaultVisible; diff --git a/tests/Unit/Traits/Styling/FilterSlidedownStylingTest.php b/tests/Unit/Traits/Styling/FilterSlidedownStylingTest.php index 1fb2acaa3..5ba1ac182 100644 --- a/tests/Unit/Traits/Styling/FilterSlidedownStylingTest.php +++ b/tests/Unit/Traits/Styling/FilterSlidedownStylingTest.php @@ -6,7 +6,6 @@ final class FilterSlidedownStylingTest extends TestCase { - public function test_filter_slidedown_wrapper_attributes_returns_default_if_not_set(): void { $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getFilterSlidedownWrapperAttributes()); @@ -18,10 +17,10 @@ public function test_filter_slidedown_wrapper_attributes_can_be_changed(): void $this->basicTable->setFilterSlidedownWrapperAttributes([ 'class' => 'text-blue-500', 'default-colors' => true, - 'default-styling' => true, + 'default-styling' => true, 'x-transition:enter' => 'transition ease-out duration-1000', ]); - + $this->assertSame(['class' => 'text-blue-500', 'default-colors' => true, 'default-styling' => true, 'x-transition:enter' => 'transition ease-out duration-1000'], $this->basicTable->getFilterSlidedownWrapperAttributes()); $this->basicTable->setFilterSlidedownWrapperAttributes([ @@ -32,38 +31,37 @@ public function test_filter_slidedown_wrapper_attributes_can_be_changed(): void } - public function test_filter_slidedown_row_attributes_returns_default_if_not_set(): void { $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes(1)); $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes(2)); - $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes("1")); - $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes("2")); + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes('1')); + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes('2')); } public function test_filter_slidedown_row_attributes_can_be_changed(): void { $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes(1)); - $this->basicTable->setFilterSlidedownRowAttributes(fn($rowIndex) => $rowIndex % 2 === 0 ? + $this->basicTable->setFilterSlidedownRowAttributes(fn ($rowIndex) => $rowIndex % 2 === 0 ? [ 'class' => 'bg-red-500', 'default-colors' => true, - 'default-styling' => true, - ] : [ + 'default-styling' => true, + ] : [ 'class' => 'bg-blue-500', 'default-colors' => true, - 'default-styling' => true, - ] + 'default-styling' => true, + ] ); $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes(0)); $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes(1)); $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes(2)); $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes(3)); - $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes("0")); - $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes("1")); - $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes("2")); - $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes("3")); + $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes('0')); + $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes('1')); + $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes('2')); + $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes('3')); } @@ -72,23 +70,23 @@ public function test_filter_slidedown_row_attributes_can_be_changed_and_sets_def $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes(0)); $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes(1)); - $this->basicTable->setFilterSlidedownRowAttributes(fn($rowIndex) => $rowIndex % 2 === 0 ? + $this->basicTable->setFilterSlidedownRowAttributes(fn ($rowIndex) => $rowIndex % 2 === 0 ? [ 'class' => 'bg-red-500', 'default-colors' => false, - ] : [ + ] : [ 'class' => 'bg-blue-500', - 'default-styling' => false, - ] + 'default-styling' => false, + ] ); $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes(0)); $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes(1)); $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes(2)); $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes(3)); - $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes("0")); - $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes("1")); - $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes("2")); - $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes("3")); + $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 0], $this->basicTable->getFilterSlidedownRowAttributes('0')); + $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 1], $this->basicTable->getFilterSlidedownRowAttributes('1')); + $this->assertSame(['class' => 'bg-red-500', 'default-colors' => false, 'default-styling' => true, 'row' => 2], $this->basicTable->getFilterSlidedownRowAttributes('2')); + $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => false, 'row' => 3], $this->basicTable->getFilterSlidedownRowAttributes('3')); } -} \ No newline at end of file +}