diff --git a/app/Models/ServerSetting.php b/app/Models/ServerSetting.php index 624458ef91..32afb2a2a7 100644 --- a/app/Models/ServerSetting.php +++ b/app/Models/ServerSetting.php @@ -135,6 +135,16 @@ class ServerSetting extends Model 'compose_version_checked_at', ]; + /** + * Model-level defaults that mirror database column defaults, so a freshly + * created instance exposes them without a refresh. + * + * @var array + */ + protected $attributes = [ + 'is_traffic_analytics_enabled' => false, + ]; + protected $casts = [ 'force_disabled' => 'boolean', 'force_docker_cleanup' => 'boolean', diff --git a/tests/Feature/MobileResourceMenuTest.php b/tests/Feature/MobileResourceMenuTest.php index d6f3177146..182d11f85f 100644 --- a/tests/Feature/MobileResourceMenuTest.php +++ b/tests/Feature/MobileResourceMenuTest.php @@ -1,6 +1,6 @@ toBeGreaterThanOrEqual(2); + + expect($heading) + ->not->toContain('name="play-circle" class="size-3.5 text-warning"') + ->not->toContain('name="play-circle" class="size-3.5 text-orange-500'); } }); -it('uses native mobile menus for databases and services', function () { - $applicationHeading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php')); - $databaseHeading = file_get_contents(resource_path('views/livewire/project/database/heading.blade.php')); - $serviceHeading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php')); - $applicationMobileActions = mobileActionsMarkup($applicationHeading, 'application-mobile-actions', 'application-mobile-section'); - $databaseMobileActions = mobileActionsMarkup($databaseHeading, 'database-mobile-actions', 'database-mobile-section'); - $serviceMobileActions = mobileActionsMarkup($serviceHeading, 'service-mobile-actions', 'service-mobile-section'); +it('uses full-width split action menus on mobile resource headings', function () { + $headings = [ + 'application' => file_get_contents(resource_path('views/livewire/project/application/heading.blade.php')), + 'database' => file_get_contents(resource_path('views/livewire/project/database/heading.blade.php')), + 'service' => file_get_contents(resource_path('views/livewire/project/service/heading.blade.php')), + ]; - expect(mobileActionsAreBeforeSelect($applicationHeading, 'application-mobile-actions', 'application-mobile-section'))->toBeTrue(); - expect(mobileActionsAreBeforeSelect($databaseHeading, 'database-mobile-actions', 'database-mobile-section'))->toBeTrue(); - expect(mobileActionsAreBeforeSelect($serviceHeading, 'service-mobile-actions', 'service-mobile-section'))->toBeTrue(); + foreach ($headings as $resource => $heading) { + expect(mobileActionsAreBeforeDesktopActions($heading, "{$resource}-mobile-actions", "{$resource}-desktop-actions"))->toBeTrue(); - expect($applicationHeading) - ->toContain('application-mobile-actions') - ->toContain("'route' => 'project.application.command'") - ->toContain("'navigate' => false") - ->toContain("value.startsWith('location|')") - ->toContain('window.location.href = url') - ->toContain('application-mobile-stop-trigger') - ->toContain('application-mobile-restart-trigger') + expect($heading) + ->toContain('
') + ->toContain("") + ->not->toContain("{$resource}-mobile-section") + ->not->toContain('not->toContain('not->toContain('@selected'); + + expect(mobileActionsMarkup($heading, "{$resource}-mobile-actions")) + ->toContain('toContain('listbox-option justify-start! gap-2.5!') + ->toContain('role="menuitem"') + ->toContain('name="play-circle" class="size-3.5"') + ->toContain('name="restart" class="size-3.5') + ->toContain('name="stop-circle" class="size-3.5 text-error"'); + } + + expect(mobileActionsMarkup($headings['application'], 'application-mobile-actions')) ->toContain('wire:click="deploy"') - ->toContain('wire:click="force_deploy_without_cache"') + ->toContain('wire:click="deploy(true)"') + ->toContain('force_deploy_without_cache') + ->toContain('Deploy (without cache)') + ->toContain("document.getElementById('application-mobile-stop-trigger')?.click()") + ->toContain("document.getElementById('application-mobile-restart-trigger')?.click()"); + + expect($headings['application']) + ->toContain('