@@ -824,8 +824,8 @@ describe('CloudinaryImage', () => {
824824 tick ( ) ;
825825 fixture . detectChanges ( ) ;
826826 const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
827- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,w_30/ar_1,b_auto, ' +
828- 'c_pad,w_iw_div_2/c_crop,g_north_east,h_10,w_10/c_fill,h_ih,w_iw/f_auto,q_auto/bear' ) ) ;
827+ expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( 'http://res.cloudinary.com/ ' +
828+ '@@fake_angular2_sdk@@/image/upload/c_fit,w_30/ar_1,b_auto, c_pad,w_iw_div_2/c_crop,g_north_east,h_10,w_10/c_fill,h_ih,w_iw/f_auto,q_auto/bear' ) ;
829829 } ) ) ;
830830 } ) ;
831831 describe ( 'placeholder type vectorize' , ( ) => {
@@ -947,4 +947,35 @@ describe('CloudinaryImage', () => {
947947 expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_sepia/e_grayscale,l_sample/e_tint:75:black/bear' ) ) ;
948948 } ) ) ;
949949 } ) ;
950+ describe ( 'cl-image with responsive and lazy-load' , async ( ) => {
951+ @Component ( {
952+ template : `<cl-image loading="lazy" width="300" public-id="bear"></cl-image>`
953+ } )
954+ class TestComponent { }
955+
956+ let fixture : ComponentFixture < TestComponent > ;
957+ let des : DebugElement [ ] ; // the elements w/ the directive
958+ let placeholder : DebugElement [ ] ;
959+ let testLocalCloudinary : Cloudinary = new Cloudinary ( require ( 'cloudinary-core' ) ,
960+ { cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
961+ beforeEach ( fakeAsync ( ( ) => {
962+ fixture = TestBed . configureTestingModule ( {
963+ declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , LazyLoadDirective ] ,
964+ providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
965+ } ) . createComponent ( TestComponent ) ;
966+
967+ fixture . detectChanges ( ) ; // initial binding
968+ // all elements with an attached CloudinaryImage
969+ des = fixture . debugElement . queryAll ( By . directive ( CloudinaryImage ) ) ;
970+ tick ( ) ;
971+ fixture . detectChanges ( ) ;
972+ } ) ) ;
973+ it ( 'src should not exist on Firefox' , ( ) => {
974+ const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
975+ if ( navigator . userAgent . toLowerCase ( ) . indexOf ( 'firefox' ) > - 1 ) {
976+ expect ( img ) . not . toContain ( 'src' ) ;
977+ }
978+ } ) ;
979+ } ) ;
950980} ) ;
981+
0 commit comments