diff --git a/tests/Browser/CommunicationTest.php b/tests/Browser/CommunicationTest.php index 7779c118..1531fe61 100644 --- a/tests/Browser/CommunicationTest.php +++ b/tests/Browser/CommunicationTest.php @@ -162,9 +162,11 @@ it('dismisses a focused snackbar with Escape', function () { $page->script("materialToast('Share deleted', { action: { label: 'Undo', handler: () => {} } })"); - $page->assertScript(TOAST."?.textContent.includes('Share deleted')") - ->script("document.querySelector('[data-md-toast-dismiss]').focus()") - ->keys(':focus', 'Escape') + $page->assertScript(TOAST."?.textContent.includes('Share deleted')"); + + $page->script("document.querySelector('[data-md-toast-dismiss]').focus()"); + + $page->keys(':focus', 'Escape') ->assertScript(TOAST.' === null'); }); @@ -189,8 +191,9 @@ it('grows to M3\'s two-line height with a description, and Alt+G reaches its act // Focused somewhere else on the page first: the shortcut has to reach the snackbar from // wherever the keyboard already was, since a snackbar never takes the focus on its own. - $page->script("document.body.setAttribute('tabindex', '-1'); document.body.focus()") - ->keys(':focus', 'Alt+g') + $page->script("document.body.setAttribute('tabindex', '-1'); document.body.focus()"); + + $page->keys(':focus', 'Alt+g') ->assertScript('document.activeElement === '.TOAST."?.querySelector('[data-md-toast-action]')"); });