Skip to content

Commit fe8e196

Browse files
authored
Merge pull request #504 from linagora/UI/update-header-bar
UI/update header bar
2 parents 9cf8d7f + af53ad1 commit fe8e196

36 files changed

+1014
-310
lines changed

__test__/components/EventModifications.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ describe("CalendarApp integration", () => {
400400
preloadedState
401401
);
402402

403+
// Expand to show date/time inputs (normal mode shows DateTimeSummary)
404+
fireEvent.click(
405+
screen.getByRole("button", { name: "common.moreOptions" })
406+
);
403407
const startDateInput = await screen.findByTestId("start-time-input");
404408

405409
await act(async () => {

__test__/components/Menubar.test.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { Menubar } from "@/components/Menubar/Menubar";
22
import * as oidcAuth from "@/features/User/oidcAuth";
3+
import { redirectTo } from "@/utils/navigation";
34
import "@testing-library/jest-dom";
45
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
56
import { renderWithProviders } from "../utils/Renderwithproviders";
67

8+
jest.mock("@/utils/navigation", () => ({
9+
redirectTo: jest.fn(),
10+
}));
11+
712
describe("Calendar App Component Display Tests", () => {
813
const preloadedState = {
914
user: {
@@ -320,7 +325,7 @@ describe("Calendar App Component Display Tests", () => {
320325
expect(avatar).toBeInTheDocument();
321326
});
322327

323-
it("shows AppsIcon when applist is not empty", () => {
328+
it("shows apps button when applist is not empty", () => {
324329
(window as any).appList = [{ name: "test", icon: "test", link: "test" }];
325330
const mockCalendarRef = { current: null };
326331
const mockOnRefresh = jest.fn();
@@ -335,10 +340,10 @@ describe("Calendar App Component Display Tests", () => {
335340
/>,
336341
preloadedState
337342
);
338-
expect(screen.getByTestId("AppsIcon")).toBeInTheDocument();
343+
expect(screen.getByLabelText("menubar.apps")).toBeInTheDocument();
339344
});
340345

341-
it("opens popover when clicking AppsIcon", () => {
346+
it("opens popover when clicking apps button", () => {
342347
(window as any).appList = [
343348
{ name: "Twake", icon: "twake.svg", link: "/twake" },
344349
{ name: "Calendar", icon: "calendar.svg", link: "/calendar" },
@@ -356,7 +361,7 @@ describe("Calendar App Component Display Tests", () => {
356361
/>,
357362
preloadedState
358363
);
359-
const appsButton = screen.getByTestId("AppsIcon");
364+
const appsButton = screen.getByLabelText("menubar.apps");
360365
fireEvent.click(appsButton);
361366
expect(screen.getByText("Twake")).toBeInTheDocument();
362367
expect(screen.getByText("Calendar")).toBeInTheDocument();
@@ -377,7 +382,7 @@ describe("Calendar App Component Display Tests", () => {
377382
/>,
378383
preloadedState
379384
);
380-
const appsButton = screen.getByTestId("AppsIcon");
385+
const appsButton = screen.getByLabelText("menubar.apps");
381386
fireEvent.click(appsButton);
382387

383388
const testLink = screen.getByRole("link", { name: /test/i });
@@ -532,7 +537,7 @@ describe("Menubar interaction with expanded Dialog", () => {
532537
preloadedState
533538
);
534539

535-
const appsButton = screen.getByTestId("AppsIcon");
540+
const appsButton = screen.getByLabelText("menubar.apps");
536541
expect(appsButton).toBeVisible();
537542

538543
fireEvent.click(appsButton);
@@ -717,10 +722,17 @@ describe("Menubar interaction with expanded Dialog", () => {
717722
});
718723

719724
describe("Menubar logout flow", () => {
725+
const redirectToMock = redirectTo as jest.Mock;
726+
720727
beforeEach(() => {
721728
localStorage.clear();
722729
sessionStorage.clear();
723730
jest.clearAllMocks();
731+
redirectToMock.mockReset();
732+
});
733+
734+
afterEach(() => {
735+
redirectToMock.mockReset();
724736
});
725737

726738
function renderMenubar(user = { name: "John", email: "test@example.com" }) {
@@ -756,6 +768,7 @@ describe("Menubar logout flow", () => {
756768
fireEvent.click(screen.getByText("menubar.logout"));
757769
});
758770
expect(logoutSpy).toHaveBeenCalled();
771+
expect(redirectToMock).toHaveBeenCalledWith("https://logout.url/");
759772

760773
expect(sessionStorage.length).toBe(0);
761774
});

__test__/components/ResponsiveDialog.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe("ResponsiveDialog", () => {
248248
onClose={mockOnClose}
249249
title="Test"
250250
isExpanded={true}
251-
headerHeight="100px"
251+
headerHeight="70px"
252252
>
253253
<div>Custom Header Content</div>
254254
</ResponsiveDialog>

__test__/features/Events/EventDisplay.test.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ describe("Event Preview Display", () => {
164164
expect(screen.getByText(/January/i)).toBeInTheDocument();
165165
expect(screen.getByText(/15/)).toBeInTheDocument();
166166

167-
// Check time is displayed with exact values
168-
// Format: "Wednesday, January 15, 2025 at 10:00 AM" and " – 10:00 AM" are in separate elements
167+
// Check time is displayed in 24h format (no AM/PM)
168+
// Format: "Wednesday, January 15, 2025 at 10:00" and " – 10:00" are in separate elements
169169
expect(
170-
screen.getByText(/Wednesday, January 15, 2025 at 10:00 AM/)
170+
screen.getByText(/Wednesday, January 15, 2025 at 10:00/)
171171
).toBeInTheDocument();
172-
expect(screen.getByText(/ 10:00 AM/)).toBeInTheDocument();
172+
expect(screen.getByText(/ 10:00/)).toBeInTheDocument();
173173

174174
expect(screen.getByText("Calendar")).toBeInTheDocument();
175175
});
@@ -1719,6 +1719,9 @@ describe("Event Full Display", () => {
17191719

17201720
expect(screen.getByDisplayValue("Test Event")).toBeInTheDocument();
17211721

1722+
// Expand to show date/time inputs (normal mode shows DateTimeSummary)
1723+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
1724+
17221725
const startDateInput = screen.getByTestId("start-date-input");
17231726
const startTimeInput = screen.getByTestId("start-time-input");
17241727
const endTimeInput = screen.getByTestId("end-time-input");
@@ -1804,6 +1807,7 @@ describe("Event Full Display", () => {
18041807
preloadedState
18051808
);
18061809

1810+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
18071811
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
18081812
fireEvent.click(allDayCheckbox);
18091813
expect(allDayCheckbox).toBeChecked();
@@ -1878,6 +1882,7 @@ describe("Event Full Display", () => {
18781882
)
18791883
);
18801884

1885+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
18811886
const calendarSelect = screen.getByLabelText("event.form.calendar");
18821887
await act(async () => fireEvent.mouseDown(calendarSelect));
18831888

@@ -1947,9 +1952,9 @@ describe("Event Full Display", () => {
19471952
stateWithTimezone
19481953
);
19491954

1955+
// Expand to show timezone selector (normal mode hides it)
1956+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
19501957
// The timezone select should have Asia/Bangkok selected
1951-
// Since the component uses formatLocalDateTime, the displayed time will be in local format
1952-
// but the timezone selector should show Asia/Bangkok
19531958
const timeZone = screen.getByDisplayValue(/Asia\/Bangkok/i);
19541959
expect(timeZone).toBeInTheDocument();
19551960
});

__test__/features/Events/EventModal.test.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ describe("EventPopover", () => {
124124
});
125125
expect(addDescriptionButton).toBeInTheDocument();
126126

127-
const calendarSelect = screen.getByRole("combobox", { name: /calendar/i });
128-
expect(calendarSelect).toBeInTheDocument();
127+
// In normal mode calendar is a SectionPreviewRow (button), not combobox
128+
expect(
129+
screen.getByRole("button", { name: "Calendar 1" })
130+
).toBeInTheDocument();
129131

130132
// Check button
131133
expect(
@@ -154,7 +156,8 @@ describe("EventPopover", () => {
154156
allDay: false,
155157
} as unknown as DateSelectArg);
156158

157-
// MUI DatePicker/TimePicker values are stored differently - just check elements exist
159+
// Expand to show date/time inputs (normal mode shows DateTimeSummary)
160+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
158161
expect(screen.getByTestId("start-date-input")).toBeInTheDocument();
159162
expect(screen.getByTestId("start-time-input")).toBeInTheDocument();
160163
});
@@ -179,6 +182,10 @@ describe("EventPopover", () => {
179182
"Event Description"
180183
);
181184

185+
// Expand location section (normal mode shows SectionPreviewRow)
186+
fireEvent.click(
187+
screen.getByRole("button", { name: "event.form.locationPlaceholder" })
188+
);
182189
fireEvent.change(screen.getByLabelText("event.form.location"), {
183190
target: { value: "Conference Room" },
184191
});
@@ -190,13 +197,14 @@ describe("EventPopover", () => {
190197
it("changes selected calendar", async () => {
191198
renderPopover();
192199

200+
// Expand to show calendar combobox (normal mode shows SectionPreviewRow)
201+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
193202
const select = screen.getByLabelText("event.form.calendar");
194203
fireEvent.mouseDown(select); // Open menu
195204

196205
const option = await screen.findByText("Calendar 2");
197206
fireEvent.click(option);
198207

199-
// Find the calendar combobox specifically by its aria-labelledby
200208
const calendarSelect = screen.getByRole("combobox", { name: /Calendar/i });
201209
expect(calendarSelect).toHaveTextContent("Calendar 2");
202210
});
@@ -290,6 +298,9 @@ describe("EventPopover", () => {
290298
fireEvent.change(screen.getByLabelText("event.form.description"), {
291299
target: { value: newEvent.description },
292300
});
301+
fireEvent.click(
302+
screen.getByRole("button", { name: "event.form.locationPlaceholder" })
303+
);
293304
fireEvent.change(screen.getByLabelText("event.form.location"), {
294305
target: { value: newEvent.location },
295306
});
@@ -338,10 +349,11 @@ describe("EventPopover", () => {
338349

339350
it("BUGFIX: Prefill Calendar field", async () => {
340351
renderPopover();
352+
// In normal mode calendar is a SectionPreviewRow (button) with calendar name
341353
await waitFor(() =>
342-
expect(screen.getByLabelText("event.form.calendar")).toHaveTextContent(
343-
"Calendar 1"
344-
)
354+
expect(
355+
screen.getByRole("button", { name: "Calendar 1" })
356+
).toHaveTextContent("Calendar 1")
345357
);
346358
});
347359

@@ -357,6 +369,9 @@ describe("EventPopover", () => {
357369
} as unknown as DateSelectArg;
358370

359371
renderPopover(selectedRange);
372+
fireEvent.click(
373+
screen.getByRole("button", { name: "common.moreOptions" })
374+
);
360375

361376
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
362377
await waitFor(() => {
@@ -375,6 +390,9 @@ describe("EventPopover", () => {
375390
} as unknown as DateSelectArg;
376391

377392
renderPopover(selectedRange);
393+
fireEvent.click(
394+
screen.getByRole("button", { name: "common.moreOptions" })
395+
);
378396

379397
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
380398
await waitFor(() => {
@@ -403,6 +421,9 @@ describe("EventPopover", () => {
403421
} as unknown as DateSelectArg;
404422

405423
renderPopover(selectedRange);
424+
fireEvent.click(
425+
screen.getByRole("button", { name: "common.moreOptions" })
426+
);
406427

407428
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
408429
await waitFor(() => {
@@ -427,6 +448,9 @@ describe("EventPopover", () => {
427448
} as unknown as DateSelectArg;
428449

429450
renderPopover(selectedRange);
451+
fireEvent.click(
452+
screen.getByRole("button", { name: "common.moreOptions" })
453+
);
430454

431455
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
432456
await waitFor(() => {
@@ -451,6 +475,9 @@ describe("EventPopover", () => {
451475
} as unknown as DateSelectArg;
452476

453477
renderPopover(selectedRange);
478+
fireEvent.click(
479+
screen.getByRole("button", { name: "common.moreOptions" })
480+
);
454481

455482
const allDayCheckbox = screen.getByLabelText("event.form.allDay");
456483
await waitFor(() => {

__test__/features/Events/EventRepetition.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,8 @@ describe("Event URL handling for recurring events", () => {
11761176
)
11771177
);
11781178

1179-
// Change calendar
1179+
// Expand to show calendar combobox (normal mode shows SectionPreviewRow)
1180+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
11801181
fireEvent.mouseDown(screen.getByLabelText("event.form.calendar"));
11811182
const option = await screen.findByText("Calendar 2");
11821183
fireEvent.click(option);

__test__/features/Events/EventUpdateModal.recurring.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ describe("EventUpdateModal - Recurring Event 'Edit All' Handling", () => {
129129
screen.queryByDisplayValue("Modified Instance Title")
130130
).not.toBeInTheDocument();
131131

132+
// Expand more options to show timezone (normal mode shows summary first)
133+
fireEvent.click(
134+
screen.getByRole("button", { name: "common.moreOptions" })
135+
);
132136
// Verify timezone dropdown shows master timezone
133137
await waitFor(() => {
134138
expect(screen.getByDisplayValue(/New York/i)).toBeDefined();
@@ -493,8 +497,12 @@ describe("EventUpdateModal - Recurring Event 'Edit All' Handling", () => {
493497
expect(screen.getByDisplayValue("Daily Standup")).toBeInTheDocument();
494498
});
495499

500+
// Expand more options to show date/time inputs (normal mode shows DateTimeSummary first)
501+
fireEvent.click(
502+
screen.getByRole("button", { name: "common.moreOptions" })
503+
);
504+
const input = await waitFor(() => screen.getByTestId("start-time-input"));
496505
// Change time to 2:00 PM (14:00)
497-
const input = screen.getByTestId("start-time-input");
498506
await userEvent.click(input);
499507
await userEvent.clear(input);
500508
await userEvent.type(input, "14:00{enter}");

__test__/features/Events/EventUpdateModal.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ describe("EventUpdateModal Timezone Handling", () => {
9393
const titleInput = screen.getByDisplayValue("Timezone Event");
9494
expect(titleInput).toBeInTheDocument();
9595

96+
// Expand to show date/time inputs (normal mode shows DateTimeSummary)
97+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
98+
9699
// Verify the start date and time inputs exist
97100
await waitFor(() => {
98101
const startDateInput = screen.getByTestId("start-date-input");
@@ -282,6 +285,7 @@ describe("EventUpdateModal Recurring to Non-Recurring Conversion", () => {
282285
expect(mockGetMasterEvent).toHaveBeenCalled();
283286
});
284287

288+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
285289
// Wait for the repeat checkbox to be checked (indicating form is initialized)
286290
const repeatCheckbox = await waitFor(() => {
287291
const checkbox = screen.getByLabelText("event.form.repeat");
@@ -414,6 +418,7 @@ describe("EventUpdateModal Recurring to Non-Recurring Conversion", () => {
414418
expect(screen.getByDisplayValue("Recurring Meeting")).toBeInTheDocument();
415419
});
416420

421+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
417422
// Wait for repeat checkbox to be checked
418423
const repeatCheckbox = await waitFor(() => {
419424
const checkbox = screen.getByLabelText("event.form.repeat");
@@ -546,6 +551,7 @@ describe("EventUpdateModal Recurring to Non-Recurring Conversion", () => {
546551
expect(screen.getByDisplayValue("Recurring Meeting")).toBeInTheDocument();
547552
});
548553

554+
fireEvent.click(screen.getByRole("button", { name: "common.moreOptions" }));
549555
// Uncheck repeat and save
550556
const repeatCheckbox = screen.getByLabelText("event.form.repeat");
551557

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@fullcalendar/moment-timezone": "^6.1.19",
1313
"@fullcalendar/react": "^6.1.17",
1414
"@fullcalendar/timegrid": "^6.1.17",
15-
"@linagora/twake-mui": "1.1.4",
15+
"@linagora/twake-mui": "1.1.8",
1616
"@lottiefiles/dotlottie-react": "^0.17.13",
1717
"@mui/icons-material": "^7.1.2",
1818
"@mui/material": "^7.1.2",

0 commit comments

Comments
 (0)