test: fix BackupSet empty state create assertions
This commit is contained in:
parent
5c14a0a110
commit
8f3777c063
@ -10,6 +10,17 @@
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Livewire\Livewire;
|
||||
|
||||
function getTableEmptyStateAction($component, string $name): ?\Filament\Actions\Action
|
||||
{
|
||||
foreach ($component->instance()->getTable()->getEmptyStateActions() as $action) {
|
||||
if ($action instanceof \Filament\Actions\Action && $action->getName() === $name) {
|
||||
return $action;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function (): void {
|
||||
@ -74,11 +85,14 @@
|
||||
|
||||
Filament::setTenant($tenant, true);
|
||||
|
||||
Livewire::actingAs($user)
|
||||
$component = Livewire::actingAs($user)
|
||||
->test(ListBackupSets::class)
|
||||
->assertTableEmptyStateActionsExistInOrder(['create'])
|
||||
->assertActionVisible('create')
|
||||
->assertActionEnabled('create');
|
||||
->assertTableEmptyStateActionsExistInOrder(['create']);
|
||||
|
||||
$action = getTableEmptyStateAction($component, 'create');
|
||||
expect($action)->not->toBeNull();
|
||||
expect($action->isVisible())->toBeTrue();
|
||||
expect($action->isDisabled())->toBeFalse();
|
||||
});
|
||||
|
||||
test('backup sets list shows empty state create action disabled for members without sync capability', function () {
|
||||
@ -87,9 +101,12 @@
|
||||
|
||||
Filament::setTenant($tenant, true);
|
||||
|
||||
Livewire::actingAs($user)
|
||||
$component = Livewire::actingAs($user)
|
||||
->test(ListBackupSets::class)
|
||||
->assertTableEmptyStateActionsExistInOrder(['create'])
|
||||
->assertActionVisible('create')
|
||||
->assertActionDisabled('create');
|
||||
->assertTableEmptyStateActionsExistInOrder(['create']);
|
||||
|
||||
$action = getTableEmptyStateAction($component, 'create');
|
||||
expect($action)->not->toBeNull();
|
||||
expect($action->isVisible())->toBeTrue();
|
||||
expect($action->isDisabled())->toBeTrue();
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user