* draft for tablet view * adapt sidebar to tablet view * split menubar to handle tablet and desktop separatly * split sidebar to handle tablet and desktop separatly * prettier day navigationin tablet view * added missing translations * coderabbit comments * fix UI of view switcher on tablet, remove hard text * fix style of selected view option * fix wrong I18n key * extracted menubar recurring components to own files * adjust test case of calendar component * refactor function change calendar view Co-authored-by: Camille Moussu <cmoussu@linagora.com> Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import CalendarApp from '@/components/Calendar/Calendar'
|
||||
import CalendarLayout from '@/components/Calendar/CalendarLayout'
|
||||
import { CALENDAR_VIEWS } from '@/components/Calendar/utils/constants'
|
||||
import * as calendarDetailThunks from '@/features/Calendars/services'
|
||||
import * as servicesModule from '@/features/Calendars/services'
|
||||
import { searchUsers } from '@/features/User/userAPI'
|
||||
@@ -14,7 +15,16 @@ const mockedSearchUsers = searchUsers as jest.MockedFunction<typeof searchUsers>
|
||||
// Test wrapper component to provide calendarRef
|
||||
function CalendarTestWrapper() {
|
||||
const calendarRef = useRef(null)
|
||||
return <CalendarApp calendarRef={calendarRef} />
|
||||
return (
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={calendarRef}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
describe('CalendarSelection', () => {
|
||||
@@ -143,7 +153,14 @@ describe('CalendarSelection', () => {
|
||||
const mockCalendarRef = { current: null }
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
})
|
||||
@@ -159,7 +176,14 @@ describe('CalendarSelection', () => {
|
||||
const mockCalendarRef = { current: null }
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
})
|
||||
@@ -194,7 +218,14 @@ describe('CalendarSelection', () => {
|
||||
)
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
})
|
||||
@@ -207,7 +238,14 @@ describe('CalendarSelection', () => {
|
||||
const mockCalendarRef = { current: null }
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
})
|
||||
@@ -423,8 +461,9 @@ describe('calendar Availability search', () => {
|
||||
})
|
||||
|
||||
const calendarApi = calendarRef.current
|
||||
expect(calendarApi).not.toBeNull()
|
||||
await act(async () => {
|
||||
calendarApi.changeView('dayGridMonth')
|
||||
calendarApi?.changeView(CALENDAR_VIEWS.dayGridMonth)
|
||||
})
|
||||
await waitFor(() => {
|
||||
expect(screen.queryAllByRole('columnheader').length).toBe(14)
|
||||
@@ -472,9 +511,10 @@ describe('calendar Availability search', () => {
|
||||
|
||||
const calendarRef = window.__calendarRef
|
||||
const calendarApi = calendarRef.current
|
||||
expect(calendarApi).not.toBeNull()
|
||||
|
||||
await act(async () => {
|
||||
calendarApi.changeView('dayGridMonth')
|
||||
calendarApi?.changeView(CALENDAR_VIEWS.dayGridMonth)
|
||||
fireEvent.click(screen.getByTestId('ChevronRightIcon'))
|
||||
})
|
||||
|
||||
@@ -554,7 +594,14 @@ describe('calendar Availability search', () => {
|
||||
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={{ current: null }} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={{ current: null }}
|
||||
/>,
|
||||
stateWithManyCalendars
|
||||
)
|
||||
})
|
||||
@@ -612,7 +659,14 @@ describe('calendar Availability search', () => {
|
||||
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={{ current: null }} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={{ current: null }}
|
||||
/>,
|
||||
calendarsWithSelected
|
||||
)
|
||||
})
|
||||
@@ -646,10 +700,20 @@ describe('calendar Availability search', () => {
|
||||
)
|
||||
|
||||
await act(async () => {
|
||||
renderWithProviders(<CalendarApp calendarRef={{ current: null }} />, {
|
||||
...preloadedState,
|
||||
calendars: { ...preloadedState.calendars, pending: false }
|
||||
})
|
||||
renderWithProviders(
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={{ current: null }}
|
||||
/>,
|
||||
{
|
||||
...preloadedState,
|
||||
calendars: { ...preloadedState.calendars, pending: false }
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
await waitFor(
|
||||
@@ -682,7 +746,14 @@ describe('calendar Availability search', () => {
|
||||
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={{ current: null }} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={{ current: null }}
|
||||
/>,
|
||||
stateWithUndefinedCalendars
|
||||
)
|
||||
})
|
||||
@@ -701,7 +772,14 @@ describe('calendar Availability search', () => {
|
||||
|
||||
await act(async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={{ current: null }} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={{ current: null }}
|
||||
/>,
|
||||
stateWithUndefinedTemp
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CalendarLayout from '@/components/Calendar/CalendarLayout'
|
||||
import { CALENDAR_VIEWS } from '@/components/Calendar/utils/constants'
|
||||
import { act, waitFor } from '@testing-library/react'
|
||||
import { renderWithProviders } from '../utils/Renderwithproviders'
|
||||
|
||||
@@ -51,7 +52,7 @@ describe('Calendar – dayHeaderContent respects selected timezone', () => {
|
||||
await waitFor(() => expect(calendarRef?.current).not.toBeNull())
|
||||
|
||||
await act(async () => {
|
||||
calendarRef.current?.changeView('timeGridWeek')
|
||||
calendarRef.current?.changeView(CALENDAR_VIEWS.timeGridWeek)
|
||||
})
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
@@ -75,7 +75,14 @@ describe('CalendarApp integration', () => {
|
||||
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
}
|
||||
@@ -172,7 +179,14 @@ describe('CalendarApp integration', () => {
|
||||
})
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
const card = screen.getByTestId('event-card-event1')
|
||||
@@ -191,7 +205,14 @@ describe('CalendarApp integration', () => {
|
||||
})
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
|
||||
@@ -211,7 +232,14 @@ describe('CalendarApp integration', () => {
|
||||
})
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
|
||||
@@ -222,46 +250,56 @@ describe('CalendarApp integration', () => {
|
||||
|
||||
it('does render a title for events without any attendees or user as organizer', async () => {
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(<CalendarApp calendarRef={mockCalendarRef} />, {
|
||||
user: {
|
||||
userData: {
|
||||
sub: 'test',
|
||||
email: 'test@test.com',
|
||||
sid: 'mockSid',
|
||||
openpaasId: '667037022b752d0026472254'
|
||||
},
|
||||
tokens: {
|
||||
accessToken: 'token'
|
||||
}
|
||||
},
|
||||
calendars: {
|
||||
list: {
|
||||
'667037022b752d0026472254/cal1': {
|
||||
name: 'Calendar 1',
|
||||
id: '667037022b752d0026472254/cal1',
|
||||
color: { light: '#FF0000', dark: '#000' },
|
||||
owner: { emails: ['alice@example.com'] },
|
||||
events: {
|
||||
event1: {
|
||||
id: 'event1',
|
||||
calId: '667037022b752d0026472254/cal1',
|
||||
uid: 'event1',
|
||||
start: new Date().toISOString(),
|
||||
end: new Date(Date.now() + 3600000).toISOString(),
|
||||
partstat: 'ACCEPTED',
|
||||
organizer: {
|
||||
cn: 'Alice',
|
||||
cal_address: 'alice@example.com'
|
||||
},
|
||||
class: 'PUBLIC',
|
||||
title: 'Public Event'
|
||||
}
|
||||
}
|
||||
renderWithProviders(
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
{
|
||||
user: {
|
||||
userData: {
|
||||
sub: 'test',
|
||||
email: 'test@test.com',
|
||||
sid: 'mockSid',
|
||||
openpaasId: '667037022b752d0026472254'
|
||||
},
|
||||
tokens: {
|
||||
accessToken: 'token'
|
||||
}
|
||||
},
|
||||
pending: false
|
||||
calendars: {
|
||||
list: {
|
||||
'667037022b752d0026472254/cal1': {
|
||||
name: 'Calendar 1',
|
||||
id: '667037022b752d0026472254/cal1',
|
||||
color: { light: '#FF0000', dark: '#000' },
|
||||
owner: { emails: ['alice@example.com'] },
|
||||
events: {
|
||||
event1: {
|
||||
id: 'event1',
|
||||
calId: '667037022b752d0026472254/cal1',
|
||||
uid: 'event1',
|
||||
start: new Date().toISOString(),
|
||||
end: new Date(Date.now() + 3600000).toISOString(),
|
||||
partstat: 'ACCEPTED',
|
||||
organizer: {
|
||||
cn: 'Alice',
|
||||
cal_address: 'alice@example.com'
|
||||
},
|
||||
class: 'PUBLIC',
|
||||
title: 'Public Event'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
pending: false
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
expect(screen.getByText('Public Event')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { CALENDAR_VIEWS } from '@/components/Calendar/utils/constants'
|
||||
import { Menubar } from '@/components/Menubar/Menubar'
|
||||
import * as oidcAuth from '@/features/User/oidcAuth'
|
||||
import { redirectTo } from '@/utils/navigation'
|
||||
@@ -35,8 +36,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -53,8 +55,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -71,8 +74,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -100,8 +104,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -131,8 +136,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -161,8 +167,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -191,8 +198,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -221,8 +229,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -251,8 +260,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -283,8 +293,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -315,8 +326,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -335,8 +347,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -356,8 +369,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -377,8 +391,9 @@ describe('Calendar App Component Display Tests', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -427,8 +442,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -447,8 +463,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -467,8 +484,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -487,8 +505,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -509,8 +528,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -531,8 +551,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -553,8 +574,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -579,8 +601,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -618,8 +641,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -650,8 +674,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedStateWithSettings
|
||||
)
|
||||
@@ -681,8 +706,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -707,8 +733,9 @@ describe('Menubar interaction with expanded Dialog', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -745,8 +772,9 @@ describe('Menubar logout flow', () => {
|
||||
<Menubar
|
||||
calendarRef={{ current: null }}
|
||||
onRefresh={() => {}}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={new Date()}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -815,8 +843,9 @@ describe('Logo click navigation to current week', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
onViewChange={mockOnViewChange}
|
||||
onDateChange={mockOnDateChange}
|
||||
/>,
|
||||
@@ -832,9 +861,9 @@ describe('Logo click navigation to current week', () => {
|
||||
expect(store.getState().settings.view).toBe('calendar')
|
||||
})
|
||||
|
||||
expect(mockChangeView).toHaveBeenCalledWith('timeGridWeek')
|
||||
expect(mockChangeView).toHaveBeenCalledWith(CALENDAR_VIEWS.timeGridWeek)
|
||||
expect(mockToday).toHaveBeenCalled()
|
||||
expect(mockOnViewChange).toHaveBeenCalledWith('timeGridWeek')
|
||||
expect(mockOnViewChange).toHaveBeenCalledWith(CALENDAR_VIEWS.timeGridWeek)
|
||||
expect(mockOnDateChange).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -857,8 +886,9 @@ describe('Logo click navigation to current week', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="timeGridDay"
|
||||
currentView={CALENDAR_VIEWS.timeGridDay}
|
||||
onViewChange={mockOnViewChange}
|
||||
onDateChange={mockOnDateChange}
|
||||
/>,
|
||||
@@ -874,9 +904,9 @@ describe('Logo click navigation to current week', () => {
|
||||
expect(store.getState().settings.view).toBe('calendar')
|
||||
})
|
||||
|
||||
expect(mockChangeView).toHaveBeenCalledWith('timeGridWeek')
|
||||
expect(mockChangeView).toHaveBeenCalledWith(CALENDAR_VIEWS.timeGridWeek)
|
||||
expect(mockToday).toHaveBeenCalled()
|
||||
expect(mockOnViewChange).toHaveBeenCalledWith('timeGridWeek')
|
||||
expect(mockOnViewChange).toHaveBeenCalledWith(CALENDAR_VIEWS.timeGridWeek)
|
||||
expect(mockOnDateChange).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -899,8 +929,9 @@ describe('Logo click navigation to current week', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="timeGridWeek"
|
||||
currentView={CALENDAR_VIEWS.timeGridWeek}
|
||||
onViewChange={mockOnViewChange}
|
||||
onDateChange={mockOnDateChange}
|
||||
/>,
|
||||
@@ -932,8 +963,9 @@ describe('Logo click navigation to current week', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
onViewChange={mockOnViewChange}
|
||||
onDateChange={mockOnDateChange}
|
||||
/>,
|
||||
@@ -970,8 +1002,9 @@ describe('Logo click navigation to current week', () => {
|
||||
<Menubar
|
||||
calendarRef={mockCalendarRef}
|
||||
onRefresh={mockOnRefresh}
|
||||
onToggleSidebar={() => {}}
|
||||
currentDate={mockCurrentDate}
|
||||
currentView="dayGridMonth"
|
||||
currentView={CALENDAR_VIEWS.dayGridMonth}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
@@ -985,7 +1018,7 @@ describe('Logo click navigation to current week', () => {
|
||||
expect(store.getState().settings.view).toBe('calendar')
|
||||
})
|
||||
|
||||
expect(mockChangeView).toHaveBeenCalledWith('timeGridWeek')
|
||||
expect(mockChangeView).toHaveBeenCalledWith(CALENDAR_VIEWS.timeGridWeek)
|
||||
expect(mockToday).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -49,7 +49,14 @@ describe('MiniCalendar', () => {
|
||||
}
|
||||
const mockCalendarRef = { current: null }
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
preloadedState
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,14 @@ describe('Calendar - Timezone Integration', () => {
|
||||
|
||||
it('renders TimezoneSelector in week view', async () => {
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
baseState
|
||||
)
|
||||
|
||||
@@ -57,7 +64,14 @@ describe('Calendar - Timezone Integration', () => {
|
||||
const setTimeZoneSpy = jest.spyOn(SettingsSlice, 'setTimeZone')
|
||||
|
||||
renderWithProviders(
|
||||
<CalendarApp calendarRef={mockCalendarRef} />,
|
||||
<CalendarApp
|
||||
setCurrentView={jest.fn()}
|
||||
onViewChange={jest.fn()}
|
||||
openSidebar={false}
|
||||
onCloseSidebar={jest.fn()}
|
||||
currentView="timeGridWeek"
|
||||
calendarRef={mockCalendarRef}
|
||||
/>,
|
||||
baseState
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user