diff --git a/tests/Browser/DatepickerTest.php b/tests/Browser/DatepickerTest.php index da1fd93f..bfc6fbb8 100644 --- a/tests/Browser/DatepickerTest.php +++ b/tests/Browser/DatepickerTest.php @@ -514,8 +514,8 @@ it('opens the range picker full screen below 600px and grows its month list both ->assertScript("{$picker}.matches(':modal')") ->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-app-bar]').offsetHeight > 0") // M3's 14-element anatomy: a close (×) icon button and Save in the app bar, not Cancel/OK. - ->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-close]')") - ->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-save]')") + ->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-close]').getClientRects().length > 0") + ->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-save]').getClientRects().length > 0") ->assertScript("getComputedStyle(document.querySelector('#trip-field-picker [data-md-datepicker-actions]')).display === 'none'") // The window opens six months either side of the trip's start month. ->assertScript("{$scope}.monthsFrom === '2026-03-01' && {$scope}.monthsTo === '2027-03-01'") @@ -540,8 +540,10 @@ it('opens the range picker full screen below 600px and grows its month list both ->assertScript("[...document.querySelectorAll('#trip-field-picker [data-md-datepicker-month-label]')].some((label) => label.textContent.trim() === 'February 2026')"); // Picking a range and pressing Save commits it and closes the dialog. - $page->script("{$scope}.moveTo('2026-09-13', false)") - ->click(day('trip-field', '2026-09-20')) + // script() returns the script's result, not the page, so the chain starts again after it. + $page->script("{$scope}.moveTo('2026-09-13', false)"); + + $page->click(day('trip-field', '2026-09-20')) ->click(day('trip-field', '2026-09-24')) ->click('#trip-field-picker [data-md-datepicker-save]') ->assertSeeIn('#trip', '{"start":"2026-09-20","end":"2026-09-24"}')