diff --git a/tests/Browser/ContainmentTest.php b/tests/Browser/ContainmentTest.php index 4aaa6a31..19a134b4 100644 --- a/tests/Browser/ContainmentTest.php +++ b/tests/Browser/ContainmentTest.php @@ -183,7 +183,8 @@ it('slides a side sheet in, traps the page, and closes on the scrim', function ( ->assertScript("getComputedStyle({$sheet}).display !== 'none'") ->assertScript("document.querySelector('header').closest('[aria-hidden=\"true\"]') !== null"); - $page->script("document.querySelector('[data-sheet] > [aria-hidden=\"true\"]').click()"); + // This sheet's own scrim: the standard side sheet above it on the page is a `[data-sheet]` too. + $page->script("{$sheet}.parentElement.querySelector(':scope > [aria-hidden=\"true\"]').click()"); $page->assertScript("getComputedStyle({$sheet}).display === 'none'") ->assertScript("document.querySelector('header').closest('[aria-hidden=\"true\"]') === null"); @@ -193,7 +194,7 @@ it('dismisses a bottom sheet dragged down past a quarter of its height', functio $sheet = "document.querySelector('#containment section[role=\"dialog\"]')"; $page = containment() - ->click('#containment button:has-text("Bottom sheet")') + ->click('#containment button:has(> span:text-is("Bottom sheet"))') ->assertScript("getComputedStyle({$sheet}).display !== 'none'") ->wait(0.5); @@ -232,8 +233,9 @@ it('makes a directly actionable card the one tab stop, answering Enter', functio $page->script("window.__opened = 0; document.querySelector('{$card} [data-list-open]').addEventListener('click', (event) => { event.preventDefault(); window.__opened++ })"); - $page->script("document.querySelector('{$card}').focus()") - ->assertScript("document.activeElement.matches('{$card}')"); + $page->script("document.querySelector('{$card}').focus()"); + + $page->assertScript("document.activeElement.matches('{$card}')"); $page->keys($card, 'Enter') ->assertScript('window.__opened === 1');