Skip to content

Commit a614d6e

Browse files
committed
Fix lint errors
1 parent f684be2 commit a614d6e

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

projects/ng-loading-indicator/src/lib/components/loading-indicator.component.spec.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,46 @@ describe('LoadingIndicatorComponent', () => {
4141
// Check that everything is as expected upon initialization
4242
expect(component.loadingIndicatorModal.visible).toBe(false);
4343
expect(component.loadingMessage).toBeUndefined();
44-
expect(loadingMessageHeader.textContent).toBe("");
44+
expect(loadingMessageHeader.textContent).toBe('');
4545

4646
// Simulate a load start
47-
service.eventLoadStarted.emit("Load Started");
47+
service.eventLoadStarted.emit('Load Started');
4848
fixture.detectChanges();
4949

5050
// Check that the component is visible and shows the proper text
5151
expect(component.loadingIndicatorModal.visible).toBe(true);
52-
expect(component.loadingMessage).toBe("Load Started");
53-
expect(loadingMessageHeader.textContent).toBe("Load Started");
52+
expect(component.loadingMessage).toBe('Load Started');
53+
expect(loadingMessageHeader.textContent).toBe('Load Started');
5454

5555
// Simulate a load end
5656
service.eventLoadEnded.emit();
5757
fixture.detectChanges();
5858

59-
/* Check that the component is no longer visible and that
59+
/* Check that the component is no longer visible and that
6060
the loading text was reset. */
6161
expect(component.loadingIndicatorModal.visible).toBe(false);
6262
expect(component.loadingMessage).toBeNull();
63-
expect(loadingMessageHeader.textContent).toBe("");
64-
})
63+
expect(loadingMessageHeader.textContent).toBe('');
64+
});
6565

6666
it('should properly apply user-provided css classes', () => {
6767
// Test that everything is what we expect it to be upon initialization
6868
expect(component.loadingIndicatorModal.modalClass).toBe('');
6969
expect(component.loadingIndicatorModal.overlayClass).toBe('');
70-
expect(loadingMessageHeader.getAttribute('class')).toBe("loadingMessage ");
71-
expect(spinnerDiv.getAttribute('class')).toBe("spinner ");
70+
expect(loadingMessageHeader.getAttribute('class')).toBe('loadingMessage ');
71+
expect(spinnerDiv.getAttribute('class')).toBe('spinner ');
7272

7373
// Apply custom CSS classes as input properties
74-
component.overlayClass = "testOverlayClass";
75-
component.modalClass = "testModalClass";
76-
component.loadingMessageClass = "testLoadingMessageClass";
77-
component.spinnerClass = "testSpinnerClass";
74+
component.overlayClass = 'testOverlayClass';
75+
component.modalClass = 'testModalClass';
76+
component.loadingMessageClass = 'testLoadingMessageClass';
77+
component.spinnerClass = 'testSpinnerClass';
7878
fixture.detectChanges();
7979

8080
// Ensure that the CSS is properly applied to the DOM and the modal component
81-
expect(component.loadingIndicatorModal.modalClass).toBe("testModalClass");
82-
expect(component.loadingIndicatorModal.overlayClass).toBe("testOverlayClass");
83-
expect(loadingMessageHeader.getAttribute('class')).toBe("loadingMessage testLoadingMessageClass");
84-
expect(spinnerDiv.getAttribute('class')).toBe("spinner testSpinnerClass");
81+
expect(component.loadingIndicatorModal.modalClass).toBe('testModalClass');
82+
expect(component.loadingIndicatorModal.overlayClass).toBe('testOverlayClass');
83+
expect(loadingMessageHeader.getAttribute('class')).toBe('loadingMessage testLoadingMessageClass');
84+
expect(spinnerDiv.getAttribute('class')).toBe('spinner testSpinnerClass');
8585
});
8686
});

projects/ng-loading-indicator/src/lib/components/loading-indicator.component.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ModalWindowComponent } from '@browninglogic/ng-modal';
1515
styleUrls: ['./loading-indicator.component.css']
1616
})
1717
export class LoadingIndicatorComponent implements OnInit, OnDestroy {
18-
constructor(private loadingIndicatorService : LoadingIndicatorService) {}
18+
constructor(private loadingIndicatorService: LoadingIndicatorService) {}
1919
/** Custom CSS class(es) to apply to the modal*/
2020
@Input() modalClass = '';
2121
/** Custom CSS class(es) to apply to the overlay*/
@@ -24,13 +24,13 @@ export class LoadingIndicatorComponent implements OnInit, OnDestroy {
2424
@Input() loadingMessageClass = '';
2525
/** Custom CSS class(es) to apply to the spinner*/
2626
@Input() spinnerClass = '';
27-
@ViewChild('loadingIndicatorModal') loadingIndicatorModal : ModalWindowComponent;
28-
private _loadingMessage : string;
29-
private subLoadStarted : Subscription;
30-
private subLoadEnded : Subscription;
27+
@ViewChild('loadingIndicatorModal') loadingIndicatorModal: ModalWindowComponent;
28+
private _loadingMessage: string;
29+
private subLoadStarted: Subscription;
30+
private subLoadEnded: Subscription;
3131

3232
/** Loading message to bind to the loading modal window */
33-
public get loadingMessage() : string {
33+
public get loadingMessage(): string {
3434
return this._loadingMessage;
3535
}
3636

@@ -46,7 +46,7 @@ export class LoadingIndicatorComponent implements OnInit, OnDestroy {
4646
}
4747

4848
/** Show the loading indicator and set the provided loading message for template binding */
49-
private onLoadStarted(loadingMessage : string) {
49+
private onLoadStarted(loadingMessage: string) {
5050
this._loadingMessage = loadingMessage;
5151
this.loadingIndicatorModal.show();
5252
}

projects/ng-loading-indicator/src/lib/services/loading-indicator.service.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing';
22
import { LoadingIndicatorService } from './loading-indicator.service';
33

44
describe('LoadingIndicatorService', () => {
5-
let loadingIndicatorService : LoadingIndicatorService;
5+
let loadingIndicatorService: LoadingIndicatorService;
66
let loadStartedSpy: jasmine.Spy;
77
let loadEndedSpy: jasmine.Spy;
88

@@ -19,10 +19,10 @@ describe('LoadingIndicatorService', () => {
1919
});
2020

2121
it('should properly emit load start event', () => {
22-
loadingIndicatorService.showLoadingIndicator("Showing Indicator");
22+
loadingIndicatorService.showLoadingIndicator('Showing Indicator');
2323

2424
expect(loadStartedSpy).toHaveBeenCalledTimes(1);
25-
expect(loadStartedSpy).toHaveBeenCalledWith("Showing Indicator");
25+
expect(loadStartedSpy).toHaveBeenCalledWith('Showing Indicator');
2626
});
2727

2828
it('should properly emit load ended event', () => {

projects/ng-loading-indicator/src/lib/services/loading-indicator.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export class LoadingIndicatorService {
1313
/** Event signifying that the load ended */
1414
@Output() eventLoadEnded = new EventEmitter();
1515

16-
/** Notifies the loading indicator component to show a
16+
/** Notifies the loading indicator component to show a
1717
* loading indicator with the specified text */
18-
public showLoadingIndicator(loadingMessage : string = "Loading") {
18+
public showLoadingIndicator(loadingMessage: string = 'Loading') {
1919
this.eventLoadStarted.emit(loadingMessage);
2020
}
2121

src/app/app.component.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import { LoadingIndicatorService} from 'ng-loading-indicator'
2+
import { LoadingIndicatorService } from 'ng-loading-indicator';
33
import { timer } from 'rxjs';
44
import { tap, switchMap, finalize } from 'rxjs/operators';
55

@@ -25,14 +25,14 @@ export class AppComponent {
2525

2626
public showDifferentMessages(): void {
2727
// Show the loading indicator with custom loading message text
28-
this.loadingIndicatorService.showLoadingIndicator("Fetching the first thing");
28+
this.loadingIndicatorService.showLoadingIndicator('Fetching the first thing');
2929
// Simulate a two second API call
3030
timer(2000).pipe(
3131
// Change the loading message text between the first and second simulated API call
32-
tap(() => this.loadingIndicatorService.showLoadingIndicator("Fetching something else")),
32+
tap(() => this.loadingIndicatorService.showLoadingIndicator('Fetching something else')),
3333
// Simulate a second two second API call
3434
switchMap(() => timer(2000)),
35-
/* Hide the loading indicator upon completion of both of the simulated API
35+
/* Hide the loading indicator upon completion of both of the simulated API
3636
calls, regardless of whether the operation succeeded or failed. */
3737
finalize(() => this.loadingIndicatorService.hideLoadingIndicator())
3838
).subscribe();

0 commit comments

Comments
 (0)