@@ -678,6 +678,35 @@ describe('CloudinaryImage', () => {
678
678
expect ( img . getAttribute ( 'style' ) ) . toEqual ( jasmine . stringMatching ( 'max-height: 100%; opacity: 0; position: absolute;' ) ) ;
679
679
} ) ;
680
680
} ) ;
681
+ describe ( 'cl-image with placeholder and opacity' , ( ) => {
682
+ @Component ( {
683
+ template : `<div></div>
684
+ <cl-image public-id="sample" style="opacity: 0.5">
685
+ <cl-placeholder type="blur"></cl-placeholder>
686
+ </cl-image>`
687
+ } )
688
+ class TestComponent { }
689
+
690
+ let fixture : ComponentFixture < TestComponent > ;
691
+ let des : DebugElement [ ] ; // the elements w/ the directive
692
+ let testLocalCloudinary : Cloudinary = new Cloudinary ( require ( 'cloudinary-core' ) ,
693
+ { cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
694
+ beforeEach ( ( ) => {
695
+ fixture = TestBed . configureTestingModule ( {
696
+ declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , CloudinaryPlaceHolder ] ,
697
+ providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
698
+ } ) . createComponent ( TestComponent ) ;
699
+
700
+ fixture . detectChanges ( ) ; // initial binding
701
+ // all elements with an attached CloudinaryImage
702
+ des = fixture . debugElement . queryAll ( By . directive ( CloudinaryImage ) ) ;
703
+ } ) ;
704
+
705
+ it ( 'should not overwrite input opacity' , ( ) => {
706
+ const img = des [ 0 ] . nativeElement as HTMLImageElement ;
707
+ expect ( img . getAttribute ( 'style' ) ) . toEqual ( jasmine . stringMatching ( 'opacity: 0.5' ) ) ;
708
+ } ) ;
709
+ } ) ;
681
710
describe ( 'lazy load image' , async ( ) => {
682
711
@Component ( {
683
712
template : `
@@ -799,6 +828,12 @@ describe('CloudinaryImage', () => {
799
828
const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
800
829
expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/e_blur:2000,f_auto,q_1/bear' ) ) ;
801
830
} ) ) ;
831
+ it ( 'creates an img element without styling' , fakeAsync ( ( ) => {
832
+ tick ( ) ;
833
+ fixture . detectChanges ( ) ;
834
+ const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
835
+ expect ( img . getAttribute ( 'style' ) ) . toEqual ( null ) ;
836
+ } ) ) ;
802
837
} ) ;
803
838
describe ( 'placeholder type blur' , ( ) => {
804
839
@Component ( {
0 commit comments