@@ -82,6 +82,15 @@ mock.module("@web/common/calendar-grid/hooks/useCalendarGridLayout", () => ({
8282 } ,
8383} ) ) ;
8484
85+ const floatingUi =
86+ require ( "@floating-ui/react" ) as typeof import ( "@floating-ui/react" ) ;
87+ const useDismissMock = mock ( floatingUi . useDismiss ) ;
88+
89+ mock . module ( "@floating-ui/react" , ( ) => ( {
90+ ...floatingUi ,
91+ useDismiss : useDismissMock ,
92+ } ) ) ;
93+
8594mock . module ( "@web/components/FloatingEventForm/FloatingEventForm" , ( ) => ( {
8695 FloatingEventForm : ( ) => null ,
8796} ) ) ;
@@ -130,6 +139,7 @@ const setDraftEvent = (event: Schema_Event) => {
130139
131140beforeEach ( ( ) => {
132141 store = createStoreWithEvents ( [ ] ) ;
142+ useDismissMock . mockClear ( ) ;
133143} ) ;
134144
135145afterEach ( ( ) => {
@@ -356,6 +366,18 @@ describe("DayCalendarGrid", () => {
356366 expect ( getDraft ( ) ) . toBeNull ( ) ;
357367 } ) ;
358368
369+ it ( "dismisses the floating form after empty agenda mouse handlers run" , ( ) => {
370+ renderDayCalendarGrid ( ) ;
371+
372+ expect ( useDismissMock ) . toHaveBeenCalledWith (
373+ expect . anything ( ) ,
374+ expect . objectContaining ( {
375+ enabled : true ,
376+ outsidePressEvent : "click" ,
377+ } ) ,
378+ ) ;
379+ } ) ;
380+
359381 it ( "dismisses an open draft when clicking empty Day all-day calendar space" , ( ) => {
360382 const existingDraft = createTimedEvent ( {
361383 _id : "open-all-day-draft" ,
0 commit comments