Fix two datepicker browser assertions that could never pass

Plan step 36 review of 72d9dbfc's new full-screen range test, written
but not run. It chained click() off script(), whose return value is the
evaluated script's result rather than the page (the chaining bug
4bf1ca13 fixed elsewhere), and asserted the close and Save buttons with
a bare querySelector, which assertScript compares strictly with true.
The chain is split, and the buttons are asserted as drawn.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
Andreas Reinhold / reini
2026-09-14 19:38:25 +02:00
co-authored by Claude Opus 5
parent 459678c341
commit 4cc5a7363f
+6 -4
View File
@@ -514,8 +514,8 @@ it('opens the range picker full screen below 600px and grows its month list both
->assertScript("{$picker}.matches(':modal')") ->assertScript("{$picker}.matches(':modal')")
->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-app-bar]').offsetHeight > 0") ->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. // 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-close]').getClientRects().length > 0")
->assertScript("document.querySelector('#trip-field-picker [data-md-datepicker-save]')") ->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'") ->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. // The window opens six months either side of the trip's start month.
->assertScript("{$scope}.monthsFrom === '2026-03-01' && {$scope}.monthsTo === '2027-03-01'") ->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')"); ->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. // Picking a range and pressing Save commits it and closes the dialog.
$page->script("{$scope}.moveTo('2026-09-13', false)") // script() returns the script's result, not the page, so the chain starts again after it.
->click(day('trip-field', '2026-09-20')) $page->script("{$scope}.moveTo('2026-09-13', false)");
$page->click(day('trip-field', '2026-09-20'))
->click(day('trip-field', '2026-09-24')) ->click(day('trip-field', '2026-09-24'))
->click('#trip-field-picker [data-md-datepicker-save]') ->click('#trip-field-picker [data-md-datepicker-save]')
->assertSeeIn('#trip', '{"start":"2026-09-20","end":"2026-09-24"}') ->assertSeeIn('#trip', '{"start":"2026-09-20","end":"2026-09-24"}')