From 940dba46a0f23d833bd6ba79a1071b90390c49be Mon Sep 17 00:00:00 2001 From: Pratap Rathi Date: Wed, 22 Jan 2025 14:04:20 +0530 Subject: [PATCH] fix: scrollbar removed, added test for day viewType, corrected change viewType in values in EventHeader --- .../EventCalendar/EventCalendar.spec.tsx | 7 +++++++ src/components/EventCalendar/EventCalendar.tsx | 17 +++-------------- .../EventCalendar/EventHeader.spec.tsx | 2 +- src/components/EventCalendar/EventHeader.tsx | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/components/EventCalendar/EventCalendar.spec.tsx b/src/components/EventCalendar/EventCalendar.spec.tsx index 4dfd0548d6..48a67d5e69 100644 --- a/src/components/EventCalendar/EventCalendar.spec.tsx +++ b/src/components/EventCalendar/EventCalendar.spec.tsx @@ -438,4 +438,11 @@ describe('Calendar', () => { }); }); }); + it('render the hour view', async () => { + render(); + + await wait(); + const renderHourComponent = screen.getByTestId('hour'); + expect(renderHourComponent).toBeInTheDocument(); + }); }); diff --git a/src/components/EventCalendar/EventCalendar.tsx b/src/components/EventCalendar/EventCalendar.tsx index 5bbceff614..c40a94237b 100644 --- a/src/components/EventCalendar/EventCalendar.tsx +++ b/src/components/EventCalendar/EventCalendar.tsx @@ -244,10 +244,7 @@ const Calendar: React.FC = ({ events ?.filter((datas) => { const currDate = new Date(currentYear, currentMonth, currentDate); - if ( - datas.startTime == undefined && - datas.startDate == dayjs(currDate).format('YYYY-MM-DD') - ) { + if (datas.startDate == dayjs(currDate).format('YYYY-MM-DD')) { return datas; } }) @@ -296,7 +293,7 @@ const Calendar: React.FC = ({ return ( <> -
+

{timezoneString}

@@ -571,7 +568,7 @@ const Calendar: React.FC = ({
)} -
+
{viewType == ViewType.MONTH ? ( <>
@@ -589,14 +586,6 @@ const Calendar: React.FC = ({
{renderHours()}
)}
- -
- {viewType == ViewType.YEAR ? ( - - ) : ( -
{renderHours()}
- )} -
); }; diff --git a/src/components/EventCalendar/EventHeader.spec.tsx b/src/components/EventCalendar/EventHeader.spec.tsx index 84b8ceafec..1f74123988 100644 --- a/src/components/EventCalendar/EventHeader.spec.tsx +++ b/src/components/EventCalendar/EventHeader.spec.tsx @@ -49,7 +49,7 @@ describe('EventHeader Component', () => { fireEvent.click(getByTestId('selectViewType')); await act(async () => { - fireEvent.click(getByTestId('selectDay')); + fireEvent.click(getByTestId('Day')); }); // Expect handleChangeView to be called with the new view type diff --git a/src/components/EventCalendar/EventHeader.tsx b/src/components/EventCalendar/EventHeader.tsx index 93e1612a4c..b921f638fc 100644 --- a/src/components/EventCalendar/EventHeader.tsx +++ b/src/components/EventCalendar/EventHeader.tsx @@ -89,9 +89,9 @@ function eventHeader({