fix(docs-infra): initialize events arrays in EventsComponent (#47458)

initialize the events fields of the EventsComponent so that
they are always defined

PR Close #47458
This commit is contained in:
dario-piotrowicz
2022-09-15 22:58:54 +01:00
committed by Pawel Kozlowski
parent 1f88df0f8f
commit 5fb7ae20a2
3 changed files with 5 additions and 5 deletions
@@ -1,5 +1,5 @@
<h2>Where we'll be presenting:</h2>
<ng-container [ngSwitch]="!!upcomingEvents?.length">
<ng-container [ngSwitch]="!!upcomingEvents.length">
<div *ngSwitchCase="false">
<p>We don't have any upcoming speaking engagements at the moment.</p>
<p>
@@ -20,11 +20,11 @@ describe('EventsComponent', () => {
});
it('should have no pastEvents when first created', () => {
expect(component.pastEvents).toBeUndefined();
expect(component.pastEvents.length).toEqual(0);
});
it('should have no upcoming when first created', () => {
expect(component.upcomingEvents).toBeUndefined();
expect(component.upcomingEvents.length).toEqual(0);
});
describe('ngOnInit()', () => {
@@ -18,8 +18,8 @@ export interface AngularEvent {
})
export class EventsComponent implements OnInit {
pastEvents: AngularEvent[];
upcomingEvents: AngularEvent[];
pastEvents: AngularEvent[] = [];
upcomingEvents: AngularEvent[] = [];
constructor(private eventsService: EventsService) { }