@@ -11,6 +11,7 @@ import {Underlay} from "../../../src/actions/underlay";
1111import { Timeline } from "../../../src/qualifiers/timeline" ;
1212import { base64Encode } from "../../../src/internal/utils/base64Encode" ;
1313import { TextStyle } from "../../../src/qualifiers/textStyle" ;
14+ import { TextFit } from "../../../src/qualifiers/textFit" ;
1415
1516describe ( 'Tests for overlay actions' , ( ) => {
1617 it ( 'Tests Image on Image with publicID encoding' , ( ) => {
@@ -239,6 +240,30 @@ describe('Tests for overlay actions', () => {
239240 expect ( asset . toURL ( ) ) . toContain ( "l_text:arial_15:!/fl_layer_apply" ) ;
240241 } ) ;
241242
243+ it ( "textFit with alias" , ( ) => {
244+ const asset = createNewImage ( 'sample' ) ;
245+ const text = 'hello hello hello hello' ;
246+ const textSource = Source . text ( text , 'arial_15' ) . textFit ( TextFit . size ( 400 , 500 ) ) ;
247+ asset . overlay ( Overlay . source ( textSource ) ) ;
248+ expect ( asset . toURL ( ) ) . toContain ( "c_fit,w_400,h_500,l_text:arial_15:hello%20hello%20hello%20hello" ) ;
249+ } ) ;
250+
251+ it ( "textFit with size" , ( ) => {
252+ const asset = createNewImage ( 'sample' ) ;
253+ const text = 'hello hello hello hello' ;
254+ const textSource = Source . text ( text , 'arial_15' ) . textFit ( TextFit . size ( 400 ) ) ;
255+ asset . overlay ( Overlay . source ( textSource ) ) ;
256+ expect ( asset . toURL ( ) ) . toContain ( "c_fit,w_400,l_text:arial_15:hello%20hello%20hello%20hello" ) ;
257+ } ) ;
258+
259+ it ( "textFit with size and height" , ( ) => {
260+ const asset = createNewImage ( 'sample' ) ;
261+ const text = 'hello hello hello hello' ;
262+ const textSource = Source . text ( text , 'arial_15' ) . textFit ( TextFit . size ( 400 ) . height ( 600 ) ) ;
263+ asset . overlay ( Overlay . source ( textSource ) ) ;
264+ expect ( asset . toURL ( ) ) . toContain ( "c_fit,w_400,h_600,l_text:arial_15:hello%20hello%20hello%20hello" ) ;
265+ } ) ;
266+
242267 it ( "should serialize a fetch source" , ( ) => {
243268 const asset = createNewVideo ( ) ;
244269 const REMOTE_URL = 'http://res.cloudinary.com/demo/sample.jpg' ;
0 commit comments