@@ -13,9 +13,9 @@ import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angul
1313import { By } from '@angular/platform-browser' ;
1414import { forkJoin , Observable , of , Subscription } from 'rxjs' ;
1515import { NgHttpLoaderComponent } from '../../lib/components/ng-http-loader.component' ;
16+ import { pendingRequestsInterceptor$ } from '../../lib/services/pending-requests-interceptor' ;
1617import { SpinnerVisibilityService } from '../../lib/services/spinner-visibility.service' ;
1718import { Spinkit } from '../../lib/spinkits' ;
18- import { pendingRequestsInterceptor$ } from "../../lib/services/pending-requests-interceptor" ;
1919
2020describe ( 'NgHttpLoaderComponent' , ( ) => {
2121 let component : NgHttpLoaderComponent ;
@@ -67,7 +67,7 @@ describe('NgHttpLoaderComponent', () => {
6767
6868 it ( 'should not set the colored class if background-color is defined' , ( ) => {
6969 component . isVisible$ = of ( true ) ;
70- component . backgroundColor . set ( '#ff0000' ) ;
70+ fixture . componentRef . setInput ( 'backgroundColor' , '#ff0000' ) ;
7171 fixture . detectChanges ( ) ;
7272
7373 const element = fixture
@@ -101,7 +101,7 @@ describe('NgHttpLoaderComponent', () => {
101101
102102 it ( 'should allow us to specify a custom background-color' , ( ) => {
103103 component . isVisible$ = of ( true ) ;
104- component . backgroundColor . set ( '#ff0000' ) ;
104+ fixture . componentRef . setInput ( 'backgroundColor' , '#ff0000' ) ;
105105 fixture . detectChanges ( ) ;
106106
107107 const element = fixture
@@ -271,7 +271,7 @@ describe('NgHttpLoaderComponent', () => {
271271 } ) ) ;
272272
273273 it ( 'should correctly handle the debounce delay for a single HTTP request' , fakeAsync ( ( ) => {
274- component . debounceDelay . set ( 2000 ) ;
274+ fixture . componentRef . setInput ( 'debounceDelay' , 2000 ) ;
275275 http . get ( '/fake' ) . subscribe ( ) ;
276276
277277 // the HTTP request is pending for 1 second now
@@ -297,7 +297,7 @@ describe('NgHttpLoaderComponent', () => {
297297 } ) ) ;
298298
299299 it ( 'should correctly handle the debounce delay for HTTP request finished before spinner should be shown' , fakeAsync ( ( ) => {
300- component . debounceDelay . set ( 2000 ) ;
300+ fixture . componentRef . setInput ( 'debounceDelay' , 2000 ) ;
301301 http . get ( '/fake' ) . subscribe ( ) ;
302302
303303 // the HTTP request is pending for 1 second now
@@ -311,7 +311,7 @@ describe('NgHttpLoaderComponent', () => {
311311 } ) ) ;
312312
313313 it ( 'should correctly handle the debounce delay for HTTP sequential requests finished before spinner should be shown' , fakeAsync ( ( ) => {
314- component . debounceDelay . set ( 5000 ) ;
314+ fixture . componentRef . setInput ( 'debounceDelay' , 5000 ) ;
315315 http . get ( '/fake' ) . subscribe ( ) ;
316316
317317 // the first HTTP request is pending for 1 second now
@@ -339,7 +339,7 @@ describe('NgHttpLoaderComponent', () => {
339339 } ) ) ;
340340
341341 it ( 'should correctly handle the debounce delay for HTTP parallel requests finished before spinner should be shown' , fakeAsync ( ( ) => {
342- component . debounceDelay . set ( 5000 ) ;
342+ fixture . componentRef . setInput ( 'debounceDelay' , 5000 ) ;
343343 http . get ( '/fake' ) . subscribe ( ) ;
344344 http . get ( '/fake2' ) . subscribe ( ) ;
345345
@@ -365,7 +365,7 @@ describe('NgHttpLoaderComponent', () => {
365365 } ) ) ;
366366
367367 it ( 'should correctly handle the debounce delay for multiple HTTP requests' , fakeAsync ( ( ) => {
368- component . debounceDelay . set ( 2000 ) ;
368+ fixture . componentRef . setInput ( 'debounceDelay' , 2000 ) ;
369369 const runQuery$ = ( url : string ) : Observable < unknown > => http . get ( url ) ;
370370 forkJoin ( [ runQuery$ ( '/fake' ) , runQuery$ ( '/fake2' ) ] ) . subscribe ( ) ;
371371 const firstRequest = httpMock . expectOne ( '/fake' ) ;
@@ -448,7 +448,7 @@ describe('NgHttpLoaderComponent', () => {
448448 } ) ) ;
449449
450450 it ( 'should correctly handle the minimum spinner duration for a single HTTP request' , fakeAsync ( ( ) => {
451- component . minDuration . set ( 5000 ) ;
451+ fixture . componentRef . setInput ( 'minDuration' , 5000 ) ;
452452 http . get ( '/fake' ) . subscribe ( ) ;
453453
454454 // the HTTP request is pending for 1 second now
@@ -482,7 +482,7 @@ describe('NgHttpLoaderComponent', () => {
482482 } ) ) ;
483483
484484 it ( 'should correctly handle the extra spinner duration for a single HTTP request' , fakeAsync ( ( ) => {
485- component . extraDuration . set ( 5000 ) ;
485+ fixture . componentRef . setInput ( 'extraDuration' , 5000 ) ;
486486 http . get ( '/fake' ) . subscribe ( ) ;
487487
488488 // the HTTP request is pending for 1 second now
@@ -508,7 +508,7 @@ describe('NgHttpLoaderComponent', () => {
508508 } ) ) ;
509509
510510 it ( 'should correctly handle the minimum spinner duration for multiple HTTP requests' , fakeAsync ( ( ) => {
511- component . minDuration . set ( 5000 ) ;
511+ fixture . componentRef . setInput ( 'minDuration' , 5000 ) ;
512512 const runQuery$ = ( url : string ) : Observable < unknown > => http . get ( url ) ;
513513 forkJoin ( [ runQuery$ ( '/fake' ) , runQuery$ ( '/fake2' ) ] ) . subscribe ( ) ;
514514 const firstRequest = httpMock . expectOne ( '/fake' ) ;
@@ -546,7 +546,7 @@ describe('NgHttpLoaderComponent', () => {
546546 } ) ) ;
547547
548548 it ( 'should correctly handle the extra spinner duration for multiple HTTP requests' , fakeAsync ( ( ) => {
549- component . extraDuration . set ( 5000 ) ;
549+ fixture . componentRef . setInput ( 'extraDuration' , 5000 ) ;
550550 const runQuery$ = ( url : string ) : Observable < unknown > => http . get ( url ) ;
551551 forkJoin ( [ runQuery$ ( '/fake' ) , runQuery$ ( '/fake2' ) ] ) . subscribe ( ) ;
552552 const firstRequest = httpMock . expectOne ( '/fake' ) ;
@@ -588,7 +588,7 @@ describe('NgHttpLoaderComponent', () => {
588588 } ) ) ;
589589
590590 it ( 'should correctly handle the minimum spinner duration for multiple HTTP requests ran one after the others' , fakeAsync ( ( ) => {
591- component . minDuration . set ( 2000 ) ;
591+ fixture . componentRef . setInput ( 'minDuration' , 2000 ) ;
592592 http . get ( '/fake' ) . subscribe ( ) ;
593593 const firstRequest = httpMock . expectOne ( '/fake' ) ;
594594
@@ -620,7 +620,7 @@ describe('NgHttpLoaderComponent', () => {
620620 } ) ) ;
621621
622622 it ( 'should handle the extra spinner duration for multiple HTTP requests ran one after the others' , fakeAsync ( ( ) => {
623- component . extraDuration . set ( 10 ) ;
623+ fixture . componentRef . setInput ( 'extraDuration' , 10 ) ;
624624 const runQuery$ = ( url : string ) : Observable < unknown > => http . get ( url ) ;
625625 runQuery$ ( '/fake' ) . subscribe ( ) ;
626626 const firstRequest = httpMock . expectOne ( '/fake' ) ;
@@ -648,7 +648,7 @@ describe('NgHttpLoaderComponent', () => {
648648 } ) ) ;
649649
650650 it ( 'should still display the spinner when the minimum duration is inferior to the HTTP request duration' , fakeAsync ( ( ) => {
651- component . minDuration . set ( 1000 ) ;
651+ fixture . componentRef . setInput ( 'minDuration' , 1000 ) ;
652652 http . get ( '/fake' ) . subscribe ( ) ;
653653
654654 // the HTTP request is pending for 1 second now
@@ -666,7 +666,7 @@ describe('NgHttpLoaderComponent', () => {
666666 } ) ) ;
667667
668668 it ( 'should be possible to set the minimum duration without side effect on manual show/hide' , ( ) => {
669- component . minDuration . set ( 10000 ) ;
669+ fixture . componentRef . setInput ( 'minDuration' , 10000 ) ;
670670 spinner . show ( ) ;
671671 expect ( isVisible ) . toBeTruthy ( ) ;
672672
@@ -675,7 +675,7 @@ describe('NgHttpLoaderComponent', () => {
675675 } ) ;
676676
677677 it ( 'should be possible to set the extra duration without side effect on manual show/hide' , ( ) => {
678- component . extraDuration . set ( 10000 ) ;
678+ fixture . componentRef . setInput ( 'extraDuration' , 10000 ) ;
679679 spinner . show ( ) ;
680680 expect ( isVisible ) . toBeTruthy ( ) ;
681681
@@ -685,8 +685,8 @@ describe('NgHttpLoaderComponent', () => {
685685
686686 it ( 'should be possible to mix debounce delay and minimum duration' , fakeAsync ( ( ) => {
687687 // the spinner should not be visible the first second, then visible for 5 seconds
688- component . minDuration . set ( 5000 ) ;
689- component . debounceDelay . set ( 1000 ) ;
688+ fixture . componentRef . setInput ( 'minDuration' , 5000 ) ;
689+ fixture . componentRef . setInput ( 'debounceDelay' , 1000 ) ;
690690
691691 http . get ( '/fake' ) . subscribe ( ) ;
692692
@@ -718,8 +718,8 @@ describe('NgHttpLoaderComponent', () => {
718718
719719 it ( 'should be possible to mix debounce delay and extra duration' , fakeAsync ( ( ) => {
720720 // the spinner should not be visible the first second, then visible for 5 seconds
721- component . extraDuration . set ( 5000 ) ;
722- component . debounceDelay . set ( 1000 ) ;
721+ fixture . componentRef . setInput ( 'extraDuration' , 5000 ) ;
722+ fixture . componentRef . setInput ( 'debounceDelay' , 1000 ) ;
723723
724724 http . get ( '/fake' ) . subscribe ( ) ;
725725
@@ -763,7 +763,7 @@ describe('NgHttpLoaderComponent', () => {
763763
764764 it ( 'should be possible to remove the backdrop CSS class' , ( ) => {
765765 component . isVisible$ = of ( true ) ;
766- component . backdrop . set ( false ) ;
766+ fixture . componentRef . setInput ( 'backdrop' , false ) ;
767767 fixture . detectChanges ( ) ;
768768
769769 const element = fixture
@@ -787,7 +787,7 @@ describe('NgHttpLoaderComponent', () => {
787787
788788 it ( 'should be possible to override opacity' , ( ) => {
789789 component . isVisible$ = of ( true ) ;
790- component . opacity . set ( '.3' ) ;
790+ fixture . componentRef . setInput ( 'opacity' , '.3' ) ;
791791 fixture . detectChanges ( ) ;
792792
793793 const element : HTMLElement = fixture
@@ -812,7 +812,7 @@ describe('NgHttpLoaderComponent', () => {
812812
813813 it ( 'should be possible to override backdrop background color when backdrop is true' , ( ) => {
814814 component . isVisible$ = of ( true ) ;
815- component . backdropBackgroundColor . set ( '#777777' ) ;
815+ fixture . componentRef . setInput ( 'backdropBackgroundColor' , '#777777' ) ;
816816 fixture . detectChanges ( ) ;
817817
818818 const element : HTMLElement = fixture
@@ -825,7 +825,7 @@ describe('NgHttpLoaderComponent', () => {
825825
826826 it ( 'should not have a transparent backdrop background color if backdrop is false' , ( ) => {
827827 component . isVisible$ = of ( true ) ;
828- component . backdrop . set ( false ) ;
828+ fixture . componentRef . setInput ( 'backdrop' , false ) ;
829829 fixture . detectChanges ( ) ;
830830
831831 const element : HTMLElement = fixture
0 commit comments