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 }}') ->toContain('{{ $userEmail }}'); }); it('animates the dropdown panel when the user menu opens', function () { $menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php')); $stylesheet = file_get_contents(resource_path('css/app.css')); expect($menu) ->toContain('animate-in fade-in zoom-in-95 duration-150') ->toContain("'origin-bottom-left' => \$sidebar") ->toContain("'origin-top-right' => ! \$sidebar"); expect($stylesheet)->toContain('@import "tw-animate-css";'); }); it('positions the account menu below the mobile trigger', function () { $menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php')); $stylesheet = file_get_contents(resource_path('css/app.css')); expect($menu)->toContain('top-user-menu-panel'); expect($stylesheet) ->toContain('.listbox-panel.top-user-menu-panel') ->toContain('top: calc(100% + 0.25rem) !important;') ->toContain('transform: none !important;') ->toContain('max-height: calc(100dvh - 4.5rem) !important;'); }); 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('
not->toContain('