F
Filament3mo ago
Exi

"reorderRecords" action not found when testing a reorderable table

Filament v4 (Beta 15) My CategoriesResource table has reordering enabled:
Table::make()
->reorderable('sort_order');
Table::make()
->reorderable('sort_order');
In my test I try to assert the reorder action exists / trigger it:
livewire(ListCategories::class)
->assertCanSeeTableRecords($categories)
->callAction('reorderRecords'); // also tried TestAction::make('reorderRecords')->table()
livewire(ListCategories::class)
->assertCanSeeTableRecords($categories)
->callAction('reorderRecords'); // also tried TestAction::make('reorderRecords')->table()
but I get:
Action [reorderRecords] not found on table.
Action [reorderRecords] not found on table.
What’s the correct way to test (or at least assert the presence of) the reorder action produced by reorderable()?
Solution:
```php livewire(ListCategories::class) ->tap(function (Testable $testable): void { /** @var ListCategories $livewire */ $livewire = $testable->instance();...
Jump to solution
2 Replies
Exi
ExiOP3mo ago
GitHub
filament/packages/tables/src/Table/Concerns/CanReorderRecords.php a...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Solution
Exi
Exi3mo ago
livewire(ListCategories::class)
->tap(function (Testable $testable): void {
/** @var ListCategories $livewire */
$livewire = $testable->instance();

$table = $livewire->getTable();

expect($table)
->isReorderAuthorized()->toBeTrue();
});
livewire(ListCategories::class)
->tap(function (Testable $testable): void {
/** @var ListCategories $livewire */
$livewire = $testable->instance();

$table = $livewire->getTable();

expect($table)
->isReorderAuthorized()->toBeTrue();
});
works for me

Did you find this page helpful?