Skip to content

Commit 5fb7ae2

Browse files
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
1 parent 1f88df0 commit 5fb7ae2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

aio/src/app/custom-elements/events/events.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h2>Where we'll be presenting:</h2>
2-
<ng-container [ngSwitch]="!!upcomingEvents?.length">
2+
<ng-container [ngSwitch]="!!upcomingEvents.length">
33
<div *ngSwitchCase="false">
44
<p>We don't have any upcoming speaking engagements at the moment.</p>
55
<p>

aio/src/app/custom-elements/events/events.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ describe('EventsComponent', () => {
2020
});
2121

2222
it('should have no pastEvents when first created', () => {
23-
expect(component.pastEvents).toBeUndefined();
23+
expect(component.pastEvents.length).toEqual(0);
2424
});
2525

2626
it('should have no upcoming when first created', () => {
27-
expect(component.upcomingEvents).toBeUndefined();
27+
expect(component.upcomingEvents.length).toEqual(0);
2828
});
2929

3030
describe('ngOnInit()', () => {

aio/src/app/custom-elements/events/events.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export interface AngularEvent {
1818
})
1919
export class EventsComponent implements OnInit {
2020

21-
pastEvents: AngularEvent[];
22-
upcomingEvents: AngularEvent[];
21+
pastEvents: AngularEvent[] = [];
22+
upcomingEvents: AngularEvent[] = [];
2323

2424
constructor(private eventsService: EventsService) { }
2525

0 commit comments

Comments
 (0)