2025-09-25 23:38:17 +02:00
|
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
|
|
|
import { AllDayManager } from '../../src/managers/AllDayManager';
|
|
|
|
|
import { setupMockDOM, createMockEvent } from '../helpers/dom-helpers';
|
|
|
|
|
|
2025-09-26 17:47:02 +02:00
|
|
|
describe('AllDayManager - Manager Functionality', () => {
|
2025-09-25 23:38:17 +02:00
|
|
|
let allDayManager: AllDayManager;
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
setupMockDOM();
|
|
|
|
|
allDayManager = new AllDayManager();
|
|
|
|
|
});
|
|
|
|
|
|
2025-09-26 17:47:02 +02:00
|
|
|
describe('Layout Calculation Integration', () => {
|
|
|
|
|
it('should delegate layout calculation to AllDayLayoutEngine', () => {
|
|
|
|
|
// Simple integration test to verify manager uses the layout engine correctly
|
|
|
|
|
const event = createMockEvent('test', 'Test Event', '2024-09-24', '2024-09-24');
|
2025-09-25 23:44:13 +02:00
|
|
|
const weekDates = ['2024-09-22', '2024-09-23', '2024-09-24', '2024-09-25', '2024-09-26'];
|
|
|
|
|
|
2025-09-26 17:47:02 +02:00
|
|
|
const layouts = allDayManager.calculateAllDayEventsLayout([event], weekDates);
|
2025-09-25 23:44:13 +02:00
|
|
|
|
2025-09-28 13:45:15 +02:00
|
|
|
expect(layouts.length).toBe(1);
|
|
|
|
|
expect(layouts[0].calenderEvent.id).toBe('test');
|
|
|
|
|
expect(layouts[0].startColumn).toBe(3); // Sept 24 is column 3
|
|
|
|
|
expect(layouts[0].row).toBe(1);
|
2025-09-25 23:38:17 +02:00
|
|
|
});
|
|
|
|
|
|
2025-09-26 17:47:02 +02:00
|
|
|
it('should handle empty event list', () => {
|
2025-09-25 23:44:13 +02:00
|
|
|
const weekDates = ['2024-09-22', '2024-09-23', '2024-09-24', '2024-09-25', '2024-09-26'];
|
2025-09-26 17:47:02 +02:00
|
|
|
const layouts = allDayManager.calculateAllDayEventsLayout([], weekDates);
|
2025-09-25 23:44:13 +02:00
|
|
|
|
2025-09-28 13:45:15 +02:00
|
|
|
expect(layouts.length).toBe(0);
|
2025-09-25 23:38:17 +02:00
|
|
|
});
|
|
|
|
|
|
2025-09-26 17:47:02 +02:00
|
|
|
it('should handle empty week dates', () => {
|
|
|
|
|
const event = createMockEvent('test', 'Test Event', '2024-09-24', '2024-09-24');
|
|
|
|
|
const layouts = allDayManager.calculateAllDayEventsLayout([event], []);
|
2025-09-25 23:44:13 +02:00
|
|
|
|
2025-09-28 13:45:15 +02:00
|
|
|
expect(layouts.length).toBe(0);
|
2025-09-25 23:38:17 +02:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|