@@ -649,6 +649,37 @@ describe('CloudinaryImage', () => {
649649 expect ( img . getAttribute ( 'style' ) ) . toEqual ( jasmine . stringMatching ( 'opacity: 0; position: absolute;' ) ) ;
650650 } ) ;
651651 } ) ;
652+ describe ( 'placeholder with secure' , ( ) => {
653+ @Component ( {
654+ template : `
655+ <cl-image public-id="sample.jpg" secure="true">
656+ <cl-placeholder></cl-placeholder>
657+ </cl-image>`
658+ } )
659+ class TestComponent { }
660+
661+ let fixture : ComponentFixture < TestComponent > ;
662+ let placeholder : DebugElement [ ] ;
663+ let testLocalCloudinary : Cloudinary = new Cloudinary ( require ( 'cloudinary-core' ) ,
664+ { cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
665+ beforeEach ( fakeAsync ( ( ) => {
666+ fixture = TestBed . configureTestingModule ( {
667+ declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , LazyLoadDirective , CloudinaryPlaceHolder ] ,
668+ providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
669+ } ) . createComponent ( TestComponent ) ;
670+
671+ fixture . detectChanges ( ) ; // initial binding
672+ // all elements with an attached CloudinaryImage
673+ placeholder = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
674+ tick ( ) ;
675+ fixture . detectChanges ( ) ;
676+ } ) ) ;
677+
678+ it ( 'placeholder should have secure URL' , ( ) => {
679+ const placeholderImg = placeholder [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
680+ expect ( placeholderImg . getAttribute ( 'src' ) ) . toEqual ( 'https://res.cloudinary.com/@@fake_angular2_sdk@@/image/upload/e_blur:2000,f_auto,q_1/sample.jpg' ) ;
681+ } ) ;
682+ } ) ;
652683 describe ( 'cl-image with placeholder and html style' , ( ) => {
653684 @Component ( {
654685 template : `<div style="margin-top: 4000px"></div>
0 commit comments