@@ -11,6 +11,7 @@ import {Underlay} from "../../../src/actions/underlay";
11
11
import { Timeline } from "../../../src/qualifiers/timeline" ;
12
12
import { base64Encode } from "../../../src/internal/utils/base64Encode" ;
13
13
import { TextStyle } from "../../../src/qualifiers/textStyle" ;
14
+ import { TextFit } from "../../../src/qualifiers/textFit" ;
14
15
15
16
describe ( 'Tests for overlay actions' , ( ) => {
16
17
it ( 'Tests Image on Image with publicID encoding' , ( ) => {
@@ -239,6 +240,30 @@ describe('Tests for overlay actions', () => {
239
240
expect ( asset . toURL ( ) ) . toContain ( "l_text:arial_15:!/fl_layer_apply" ) ;
240
241
} ) ;
241
242
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
+
242
267
it ( "should serialize a fetch source" , ( ) => {
243
268
const asset = createNewVideo ( ) ;
244
269
const REMOTE_URL = 'http://res.cloudinary.com/demo/sample.jpg' ;
0 commit comments