@@ -770,10 +770,10 @@ describe('CloudinaryImage', () => {
770770 expect ( img . attributes . getNamedItem ( 'src' ) . value ) . toEqual ( jasmine . stringMatching ( 'image/upload/c_fit,w_30/e_pixelate,f_auto,q_1/bear' ) ) ;
771771 } ) ) ;
772772 } ) ;
773- describe ( 'placeholder type solid ' , ( ) => {
773+ describe ( 'placeholder type predominant-color with exact dimensions ' , ( ) => {
774774 @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>
777777 </cl-image>`
778778 } )
779779 class TestComponent { }
@@ -791,18 +791,18 @@ describe('CloudinaryImage', () => {
791791 fixture . detectChanges ( ) ; // initial binding
792792 des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
793793 } ) ;
794- it ( 'creates an img element with placeholder' , fakeAsync ( ( ) => {
794+ it ( 'creates an img element with placeholder size 1 pxl ' , fakeAsync ( ( ) => {
795795 tick ( ) ;
796796 fixture . detectChanges ( ) ;
797797 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' ) ) ;
800800 } ) ) ;
801801 } ) ;
802- describe ( 'placeholder type vectorize ' , ( ) => {
802+ describe ( 'placeholder type predominant-color ' , ( ) => {
803803 @Component ( {
804804 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>
806806 </cl-image>`
807807 } )
808808 class TestComponent { }
@@ -824,14 +824,14 @@ 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/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' ) ) ;
828829 } ) ) ;
829830 } ) ;
830- describe ( 'placeholder with cl-transformation ' , ( ) => {
831+ describe ( 'placeholder type vectorize ' , ( ) => {
831832 @Component ( {
832833 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>
835835 </cl-image>`
836836 } )
837837 class TestComponent { }
@@ -845,58 +845,22 @@ describe('CloudinaryImage', () => {
845845 declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , CloudinaryPlaceHolder ] ,
846846 providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
847847 } ) . createComponent ( TestComponent ) ;
848+
848849 fixture . detectChanges ( ) ; // initial binding
849850 des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
850851 } ) ;
851- it ( 'creates an img element with placeholder and cl-transformations ' , fakeAsync ( ( ) => {
852+ it ( 'creates an img element with placeholder' , fakeAsync ( ( ) => {
852853 tick ( ) ;
853854 fixture . detectChanges ( ) ;
854855 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' ) ) ;
894857 } ) ) ;
895858 } ) ;
896- describe ( 'cl-image with acessibility modes and transformation' , ( ) => {
859+ describe ( 'placeholder with cl- transformation' , ( ) => {
897860 @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>
900864 </cl-image>`
901865 } )
902866 class TestComponent { }
@@ -907,15 +871,17 @@ describe('CloudinaryImage', () => {
907871 { cloud_name : '@@fake_angular2_sdk@@' , client_hints : true } as CloudinaryConfiguration ) ;
908872 beforeEach ( ( ) => {
909873 fixture = TestBed . configureTestingModule ( {
910- declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent ] ,
874+ declarations : [ CloudinaryTransformationDirective , CloudinaryImage , TestComponent , CloudinaryPlaceHolder ] ,
911875 providers : [ { provide : Cloudinary , useValue : testLocalCloudinary } ]
912876 } ) . createComponent ( TestComponent ) ;
913877 fixture . detectChanges ( ) ; // initial binding
914- des = fixture . debugElement . queryAll ( By . directive ( CloudinaryImage ) ) ;
878+ des = fixture . debugElement . queryAll ( By . directive ( CloudinaryPlaceHolder ) ) ;
915879 } ) ;
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 ( ) ;
917883 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' ) ) ;
919885 } ) ) ;
920886 } ) ;
921887} ) ;
0 commit comments