mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
WIP
This commit is contained in:
@@ -36,6 +36,7 @@ class Component extends ViewComponent
|
||||
protected function resolveDefaultClosureDependencyForEvaluationByName(string $parameterName): array
|
||||
{
|
||||
return match ($parameterName) {
|
||||
'livewire' => [$this->getLivewire()],
|
||||
'record' => [$this->getRecord()],
|
||||
'state' => [$this->getState()],
|
||||
default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName),
|
||||
|
||||
@@ -14,7 +14,9 @@ it('can inject the correct `$livewire` for infolists outside a panel', function
|
||||
->assertSee('First Entry Label')
|
||||
->assertSee('First Entry State')
|
||||
->assertSee('Second Entry Label')
|
||||
->assertSee('Second Entry State');
|
||||
->assertSee('Second Entry State')
|
||||
->assertSee('Third Entry Label')
|
||||
->assertSee('Third Entry State (dynamic)');
|
||||
});
|
||||
|
||||
class TestComponentWithInfolist extends Livewire
|
||||
@@ -51,6 +53,13 @@ class TestComponentWithInfolist extends Livewire
|
||||
return [
|
||||
Infolists\Components\TextEntry::make('second_entry')
|
||||
->label('Second Entry Label'),
|
||||
Infolists\Components\TextEntry::make('third_entry')
|
||||
->label('Third Entry Label')
|
||||
->getStateUsing(function (TestComponentWithInfolist $livewire) {
|
||||
expect($livewire)->toBe($this);
|
||||
|
||||
return 'Third Entry State (dynamic)';
|
||||
}),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user