F
Filament2mo ago
bwubs

Test extra item actions of repeater

How do I test an item action of a Repeater? I'm currently upgrading from v3 => v4 and this test assertions is failing, complaining that it can't find the action. Previsouly I was able to apply the form the action was part of. But it seems this is no longer possible?
Livewire::test(PhonebookForm::class, ['groupId' => $group->getKey()])
->assertFormFieldIsEnabled('phonebook')
// This now fails
->assertActionExists(actions: 'delete-item')
->assertActionExists(actions: 'delete-item', arguments: ['item' => "record-{$entry1->getKey()}"])
->assertActionDisabled(actions: 'delete-item', arguments: ['item' => "record-{$entry2->getKey()}"]);
Livewire::test(PhonebookForm::class, ['groupId' => $group->getKey()])
->assertFormFieldIsEnabled('phonebook')
// This now fails
->assertActionExists(actions: 'delete-item')
->assertActionExists(actions: 'delete-item', arguments: ['item' => "record-{$entry1->getKey()}"])
->assertActionDisabled(actions: 'delete-item', arguments: ['item' => "record-{$entry2->getKey()}"]);
Solution:
Found it myself! assertFormComponentActionExists , assertFormComponentActionEnabled and assertFormComponentActionDisabled
Jump to solution
2 Replies
bwubs
bwubsOP2mo ago
Is there no way to do this?
Solution
bwubs
bwubs2mo ago
Found it myself! assertFormComponentActionExists , assertFormComponentActionEnabled and assertFormComponentActionDisabled

Did you find this page helpful?