@@ -770,10 +770,10 @@ describe('CloudinaryImage', () => {
770
770
expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,w_30/e_pixelate,f_auto,q_1/bear' ) ) ;
771
771
} ) ) ;
772
772
} ) ;
773
- describe ( 'placeholder type solid ' , ( ) => {
773
+ describe ( 'placeholder type predominant-color with exact dimensions ' , ( ) => {
774
774
@Component ( {
775
- template : `<cl-image public-id="bear" width="300" crop="fit">
776
- <cl-placeholder type="solid "></cl-placeholder>
775
+ template : `<cl-image public-id="bear" width="300" height="300" crop="fit">
776
+ <cl-placeholder type="predominant-color "></cl-placeholder>
777
777
</cl-image>`
778
778
} )
779
779
class TestComponent { }
@@ -791,18 +791,18 @@ describe('CloudinaryImage', () => {
791
791
fixture . detectChanges ( ) ; // initial binding
792
792
des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
793
793
} ) ;
794
- it ( 'creates an img element with placeholder' , fakeAsync ( ( ) => {
794
+ it ( 'creates an img element with placeholder size 1 pxl ' , fakeAsync ( ( ) => {
795
795
tick ( ) ;
796
796
fixture . detectChanges ( ) ;
797
797
const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
798
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,w_30/ar_1,b_auto,' +
799
- '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' ) ) ;
798
+ expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,h_30, w_30/ar_1,b_auto,' +
799
+ 'c_pad,w_iw_div_2/c_crop,g_north_east,h_1,w_1 /f_auto,q_auto/bear' ) ) ;
800
800
} ) ) ;
801
801
} ) ;
802
- describe ( 'placeholder type vectorize ' , ( ) => {
802
+ describe ( 'placeholder type predominant-color ' , ( ) => {
803
803
@Component ( {
804
804
template : `<cl-image public-id="bear" width="300" crop="fit">
805
- <cl-placeholder type="vectorize "></cl-placeholder>
805
+ <cl-placeholder type="predominant-color "></cl-placeholder>
806
806
</cl-image>`
807
807
} )
808
808
class TestComponent { }
@@ -824,14 +824,14 @@ describe('CloudinaryImage', () => {
824
824
tick ( ) ;
825
825
fixture . detectChanges ( ) ;
826
826
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/e_vectorize,q_1/bear' ) ) ;
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' ) ) ;
828
829
} ) ) ;
829
830
} ) ;
830
- describe ( 'placeholder with cl-transformation ' , ( ) => {
831
+ describe ( 'placeholder type vectorize ' , ( ) => {
831
832
@Component ( {
832
833
template : `<cl-image public-id="bear" width="300" crop="fit">
833
- <cl-transformation effect="sepia"></cl-transformation>
834
- <cl-placeholder type="blur"></cl-placeholder>
834
+ <cl-placeholder type="vectorize"></cl-placeholder>
835
835
</cl-image>`
836
836
} )
837
837
class TestComponent { }
@@ -845,58 +845,22 @@ describe('CloudinaryImage', () => {
845
845
declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , CloudinaryPlaceHolder ] ,
846
846
providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
847
847
} ) . createComponent ( TestComponent ) ;
848
+
848
849
fixture . detectChanges ( ) ; // initial binding
849
850
des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
850
851
} ) ;
851
- it ( 'creates an img element with placeholder and cl-transformations ' , fakeAsync ( ( ) => {
852
+ it ( 'creates an img element with placeholder' , fakeAsync ( ( ) => {
852
853
tick ( ) ;
853
854
fixture . detectChanges ( ) ;
854
855
const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
855
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_sepia/c_fit,w_30/e_blur:2000,f_auto,q_1/bear' ) ) ;
856
- } ) ) ;
857
- } ) ;
858
- describe ( 'cl-image with acessibility modes' , ( ) => {
859
- @Component ( {
860
- template : `<cl-image public-id="bear" accessibility="darkmode"></cl-image>
861
- <cl-image public-id="bear" accessibility="monochrome"></cl-image>
862
- <cl-image public-id="bear" accessibility="brightmode"></cl-image>
863
- <cl-image public-id="bear" accessibility="colorblind"></cl-image>`
864
- } )
865
- class TestComponent { }
866
-
867
- let fixture : ComponentFixture < TestComponent > ;
868
- let des : DebugElement [ ] ; // the elements w/ the directive
869
- let testLocalCloudinary : Cloudinary = new Cloudinary ( require ( 'cloudinary-core' ) ,
870
- { cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
871
- beforeEach ( ( ) => {
872
- fixture = TestBed . configureTestingModule ( {
873
- declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent ] ,
874
- providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
875
- } ) . createComponent ( TestComponent ) ;
876
- fixture . detectChanges ( ) ; // initial binding
877
- des = fixture . debugElement . queryAll ( By . directive ( CloudinaryImage ) ) ;
878
- } ) ;
879
- it ( 'creates an img element with accessibility darkmode' , fakeAsync ( ( ) => {
880
- const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
881
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_tint:75:black/bear' ) ) ;
882
- } ) ) ;
883
- it ( 'creates an img element with accessibility monochrome' , fakeAsync ( ( ) => {
884
- const img = des [ 1 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
885
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_grayscale/bear' ) ) ;
886
- } ) ) ;
887
- it ( 'creates an img element with accessibility brightmode' , fakeAsync ( ( ) => {
888
- const img = des [ 2 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
889
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_tint:50:white/bear' ) ) ;
890
- } ) ) ;
891
- it ( 'creates an img element with accessibility colorblind' , fakeAsync ( ( ) => {
892
- const img = des [ 3 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
893
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_assist_colorblind/bear' ) ) ;
856
+ expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,w_30/e_vectorize,q_1/bear' ) ) ;
894
857
} ) ) ;
895
858
} ) ;
896
- describe ( 'cl-image with acessibility modes and transformation' , ( ) => {
859
+ describe ( 'placeholder with cl- transformation' , ( ) => {
897
860
@Component ( {
898
- template : `<cl-image public-id="bear" accessibility="darkmode" effect="grayscale" overlay="sample">
899
- <cl-transformation effect="sepia"></cl-transformation>
861
+ template : `<cl-image public-id="bear" width="300" crop="fit">
862
+ <cl-transformation effect="sepia"></cl-transformation>
863
+ <cl-placeholder type="blur"></cl-placeholder>
900
864
</cl-image>`
901
865
} )
902
866
class TestComponent { }
@@ -907,15 +871,17 @@ describe('CloudinaryImage', () => {
907
871
{ cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
908
872
beforeEach ( ( ) => {
909
873
fixture = TestBed . configureTestingModule ( {
910
- declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent ] ,
874
+ declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , CloudinaryPlaceHolder ] ,
911
875
providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
912
876
} ) . createComponent ( TestComponent ) ;
913
877
fixture . detectChanges ( ) ; // initial binding
914
- des = fixture . debugElement . queryAll ( By . directive ( CloudinaryImage ) ) ;
878
+ des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
915
879
} ) ;
916
- it ( 'creates an img element with accessibility darkmode without overwriting effect' , fakeAsync ( ( ) => {
880
+ it ( 'creates an img element with placeholder and cl-transformations' , fakeAsync ( ( ) => {
881
+ tick ( ) ;
882
+ fixture . detectChanges ( ) ;
917
883
const img = des [ 0 ] . children [ 0 ] . nativeElement as HTMLImageElement ;
918
- expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_sepia/e_grayscale,l_sample/e_tint:75:black /bear' ) ) ;
884
+ expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'e_sepia/c_fit,w_30/e_blur:2000,f_auto,q_1 /bear' ) ) ;
919
885
} ) ) ;
920
886
} ) ;
921
887
} ) ;
0 commit comments