billmn
billmn
FFilament
Created by billmn on 10/27/2023 in #❓┊help
Action in Placeholder hintAction doesn't fire
I have added an action to a form Placeholder component using hintAction method but, when I click on the action nothing happen. The same action used in a TextInput works fine. This is an example:
Placeholder::make('somePlaceholder')
->content('Bla bla bla')
->hintAction(
Action::make('copyText')
->icon('heroicon-m-clipboard')
->requiresConfirmation()
->action(fn () => dd('test'))
),
Placeholder::make('somePlaceholder')
->content('Bla bla bla')
->hintAction(
Action::make('copyText')
->icon('heroicon-m-clipboard')
->requiresConfirmation()
->action(fn () => dd('test'))
),
could it be a bug?
2 replies
FFilament
Created by billmn on 3/28/2023 in #❓┊help
Testing field action
I have a relation manager that contains a field with a suffixAction. How can I call this field's action in tests?
3 replies
FFilament
Created by billmn on 3/10/2023 in #❓┊help
Testing relation manager form field visibility
How can I test form field visibility in a relation manager modal? e.g. I would assert that "email" field is visible using ViewAction. I have tried this:
livewire(InvitationsRelationManager::class, ['ownerRecord' => $model])
->mountTableAction(ViewAction::class, $invitation)
->assertFormFieldIsVisible('email')
->callMountedTableAction();
livewire(InvitationsRelationManager::class, ['ownerRecord' => $model])
->mountTableAction(ViewAction::class, $invitation)
->assertFormFieldIsVisible('email')
->callMountedTableAction();
But I get this error:
Failed asserting that a field with the name [email] exists on the form with the name [form] on the [App\Filament\Resources\LodgerResource\RelationManagers\InvitationsRelationManager] component.
Failed asserting that null is an instance of class "Filament\Forms\Components\Field".
Failed asserting that a field with the name [email] exists on the form with the name [form] on the [App\Filament\Resources\LodgerResource\RelationManagers\InvitationsRelationManager] component.
Failed asserting that null is an instance of class "Filament\Forms\Components\Field".
This is an excerpt of the relation manager component:
class InvitationManager extends RelationManager
{
protected static string $relationship = 'invitations';

protected static ?string $recordTitleAttribute = 'email';

// ...

public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('email')
->translateLabel()
->email()
->required()
->dehydrateStateUsing(fn ($state) => mb_strtolower($state)),

// ..
]);
}

// ...
}
class InvitationManager extends RelationManager
{
protected static string $relationship = 'invitations';

protected static ?string $recordTitleAttribute = 'email';

// ...

public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('email')
->translateLabel()
->email()
->required()
->dehydrateStateUsing(fn ($state) => mb_strtolower($state)),

// ..
]);
}

// ...
}
Thoughts?
2 replies