assertSee('Livewire Material') ->assertNoJavaScriptErrors(); }); it('moves between sections through the rail and the next-section link, keeping the rail', function () { $page = visit('/material')->waitForEvent('networkidle') ->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'"); $page->click('[data-navigation-rail-panel] a[href$="/material/buttons"]') ->assertSee('Variants') ->assertScript("document.querySelector('[data-navigation-rail-panel] [aria-current=\"page\"]').getAttribute('href').endsWith('/material/buttons')") ->assertScript("document.title === 'Buttons · Livewire Material'"); $page->click('[data-test="next-section"]') ->assertScript("location.pathname.endsWith('/material/menus')") ->assertNoJavaScriptErrors(); }); it('finds a component from anywhere and opens its section', function () { $page = visit('/material/buttons')->waitForEvent('networkidle') ->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'"); $page->keys('#content', '/') ->assertScript("document.activeElement.id === 'showcase-search'"); $page->type('#showcase-search', 'datepicker') ->assertSeeIn('[data-md-search-view]', ''); $page->keys('#showcase-search', 'Enter') ->assertScript("location.pathname.endsWith('/material/pickers')") ->assertScript("document.title === 'Date pickers · Livewire Material'"); }); it('opens an example on another page at the example', function () { $page = visit('/material')->waitForEvent('networkidle') ->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'"); $page->click('#showcase-search') ->type('#showcase-search', 'split button') ->click('[data-showcase-result]:has-text("Example")') ->assertScript("location.pathname.endsWith('/material/buttons') && location.hash.startsWith('#example-')") ->assertScript('(() => { const box = document.getElementById(decodeURIComponent(location.hash.slice(1))).getBoundingClientRect(); return box.top >= 0 && box.top < innerHeight; })()'); }); it('says so when nothing matches', function () { visit('/material')->waitForEvent('networkidle') ->assertScript("document.readyState === 'complete' && typeof window.Alpine !== 'undefined' && typeof window.Livewire !== 'undefined'") ->click('#showcase-search') ->type('#showcase-search', 'zzzz') ->assertSeeIn('[data-md-search-view]', 'Nothing matches'); });