Adds comprehensive tests for the AllDayManager, covering various overlap scenarios. Tests ensure correct row and column assignments for all-day events based on date ranges and overlaps. Replaces individual event layout calculation with batch calculation for improved performance and test coverage.
40 lines
No EOL
1.1 KiB
TypeScript
40 lines
No EOL
1.1 KiB
TypeScript
import { CalendarEvent } from '../../src/types/CalendarTypes';
|
|
|
|
/**
|
|
* Setup mock DOM for testing
|
|
*/
|
|
export function setupMockDOM(): void {
|
|
// Create basic DOM structure for testing
|
|
document.body.innerHTML = `
|
|
<div class="swp-calendar-grid" data-current="true">
|
|
<div class="swp-day-header" data-date="2024-09-22"></div>
|
|
<div class="swp-day-header" data-date="2024-09-23"></div>
|
|
<div class="swp-day-header" data-date="2024-09-24"></div>
|
|
<div class="swp-day-header" data-date="2024-09-25"></div>
|
|
<div class="swp-day-header" data-date="2024-09-26"></div>
|
|
</div>
|
|
<swp-calendar-header>
|
|
<swp-allday-container></swp-allday-container>
|
|
</swp-calendar-header>
|
|
`;
|
|
}
|
|
|
|
/**
|
|
* Create mock CalendarEvent for testing
|
|
*/
|
|
export function createMockEvent(
|
|
id: string,
|
|
title: string,
|
|
startDate: string,
|
|
endDate: string
|
|
): CalendarEvent {
|
|
return {
|
|
id,
|
|
title,
|
|
start: new Date(startDate),
|
|
end: new Date(endDate),
|
|
type: 'work',
|
|
allDay: true,
|
|
syncStatus: 'synced'
|
|
};
|
|
} |