Constitution v1.8.2: scope ownership + spec scope fields #111
@ -10,6 +10,17 @@
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Livewire\Livewire;
|
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);
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
beforeEach(function (): void {
|
beforeEach(function (): void {
|
||||||
@ -74,11 +85,14 @@
|
|||||||
|
|
||||||
Filament::setTenant($tenant, true);
|
Filament::setTenant($tenant, true);
|
||||||
|
|
||||||
Livewire::actingAs($user)
|
$component = Livewire::actingAs($user)
|
||||||
->test(ListBackupSets::class)
|
->test(ListBackupSets::class)
|
||||||
->assertTableEmptyStateActionsExistInOrder(['create'])
|
->assertTableEmptyStateActionsExistInOrder(['create']);
|
||||||
->assertActionVisible('create')
|
|
||||||
->assertActionEnabled('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 () {
|
test('backup sets list shows empty state create action disabled for members without sync capability', function () {
|
||||||
@ -87,9 +101,12 @@
|
|||||||
|
|
||||||
Filament::setTenant($tenant, true);
|
Filament::setTenant($tenant, true);
|
||||||
|
|
||||||
Livewire::actingAs($user)
|
$component = Livewire::actingAs($user)
|
||||||
->test(ListBackupSets::class)
|
->test(ListBackupSets::class)
|
||||||
->assertTableEmptyStateActionsExistInOrder(['create'])
|
->assertTableEmptyStateActionsExistInOrder(['create']);
|
||||||
->assertActionVisible('create')
|
|
||||||
->assertActionDisabled('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