Skip to content

Commit 8f4ffaa

Browse files
committed
Change entryComponent comparison
1 parent 010516a commit 8f4ffaa

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/lib/components/ng-http-loader.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class NgHttpLoaderComponent implements OnDestroy, OnInit {
7777
}
7878

7979
private nullifySpinnerIfEntryComponentIsDefined(): void {
80-
if (null != this.entryComponent) {
80+
if (this.entryComponent) {
8181
this.spinner = null;
8282
}
8383
}

src/test/components/ng-http-loader.component.outlet.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,37 @@ describe('NgHttpLoaderComponentOutlet', () => {
6363

6464
expect(component.spinner).toBeNull();
6565
});
66+
67+
it('should correctly check [entryComponent] with empty string', () => {
68+
spyOnProperty(component, 'isVisible$')
69+
.and.returnValue(new BehaviorSubject(true).asObservable());
70+
71+
component.spinner = 'whatever';
72+
component.entryComponent = '';
73+
fixture.detectChanges();
74+
75+
expect(component.spinner).toBe('whatever');
76+
});
77+
78+
it('should correctly check [entryComponent] with null', () => {
79+
spyOnProperty(component, 'isVisible$')
80+
.and.returnValue(new BehaviorSubject(true).asObservable());
81+
82+
component.spinner = 'whatever';
83+
component.entryComponent = null;
84+
fixture.detectChanges();
85+
86+
expect(component.spinner).toBe('whatever');
87+
});
88+
89+
it('should correctly check [entryComponent] with undefined', () => {
90+
spyOnProperty(component, 'isVisible$')
91+
.and.returnValue(new BehaviorSubject(true).asObservable());
92+
93+
component.spinner = 'whatever';
94+
component.entryComponent = undefined;
95+
fixture.detectChanges();
96+
97+
expect(component.spinner).toBe('whatever');
98+
});
6699
});

0 commit comments

Comments
 (0)