Skip to content

Commit

Permalink
Merge pull request #2130 from LowerRockLabs/AddIsSortableTestTweak
Browse files Browse the repository at this point in the history
Add Missing Test for getCustomSortingPillDirectionsLabel with invalid direction
  • Loading branch information
lrljoe authored Dec 16, 2024
2 parents b2ddbb7 + 1f889cb commit 493959c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Unit/Views/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,26 @@ 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');
$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'));

}
}

0 comments on commit 493959c

Please sign in to comment.