How to test that field hidden in infolist?
Test:
Resource:
Error:
it('not shows empty description', function () {
$project = Project::factory()->create(['description' => null]);
livewire(ViewProject::class, [
'record' => $project->getRouteKey(),
])
->assertFormFieldIsHidden('description');
});it('not shows empty description', function () {
$project = Project::factory()->create(['description' => null]);
livewire(ViewProject::class, [
'record' => $project->getRouteKey(),
])
->assertFormFieldIsHidden('description');
});Resource:
public static function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Infolists\Components\Section::make()->schema([
Infolists\Components\TextEntry::make('name'),
Infolists\Components\TextEntry::make('description')
->label(false)
->hidden(fn($record) => !$record->description)
->markdown()
->columnSpanFull(),
])
]);
}public static function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Infolists\Components\Section::make()->schema([
Infolists\Components\TextEntry::make('name'),
Infolists\Components\TextEntry::make('description')
->label(false)
->hidden(fn($record) => !$record->description)
->markdown()
->columnSpanFull(),
])
]);
}Error:
Failed asserting that a field with the name [description] is hidden on the form named [form] on the [App\Filament\Resources\ProjectResource\Pages\ViewProject] component.Failed asserting that a field with the name [description] is hidden on the form named [form] on the [App\Filament\Resources\ProjectResource\Pages\ViewProject] component.