© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
16 replies
Mark Chaney

Testing live() and afterStateUpdated()

for a pest test and testing live(), should assertSet() be used? This is what i am trying, but getting null for the year_built value according to the assertSet output. If i try assertFormSet() of course i just get the original fill values.
test('selecting a property field updates year built and total units field', function () {

    ray($this->rfta->property->year_built)->label('rfta property - year_built');
    $property = Property::factory()->create();
    ray($property->year_built)->label('new property - year_built');

    // Simulate selecting a property to see if other fields are updated
    /** @phpstan-ignore-next-line */
    livewire(RftaResource\Pages\EditRfta::class, ['record' => $this->rfta->id])
        ->set('property_id', $property->id)
        ->assertSet('year_built', $property->year_built)
        ->assertSet('total_units', $property->total_units);
});
test('selecting a property field updates year built and total units field', function () {

    ray($this->rfta->property->year_built)->label('rfta property - year_built');
    $property = Property::factory()->create();
    ray($property->year_built)->label('new property - year_built');

    // Simulate selecting a property to see if other fields are updated
    /** @phpstan-ignore-next-line */
    livewire(RftaResource\Pages\EditRfta::class, ['record' => $this->rfta->id])
        ->set('property_id', $property->id)
        ->assertSet('year_built', $property->year_built)
        ->assertSet('total_units', $property->total_units);
});
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Using both afterStateUpdated AND afterStateUpdatedJs
FilamentFFilament / ❓┊help
8mo ago
REMOVE DELAY WHILE TYPING ON LIVE() and AFTERSTATEUPDATED()
FilamentFFilament / ❓┊help
2y ago
Testing a form with live events
FilamentFFilament / ❓┊help
3y ago