Files
coolify/tests/Feature/TopUserMenuTest.php
T
Andras Bacsai 51561e4bee feat(profile): add uploadable avatars with local/S3 storage
Users can upload and remove profile pictures on the profile page.
Admins choose local or instance S3 storage in advanced settings.
Avatars are compressed to JPEG and served via a private cached route.
2026-08-07 21:39:56 +02:00

43 lines
2.0 KiB
PHP

<?php
it('renders the same compact profile trigger on all breakpoints', function () {
$menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));
expect($menu)
->toContain('{{ $userInitial }}')
->toContain('aria-label="Account menu for {{ $userName }}"')
->not->toContain('sm:hidden')
->not->toContain('hidden sm:block max-w-[9rem]')
->not->toContain('sm:px-3');
});
it('still shows the user name and email inside the dropdown panel', function () {
$menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));
expect($menu)
->toContain('truncate text-[13px] font-semibold text-black dark:text-fg">{{ $userName }}</div>')
->toContain('{{ $userEmail }}');
});
it('changes appearance from a submenu instead of navigating to a separate page', function () {
$menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));
expect($menu)
->toContain('appearanceOpen: false')
->toContain('@click.outside="open = false; appearanceOpen = false"')
->toContain("theme: localStorage.getItem('theme') === 'purple' ? 'custom' : (localStorage.getItem('theme') || 'dark')")
->toContain('setTheme(type, closeMenu = true)')
->toContain("this.setTheme('custom', false)")
->not->toContain('@change="appearanceOpen = false; open = false"')
->toContain('this.appearanceOpen = false;')
->toContain('this.open = false;')
->toContain('<template x-if="open">')
->not->toContain('x-show.important="open"')
->not->toContain('<div x-show="open" x-cloak x-transition.opacity.duration.120ms')
->toContain("['value' => 'light', 'label' => 'Light'")
->toContain("['value' => 'system', 'label' => 'System'")
->toContain("['value' => 'dark', 'label' => 'Dark'")
->toContain('hover:bg-neutral-200 hover:text-neutral-950')
->not->toContain("route('profile.appearance')");
});