diff --git a/resources/views/components/bifrost-button.blade.php b/resources/views/components/bifrost-button.blade.php index 86cb001a..78e58297 100644 --- a/resources/views/components/bifrost-button.blade.php +++ b/resources/views/components/bifrost-button.blade.php @@ -4,39 +4,6 @@ diff --git a/resources/views/components/navigation-bar.blade.php b/resources/views/components/navigation-bar.blade.php index 45743be4..25962499 100644 --- a/resources/views/components/navigation-bar.blade.php +++ b/resources/views/components/navigation-bar.blade.php @@ -81,7 +81,7 @@ class="-mt-px size-3.5" {{-- Ultra link (desktop only) --}} @@ -89,7 +89,7 @@ class="hidden items-center gap-1.5 rounded-full bg-orange-500/10 px-3 py-1.5 tex {{-- Course link (desktop only) --}} @@ -97,7 +97,7 @@ class="hidden items-center gap-1.5 rounded-full bg-emerald-500/10 px-3 py-1.5 te {{-- Build link (desktop only) --}} diff --git a/tests/Feature/NavigationBarTest.php b/tests/Feature/NavigationBarTest.php new file mode 100644 index 00000000..e312a7dc --- /dev/null +++ b/tests/Feature/NavigationBarTest.php @@ -0,0 +1,74 @@ +', ''] as $template) { + $button = $this->blade($template); + + $this->assertSame('Bifrost', trim(strip_tags((string) $button))); + + $button->assertDontSee('gsap', escape: false); + } + } + + /** + * Ultra, Masterclass and Build used to be tinted, see-through pills that + * lost their contrast whenever the sticky nav floated over dark content. + * They now share the resting background of the Mobile and Desktop dropdown + * buttons, so the expected classes are read off the Mobile dropdown itself. + */ + #[Test] + public function the_desktop_nav_links_share_the_device_dropdown_background(): void + { + $dom = new DOMDocument; + libxml_use_internal_errors(true); + $dom->loadHTML(''.$this->get('/')->assertOk()->getContent()); + libxml_clear_errors(); + + $xpath = new DOMXPath($dom); + + $dropdownClasses = $xpath->query('//button[@id="mobile-dropdown-btn"]')->item(0)?->getAttribute(':class'); + + $this->assertSame( + 1, + preg_match("/'([^']+)':\s*!open/", (string) $dropdownClasses, $closedDropdown), + 'Could not read the resting background of the Mobile dropdown button.', + ); + + $expectedClasses = preg_split('/\s+/', $closedDropdown[1], flags: PREG_SPLIT_NO_EMPTY); + + $links = [ + 'Ultra' => route('pricing'), + 'Masterclass' => route('course'), + 'Build' => route('build-my-app'), + ]; + + foreach ($links as $label => $href) { + $link = $xpath->query("//nav[@data-site-nav]/div/div/a[@href='{$href}']")->item(0); + + $this->assertNotNull($link, "The {$label} link is missing from the nav bar."); + $this->assertSame($label, trim($link->textContent)); + + $linkClasses = preg_split('/\s+/', $link->getAttribute('class'), flags: PREG_SPLIT_NO_EMPTY); + + $this->assertSame( + [], + array_values(array_diff($expectedClasses, $linkClasses)), + "The {$label} link should use the same background as the Mobile and Desktop dropdowns.", + ); + } + } +}