-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Package
filament/filament
Package Version
v4.0.17
Laravel Version
v12.30.0
Livewire Version
v3.6.4
PHP Version
PHP 8.4.12
Problem description
When mounting an action on a form schema - either in the header, or as part of the form itself, the content of the modals cannot be seen. The following examples show that the action exists, and can be successfully mounted, but the modal content itself cannot be confirmed.
After some investigation on my part it appears that the issue is likely related to rendering of the modal's contents as the tests provided ensure the modal content is accurate, and the action itself can be mounted, but the contents are never found in the HTML.
Expected behavior
The expectation would be that the content of the modals would be rendered in the HTML, and the contents could be verified.
On the EditCustomer resource page:
protected function getHeaderActions(): array
{
return [
DeleteAction::make()->modalContent(new HtmlString('Header modal content')),
];
}
A test like this should pas:
it('cannot delete customer without confirmation', function () {
// Create a customer
$customer = Customer::factory()->create([
'name' => 'Non-Deletable Customer',
]);
// Try to delete the customer
livewire(EditCustomer::class, [
'record' => $customer->id,
])
->assertHasNoFormErrors()
->mountAction(DeleteAction::class)
->assertActionMounted(DeleteAction::class)
->assertSee('Header modal content');
});
But it fails to find the string Header modal content
in the html.
Steps to reproduce
Download the repo and composer install
, then run:
./vendor/bin/pest --filter='cannot delete customer without confirmation'
This will run through 4 example tests
Reproduction repository (issue will be closed if this is not valid)
https://github.com/Mrkbingham/filament-header-action-test-issue
Relevant log output
FAILED Tests\Feature\CustomerResourceTest > it cannot delete customer without confirmation - action class
Expected: <div wire:snapshot="" wire:effects="" wire:id="Dusb7fcaQ80QoBaSdPmc"\n
class="fi-page fi-resource-edit-record-page fi-resource-customers fi-resource-record-1"\n
>\n
... (475 more lines)
To contain: Header modal content
at vendor/livewire/livewire/src/Features/SupportTesting/MakesAssertions.php:14
10▕ {
11▕ function assertSee($values, $escape = true, $stripInitialData = true)
12▕ {
13▕ foreach (Arr::wrap($values) as $value) {
➜ 14▕ PHPUnit::assertStringContainsString(
15▕ $escape ? e($value): $value,
16▕ $this->html($stripInitialData)
17▕ );
18▕ }
+1 vendor frames
2 tests/Feature/CustomerResourceTest.php:32
Metadata
Metadata
Assignees
Labels
Type
Projects
Status