mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Pawel Kozlowski
parent
1f88df0f8f
commit
5fb7ae20a2
@@ -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) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user