Skip to content

Commit 493959c

Browse files
authored
Merge pull request #2130 from LowerRockLabs/AddIsSortableTestTweak
Add Missing Test for getCustomSortingPillDirectionsLabel with invalid direction
2 parents b2ddbb7 + 1f889cb commit 493959c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Unit/Views/ColumnTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,26 @@ public function test_cannot_collapse_on_tablet_and_mobile(): void
114114

115115
$contents = $column->renderContents($rows->first());
116116
}
117+
118+
public function test_custom_sorting_pills_defaults_correctly(): void
119+
{
120+
$column = Column::make('Name', 'name');
121+
$defaultString = __($this->basicTable->getLocalisationPath().'not_applicable');
122+
123+
$this->assertSame('A-Z', $column->getCustomSortingPillDirections('asc'));
124+
$this->assertSame('Z-A', $column->getCustomSortingPillDirections('desc'));
125+
$this->assertSame($defaultString, $column->getCustomSortingPillDirections('faulty_string'));
126+
127+
}
128+
129+
public function test_custom_sorting_pills_label_defaults_correctly(): void
130+
{
131+
$column = Column::make('Name', 'name');
132+
$defaultString = __($this->basicTable->getLocalisationPath().'not_applicable');
133+
134+
$this->assertSame('A-Z', $column->getCustomSortingPillDirectionsLabel('asc'));
135+
$this->assertSame('Z-A', $column->getCustomSortingPillDirectionsLabel('desc'));
136+
$this->assertSame($defaultString, $column->getCustomSortingPillDirectionsLabel('faulty_string'));
137+
138+
}
117139
}

0 commit comments

Comments
 (0)