Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CalendarDatePipe } from '../../../common/calendar-date/calendar-date.pi
let-dragEnter="dragEnter"
>
<div class="cal-day-headers" role="row">
@for (day of days; track day.date.toISOString()) {
@for (day of days; track $index) {
<div
class="cal-header"
[class.cal-past]="day.isPast"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3500,4 +3500,25 @@ describe('calendarWeekView component', () => {
expect(eventDropped).to.have.been.calledOnce;
});
});

it('should not produce duplicate track keys when daysInWeek spans a DST transition', () => {
const fixture: ComponentFixture<CalendarWeekViewComponent> =
TestBed.createComponent(CalendarWeekViewComponent);
fixture.componentInstance.viewDate = new Date('2024-01-01');
fixture.componentInstance.daysInWeek = 140;
fixture.componentInstance.events = [];
fixture.componentInstance.ngOnChanges({
daysInWeek: {},
events: {},
viewDate: {},
});
fixture.detectChanges();
expect(
fixture.nativeElement.querySelectorAll('.cal-header').length,
).to.equal(140);
expect(
fixture.nativeElement.querySelectorAll('.cal-time-events .cal-day-column')
.length,
).to.equal(140);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
<div class="cal-time-label-column">
<ng-container *ngTemplateOutlet="allDayEventsLabelTemplate" />
</div>
@for (day of days; track day.date.toISOString()) {
@for (day of days; track $index) {
<div
class="cal-day-column"
mwlDroppable
Expand Down Expand Up @@ -242,14 +242,11 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
<div class="cal-time-label-column">
@for (
hour of view.hourColumns[0].hours;
track hour.segments[0].date.toISOString();
track $index;
let odd = $odd
) {
<div class="cal-hour" [class.cal-hour-odd]="odd">
@for (
segment of hour.segments;
track segment.date.toISOString()
) {
@for (segment of hour.segments; track $index) {
<mwl-calendar-week-view-hour-segment
[style.height.px]="hourSegmentHeight"
[segment]="segment"
Expand All @@ -269,12 +266,7 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
[class.cal-resize-active]="timeEventResizes.size > 0"
#dayColumns
>
@for (
column of view.hourColumns;
track column.hours[0]
? column.hours[0].segments[0].date.toISOString()
: column
) {
@for (column of view.hourColumns; track $index) {
<div class="cal-day-column">
<mwl-calendar-week-view-current-time-marker
[columnDate]="column.date"
Expand Down Expand Up @@ -409,16 +401,9 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
</div>
}
</div>
@for (
hour of column.hours;
track hour.segments[0].date.toISOString();
let odd = $odd
) {
@for (hour of column.hours; track $index; let odd = $odd) {
<div class="cal-hour" [class.cal-hour-odd]="odd">
@for (
segment of hour.segments;
track segment.date.toISOString()
) {
@for (segment of hour.segments; track $index) {
<mwl-calendar-week-view-hour-segment
[style.height.px]="hourSegmentHeight"
[segment]="segment"
Expand Down