Bugzilla – Attachment 192315 Details for
Bug 39916
The 'Place booking' modal should have cypress tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39916: (QA follow-up) Fix startRange class lost on month navigation
7e7b06e.patch (text/plain), 3.41 KB, created by
Martin Renvoize (ashimema)
on 2026-02-02 12:43:07 UTC
(
hide
)
Description:
Bug 39916: (QA follow-up) Fix startRange class lost on month navigation
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-02 12:43:07 UTC
Size:
3.41 KB
patch
obsolete
>From 7e7b06ea6d682f8fbb02effa01dcfe620a414431 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Fri, 30 Jan 2026 19:27:38 +0100 >Subject: [PATCH] Bug 39916: (QA follow-up) Fix startRange class lost on month > navigation > >When selecting a booking start date that triggers month navigation >(e.g., selecting Feb 1 while viewing January), the flatpickr calendar >would lose the 'startRange' CSS class on the selected date. This >occurred because setting maxDate in the onChange handler triggered a >calendar redraw, and flatpickr only applies startRange during the >initial click event, not during redraws. > >This caused the Cypress test "should handle date range validation >correctly" to fail on dates near month boundaries (e.g., January 30). > >The fix re-applies the startRange class after the maxDate is set, >using setTimeout to ensure it runs after the redraw completes. A >guard ensures this only happens when exactly one date is selected, >preventing interference with end date selection. > >To test: >- Apply patch >- Open a biblio detail page with bookable items >- Click "Place booking" >- Select a patron, pickup location, and item >- In the date picker, click a date that's in the next month > (visible in the "next month" area of the calendar) >- Verify the selected date shows the startRange styling (highlighted > as the range start) >- Select an end date >- Verify the range is properly selected and the form can be submitted >- Run Cypress tests: > yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts >- Verify all tests pass > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > .../prog/js/modals/place_booking.js | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >index 5b7bb772c31..48fb1fcfe43 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -787,6 +787,22 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > > // Update the maxDate option of the flatpickr instance > instance.set("maxDate", maxDate); >+ >+ // Re-apply startRange class after redraw >+ // Flatpickr may lose this class when maxDate triggers a redraw >+ setTimeout(() => { >+ // Only apply if still in "start date only" state >+ if (instance.selectedDates.length !== 1) { >+ return; >+ } >+ instance.calendarContainer >+ .querySelectorAll(".flatpickr-day.selected") >+ .forEach(el => { >+ if (!el.classList.contains("startRange")) { >+ el.classList.add("startRange"); >+ } >+ }); >+ }, 0); > } > // Range set, update hidden fields and set available items > else if (selectedDates[0] && selectedDates[1]) { >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39916
:
182515
|
182516
|
182545
|
182546
|
182635
|
182636
|
182637
|
182771
|
182772
|
182773
|
183206
|
183207
|
183208
|
183209
|
183210
|
190789
|
190790
|
190791
|
190792
|
190816
|
190817
|
190818
|
190819
|
191710
|
191711
|
191712
|
191713
|
191770
|
191771
|
191772
|
191773
|
191774
|
192265
| 192315