Skip to content

Commit

Permalink
hotfix: Action hidden check with other actions inside a group
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Mar 18, 2024
1 parent 0a6edd9 commit 7a2874b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/actions/src/Concerns/CanBeHidden.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function isAuthorized(): bool

public function isHidden(): bool
{
if ($this->getGroup()?->isHidden()) {
if ($this->getGroup()?->baseIsHidden()) {
return true;
}

Expand Down
9 changes: 9 additions & 0 deletions tests/src/Tables/ActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
]);
});

it('can call action inside group', function () {
$post = Post::factory()->create();

livewire(PostsTable::class)
->callTableAction('groupedDelete', $post);

assertSoftDeleted($post);
});

it('can validate an action\'s data', function () {
livewire(PostsTable::class)
->callTableAction('data', data: [
Expand Down
5 changes: 5 additions & 0 deletions tests/src/Tables/Fixtures/PostsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ public function table(Table $table): Table
Tables\Actions\DeleteAction::make(),
Tables\Actions\ForceDeleteAction::make(),
Tables\Actions\RestoreAction::make(),
Tables\Actions\ActionGroup::make([
Tables\Actions\DeleteAction::make('groupedDelete'),
Tables\Actions\ForceDeleteAction::make('groupedForceDelete'),
Tables\Actions\RestoreAction::make('groupedRestore'),
]),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
Expand Down

0 comments on commit 7a2874b

Please sign in to comment.