Skip to content

Commit 1185d27

Browse files
committed
feat: expose the full week view on the beforeViewRender output
Closes #632
1 parent df339b9 commit 1185d27

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/modules/week/calendar-week-view.component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ export interface WeekViewAllDayEventResize {
5959
edge: string;
6060
}
6161

62-
export interface CalendarWeekViewBeforeRenderEvent {
62+
export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
6363
header: WeekDay[];
64-
period: ViewPeriod;
6564
}
6665

6766
/**
@@ -901,7 +900,7 @@ export class CalendarWeekViewComponent implements OnChanges, OnInit, OnDestroy {
901900
if (this.days && this.view) {
902901
this.beforeViewRender.emit({
903902
header: this.days,
904-
period: this.view.period
903+
...this.view
905904
});
906905
}
907906
}

test/calendar-week-view.component.spec.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -1109,16 +1109,12 @@ describe('calendarWeekView component', () => {
11091109
fixture.componentInstance.ngOnInit();
11101110
fixture.componentInstance.viewDate = new Date('2016-06-27');
11111111
fixture.componentInstance.ngOnChanges({ viewDate: {} });
1112-
expect(
1113-
beforeViewRenderCalled.getCall(0).args[0].period.start
1114-
).to.be.an.instanceOf(Date);
1115-
expect(
1116-
beforeViewRenderCalled.getCall(0).args[0].period.end
1117-
).to.be.an.instanceOf(Date);
1118-
expect(
1119-
Array.isArray(beforeViewRenderCalled.getCall(0).args[0].period.events)
1120-
).to.equal(true);
1121-
fixture.destroy();
1112+
const data = beforeViewRenderCalled.getCall(0).args[0];
1113+
expect(data.period.start).to.be.an.instanceOf(Date);
1114+
expect(data.period.end).to.be.an.instanceOf(Date);
1115+
expect(Array.isArray(data.period.events)).to.equal(true);
1116+
expect(Array.isArray(data.allDayEventRows)).to.be.true;
1117+
expect(Array.isArray(data.hourColumns)).to.be.true;
11221118
});
11231119

11241120
it('should add event actions to each event', () => {

0 commit comments

Comments
 (0)