© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•8mo ago
BlueForge

Testing table list checkbox click

What I am trying to do:

I'm trying to add Pest test for Checkbox click on the ListRecords component.

What I did:

I tried these methods to execute checkbox click like beaviour:

livewire(ListOperators::class)->callTableColumnAction('user.is_active', $operator->id);
livewire(ListOperators::class)->callTableColumnAction('user.is_active', $operator->id);


livewire(ListOperators::class)->call('updateTableColumnState', ['user.is_active', $operator->id, true]);
livewire(ListOperators::class)->call('updateTableColumnState', ['user.is_active', $operator->id, true]);


My issue/the error:

Nothing happens, test is not passing as I'm checking if
user.is_active
user.is_active
boolean value is changed in the db.

Code:

    public function table(Table $table): Table
    {
        return $table
            ->columns([
                CheckboxColumn::make('user.is_active')
                    ->tooltip(fn (Operator $record): string => $record->user->is_active ? 'Włączone' : 'Wyłączone')
                    ->label('Status konta'),
            ]);
    }
    public function table(Table $table): Table
    {
        return $table
            ->columns([
                CheckboxColumn::make('user.is_active')
                    ->tooltip(fn (Operator $record): string => $record->user->is_active ? 'Włączone' : 'Wyłączone')
                    ->label('Status konta'),
            ]);
    }

test('it_allows_to_change_user_is_active_status_from_operator_list', function () {
    $operator = Operator::factory()->create();

    assertTrue($operator->user->is_active);

    livewire(ListOperators::class)
        ->call('updateTableColumnState', ['user.is_active', $operator->id, false]);
    
    livewire(ListOperators::class)
        ->callTableColumnAction('user.is_active', $operator->id);

    assertFalse($operator->fresh()->user->fresh()->is_active); // not passing here
});
test('it_allows_to_change_user_is_active_status_from_operator_list', function () {
    $operator = Operator::factory()->create();

    assertTrue($operator->user->is_active);

    livewire(ListOperators::class)
        ->call('updateTableColumnState', ['user.is_active', $operator->id, false]);
    
    livewire(ListOperators::class)
        ->callTableColumnAction('user.is_active', $operator->id);

    assertFalse($operator->fresh()->user->fresh()->is_active); // not passing here
});
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

Checkbox list
FilamentFFilament / ❓┊help
2y ago
checkbox list
FilamentFFilament / ❓┊help
2y ago
Checkbox list
FilamentFFilament / ❓┊help
3y ago
Checkbox list groups
FilamentFFilament / ❓┊help
6mo ago