From c0974288a8450f5265d9ff77f5989afac97744f3 Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Wed, 8 Jan 2025 04:02:34 +0000 Subject: [PATCH 1/2] Add missing Columns Non Computed Test --- .../Component/HandlesComputedProperties.php | 13 +++--- tests/Unit/Traits/WithColumnsTest.php | 44 +++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 tests/Unit/Traits/WithColumnsTest.php diff --git a/src/Traits/Core/Component/HandlesComputedProperties.php b/src/Traits/Core/Component/HandlesComputedProperties.php index d278ecae8..6e335c70b 100644 --- a/src/Traits/Core/Component/HandlesComputedProperties.php +++ b/src/Traits/Core/Component/HandlesComputedProperties.php @@ -6,18 +6,21 @@ trait HandlesComputedProperties { protected bool $useComputedProperties = true; - public function useComputedPropertiesEnabled(): self + protected function setComputedPropertiesStatus(bool $useComputedProperties): self { - $this->useComputedProperties = true; + $this->useComputedProperties = $useComputedProperties; return $this; } - public function useComputedPropertiesDisabled(): self + public function useComputedPropertiesEnabled(): self { - $this->useComputedProperties = false; + return $this->setComputedPropertiesStatus(true); + } - return $this; + public function useComputedPropertiesDisabled(): self + { + return $this->setComputedPropertiesStatus(false); } public function getComputedPropertiesStatus(): bool diff --git a/tests/Unit/Traits/WithColumnsTest.php b/tests/Unit/Traits/WithColumnsTest.php new file mode 100644 index 000000000..fb3cc171f --- /dev/null +++ b/tests/Unit/Traits/WithColumnsTest.php @@ -0,0 +1,44 @@ +useComputedPropertiesDisabled(); + + } + }; + + $view = view('livewire-tables::datatable'); + + $testTableDefault->boot(); + $testTableDefault->mountManagesFilters(); + $testTableDefault->bootedComponentUtilities(); + $testTableDefault->bootedManagesFilters(); + $testTableDefault->bootedWithColumns(); + $testTableDefault->bootedWithColumnSelect(); + $testTableDefault->bootedWithSecondaryHeader(); + $testTableDefault->booted(); + $testTableDefault->renderingWithColumns($view, $view->getData()); + $testTableDefault->renderingWithColumnSelect($view, $view->getData()); + $testTableDefault->renderingWithCustomisations($view, $view->getData()); + $testTableDefault->renderingWithData($view, $view->getData()); + $testTableDefault->renderingWithFooter($view, $view->getData()); + $testTableDefault->renderingWithReordering($view, $view->getData()); + $testTableDefault->renderingWithPagination($view, $view->getData()); + $testTableDefault->render(); + $this->assertSame(9, $view->getData()['columns']->count()); + } + +} \ No newline at end of file From 43b64f986b4ebfc32edb76d60034521252b359ed Mon Sep 17 00:00:00 2001 From: lrljoe Date: Wed, 8 Jan 2025 04:03:01 +0000 Subject: [PATCH 2/2] Fix styling --- tests/Unit/Traits/WithColumnsTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Unit/Traits/WithColumnsTest.php b/tests/Unit/Traits/WithColumnsTest.php index fb3cc171f..c258f92cf 100644 --- a/tests/Unit/Traits/WithColumnsTest.php +++ b/tests/Unit/Traits/WithColumnsTest.php @@ -40,5 +40,4 @@ public function configure(): void $testTableDefault->render(); $this->assertSame(9, $view->getData()['columns']->count()); } - -} \ No newline at end of file +}