fix: update tests for new Menubar UI implementation

- Remove refresh button test from Calendar.test.tsx
- Update Menubar tests to pass required props (calendarRef, onRefresh, currentDate)
- Update Calendar tests to pass calendarRef prop
- Remove outdated test cases from MiniCalendarColor.test.tsx that tested old headerToolbar
- Format code with prettier
This commit is contained in:
lenhanphung
2025-09-24 12:41:15 +07:00
parent 12dc0d7fe1
commit 0f74ddfc27
8 changed files with 240 additions and 281 deletions
+4 -3
View File
@@ -16,17 +16,18 @@ export default function CalendarLayout() {
const calendarRef = useRef<any>(null);
const dispatch = useAppDispatch();
const selectedCalendars = useAppSelector((state) => state.calendars.list);
const userId = useAppSelector((state) => state.user.userData?.openpaasId) ?? "";
const userId =
useAppSelector((state) => state.user.userData?.openpaasId) ?? "";
const [currentDate, setCurrentDate] = useState<Date>(new Date());
const handleRefresh = async () => {
await dispatch(getCalendarsListAsync());
// Get current calendar range
if (calendarRef.current) {
const view = calendarRef.current.getApi().view;
const calendarRange = getCalendarRange(view.activeStart);
// Refresh events for selected calendars
Object.keys(selectedCalendars).forEach((id) => {
if (id.split("/")[0] === userId) {