From 01b6824d43140ca1e5f889871ea6ae8497d55714 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Mon, 16 Dec 2024 03:03:36 +0000 Subject: [PATCH 1/4] Add Tests --- tests/Unit/Views/ColumnTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Unit/Views/ColumnTest.php b/tests/Unit/Views/ColumnTest.php index c15b58374..ac723f5af 100644 --- a/tests/Unit/Views/ColumnTest.php +++ b/tests/Unit/Views/ColumnTest.php @@ -114,4 +114,10 @@ public function test_cannot_collapse_on_tablet_and_mobile(): void $contents = $column->renderContents($rows->first()); } + + public function test_custom_sorting_pills_label_defaults_correctly(): void + { + $column = Column::make('Name', 'name'); + $this->assertSame('Name', $column->getTitle()); + } } From d235860d59593ed8fb1c1b6d90f5e020451e06e6 Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Mon, 16 Dec 2024 03:09:45 +0000 Subject: [PATCH 2/4] Add Missing Test --- tests/Unit/Views/ColumnTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Views/ColumnTest.php b/tests/Unit/Views/ColumnTest.php index ac723f5af..544a3b273 100644 --- a/tests/Unit/Views/ColumnTest.php +++ b/tests/Unit/Views/ColumnTest.php @@ -118,6 +118,11 @@ public function test_cannot_collapse_on_tablet_and_mobile(): void public function test_custom_sorting_pills_label_defaults_correctly(): void { $column = Column::make('Name', 'name'); - $this->assertSame('Name', $column->getTitle()); + $defaultString = __($this->basicTable->getLocalisationPath().'not_applicable'); + + $this->assertSame('A-Z', $column->getCustomSortingPillDirectionsLabel('asc')); + $this->assertSame('Z-A', $column->getCustomSortingPillDirectionsLabel('desc')); + $this->assertSame($defaultString, $column->getCustomSortingPillDirectionsLabel('faulty_string')); + } } From 1e5d809f7dfed3cd0b062a648907c52d0462efea Mon Sep 17 00:00:00 2001 From: LRLJoe Date: Mon, 16 Dec 2024 03:15:02 +0000 Subject: [PATCH 3/4] Add label fixes --- tests/Unit/Views/ColumnTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Unit/Views/ColumnTest.php b/tests/Unit/Views/ColumnTest.php index 544a3b273..875b0f5c9 100644 --- a/tests/Unit/Views/ColumnTest.php +++ b/tests/Unit/Views/ColumnTest.php @@ -115,6 +115,18 @@ public function test_cannot_collapse_on_tablet_and_mobile(): void $contents = $column->renderContents($rows->first()); } + public function test_custom_sorting_pills_defaults_correctly(): void + { + $column = Column::make('Name', 'name'); + $defaultString = __($this->basicTable->getLocalisationPath().'not_applicable'); + + $this->assertSame('A-Z', $column->getCustomSortingPillDirections('asc')); + $this->assertSame('Z-A', $column->getCustomSortingPillDirections('desc')); + $this->assertSame($defaultString, $column->getCustomSortingPillDirections('faulty_string')); + + } + + public function test_custom_sorting_pills_label_defaults_correctly(): void { $column = Column::make('Name', 'name'); From 1f889cbba2720ba99fd5691806080bf0bbfb89e9 Mon Sep 17 00:00:00 2001 From: lrljoe Date: Mon, 16 Dec 2024 03:15:27 +0000 Subject: [PATCH 4/4] Fix styling --- tests/Unit/Views/ColumnTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Unit/Views/ColumnTest.php b/tests/Unit/Views/ColumnTest.php index 875b0f5c9..3c9ff0d71 100644 --- a/tests/Unit/Views/ColumnTest.php +++ b/tests/Unit/Views/ColumnTest.php @@ -126,7 +126,6 @@ public function test_custom_sorting_pills_defaults_correctly(): void } - public function test_custom_sorting_pills_label_defaults_correctly(): void { $column = Column::make('Name', 'name');