Table Column Action testing not working in Manage Page.
I'm getting the following error when I try to call a table column action in my ManageNewsPage.
Here is the test case:
Here are the table actions:
Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.
Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.
it('can set news to public with button', function () {
$news = News::factory()->create([
'status' => '下書き'
]);
expect($news->status)->toBe('下書き');
livewire(NewsResource\Pages\ManageNews::class)
->callTableColumnAction('set_public', $news)
->assertTableColumnStateSet('status', '公開中');
$news->refresh();
expect($news->status)->toBe('公開中');
});
it('can set news to public with button', function () {
$news = News::factory()->create([
'status' => '下書き'
]);
expect($news->status)->toBe('下書き');
livewire(NewsResource\Pages\ManageNews::class)
->callTableColumnAction('set_public', $news)
->assertTableColumnStateSet('status', '公開中');
$news->refresh();
expect($news->status)->toBe('公開中');
});
->actions([
Tables\Actions\EditAction::make()
->icon(null)
->label('編集')
->view('filament.actions.edit-modal-button'),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('set_public')
->label('公開')
->button()
->action(function ($record) {
$record->status = '公開中';
$record->save();
})
->view('filament.actions.public-only-status-button'),
]);
->actions([
Tables\Actions\EditAction::make()
->icon(null)
->label('編集')
->view('filament.actions.edit-modal-button'),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('set_public')
->label('公開')
->button()
->action(function ($record) {
$record->status = '公開中';
$record->save();
})
->view('filament.actions.public-only-status-button'),
]);
0 Replies