toHaveKey($key); } } }); test('navigation is the sticky site header', function () { $html = $this->get('/')->assertOk()->getContent(); expect($html) ->toContain('class="nav"') ->toContain('id="site-nav"') ->toContain('class="seal"') ->toContain('class="links"') ->toContain('class="lang"') ->toContain('href="'.route('login').'"') ->toContain('btn btn-gold') ->toContain('class="menu-btn"') ->toContain('mobileMenuOpen'); }); test('about link is current on about, articles on posts', function () { $about = $this->get('/about')->assertOk()->getContent(); expect($about)->toMatch('~]*href="'.preg_quote(route('about'), '~').'"[^>]*aria-current="page"~'); $posts = $this->get('/posts')->assertOk()->getContent(); expect($posts)->toMatch('~]*href="'.preg_quote(route('posts.index'), '~').'"[^>]*aria-current="page"~'); }); test('language pill reads EN on Arabic and the Arabic letter on English', function () { $ar = $this->withSession(['locale' => 'ar'])->get('/')->getContent(); expect($ar)->toContain('href="'.url('/language/en').'"'); $en = $this->withSession(['locale' => 'en'])->get('/')->getContent(); expect($en)->toContain('href="'.url('/language/ar').'"'); }); test('clients and admins see Dashboard and logout instead of login', function () { $client = $this->actingAs(User::factory()->individual()->create())->get('/')->getContent(); expect($client)->toContain(route('client.dashboard'))->toContain('action="'.route('logout').'"'); auth()->logout(); $admin = $this->actingAs(User::factory()->admin()->create())->get('/')->getContent(); expect($admin)->toContain(route('admin.dashboard')); }); test('footer has four columns, contact details, legal links and no photo credit', function () { $html = $this->get('/')->assertOk()->getContent(); expect($html) ->toContain('class="site-footer"') ->toContain('class="foot-band"') ->toContain('tel:+970599353502') ->toContain(route('terms')) ->toContain(route('privacy')) ->toContain('© '.date('Y')) ->not->toContain('Unsplash'); expect(substr_count($html, 'toBe(3); }); test('shared files stay untouched and navigation is only used by the public layout', function () { $files = shell_exec('grep -rln "x-navigation" '.escapeshellarg(resource_path('views'))); expect(trim($files))->toEndWith('components/layouts/public.blade.php'); });