@paypal/checkout-components 5.0.421 → 5.0.422-alpha-04293bf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +1 -1
- package/src/funding/paylater/config.jsx +7 -0
- package/src/ui/buttons/styles/styleUtils.js +2 -0
- package/src/ui/buttons/styles/styleUtils.test.constants.js +731 -0
- package/src/ui/buttons/styles/styleUtils.test.js +190 -602
|
@@ -7,614 +7,65 @@ import {
|
|
|
7
7
|
BUTTON_REDESIGN_SIZE,
|
|
8
8
|
BUTTON_DISABLE_MAX_HEIGHT_SIZE,
|
|
9
9
|
} from "../../../constants/button";
|
|
10
|
-
import {
|
|
11
|
-
BUTTON_SIZE_STYLE,
|
|
12
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
13
|
-
BUTTON_REDESIGN_STYLE,
|
|
14
|
-
} from "../config";
|
|
15
10
|
|
|
16
11
|
import {
|
|
17
12
|
getResponsiveStyleVariables,
|
|
18
13
|
getResponsiveRebrandedStyleVariables,
|
|
19
14
|
getDisableMaxHeightResponsiveStyleVariables,
|
|
20
15
|
} from "./styleUtils";
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
pillBorderRadius: 28,
|
|
75
|
-
gap: 6,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// expected should resize = true responsive styles variables
|
|
79
|
-
const expectedResizeLabelResponsiveStylesTiny = {
|
|
80
|
-
style: BUTTON_SIZE_STYLE[BUTTON_SIZE.TINY],
|
|
81
|
-
buttonHeight: 25,
|
|
82
|
-
minDualWidth: 300,
|
|
83
|
-
textPercPercentage: 32,
|
|
84
|
-
smallerLabelHeight: 14,
|
|
85
|
-
labelHeight: 14,
|
|
86
|
-
pillBorderRadius: 13,
|
|
87
|
-
gap: 3,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const expectedResizeLabelResponsiveStylesSmall = {
|
|
91
|
-
style: BUTTON_SIZE_STYLE[BUTTON_SIZE.SMALL],
|
|
92
|
-
buttonHeight: 25,
|
|
93
|
-
minDualWidth: 300,
|
|
94
|
-
textPercPercentage: 32,
|
|
95
|
-
smallerLabelHeight: 14,
|
|
96
|
-
labelHeight: 14,
|
|
97
|
-
pillBorderRadius: 13,
|
|
98
|
-
gap: 3,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const expectedResizeLabelResponsiveStylesMedium = {
|
|
102
|
-
style: BUTTON_SIZE_STYLE[BUTTON_SIZE.MEDIUM],
|
|
103
|
-
buttonHeight: 35,
|
|
104
|
-
minDualWidth: 300,
|
|
105
|
-
textPercPercentage: 32,
|
|
106
|
-
smallerLabelHeight: 16,
|
|
107
|
-
labelHeight: 18,
|
|
108
|
-
pillBorderRadius: 18,
|
|
109
|
-
gap: 4,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const expectedResizeLabelResponsiveStylesLarge = {
|
|
113
|
-
style: BUTTON_SIZE_STYLE[BUTTON_SIZE.LARGE],
|
|
114
|
-
buttonHeight: 45,
|
|
115
|
-
minDualWidth: 300,
|
|
116
|
-
textPercPercentage: 32,
|
|
117
|
-
smallerLabelHeight: 20,
|
|
118
|
-
labelHeight: 22,
|
|
119
|
-
pillBorderRadius: 23,
|
|
120
|
-
gap: 5,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const expectedResizeLabelResponsiveStylesHuge = {
|
|
124
|
-
style: BUTTON_SIZE_STYLE[BUTTON_SIZE.HUGE],
|
|
125
|
-
buttonHeight: 55,
|
|
126
|
-
minDualWidth: 300,
|
|
127
|
-
textPercPercentage: 32,
|
|
128
|
-
smallerLabelHeight: 24,
|
|
129
|
-
labelHeight: 24,
|
|
130
|
-
pillBorderRadius: 28,
|
|
131
|
-
gap: 6,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// DISABLE MAX HEIGHT TESTS
|
|
135
|
-
|
|
136
|
-
// expected legacy responsive styles variables
|
|
137
|
-
const expectedLegacyDisableMaxHeightStylesTiny = {
|
|
138
|
-
APMHeight: 18,
|
|
139
|
-
applePayHeight: 25,
|
|
140
|
-
buttonHeight: 25,
|
|
141
|
-
disableHeightStyle:
|
|
142
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY],
|
|
143
|
-
labelHeight: 14,
|
|
144
|
-
fontSize: 10,
|
|
145
|
-
marginTop: 1,
|
|
146
|
-
pillBorderRadius: 13,
|
|
147
|
-
spinnerSize: 13,
|
|
148
|
-
gap: 3,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const expectedLegacyDisableMaxHeightStylesSmall = {
|
|
152
|
-
APMHeight: 20,
|
|
153
|
-
applePayHeight: 29,
|
|
154
|
-
buttonHeight: 30,
|
|
155
|
-
disableHeightStyle:
|
|
156
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
157
|
-
labelHeight: 16,
|
|
158
|
-
fontSize: 11,
|
|
159
|
-
marginTop: 1,
|
|
160
|
-
pillBorderRadius: 15,
|
|
161
|
-
spinnerSize: 15,
|
|
162
|
-
gap: 3,
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const expectedLegacyDisableMaxHeightStylesMediumSmall = {
|
|
166
|
-
APMHeight: 23,
|
|
167
|
-
applePayHeight: 33,
|
|
168
|
-
buttonHeight: 35,
|
|
169
|
-
disableHeightStyle:
|
|
170
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
171
|
-
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
172
|
-
],
|
|
173
|
-
labelHeight: 18,
|
|
174
|
-
fontSize: 13,
|
|
175
|
-
marginTop: 1,
|
|
176
|
-
pillBorderRadius: 18,
|
|
177
|
-
spinnerSize: 18,
|
|
178
|
-
gap: 4,
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const expectedLegacyDisableMaxHeightStylesMediumBig = {
|
|
182
|
-
APMHeight: 25,
|
|
183
|
-
applePayHeight: 37,
|
|
184
|
-
buttonHeight: 40,
|
|
185
|
-
disableHeightStyle:
|
|
186
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
187
|
-
labelHeight: 20,
|
|
188
|
-
fontSize: 14,
|
|
189
|
-
marginTop: 1,
|
|
190
|
-
pillBorderRadius: 20,
|
|
191
|
-
spinnerSize: 20,
|
|
192
|
-
gap: 4,
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const expectedLegacyDisableMaxHeightStylesLargeSmall = {
|
|
196
|
-
APMHeight: 28,
|
|
197
|
-
applePayHeight: 41,
|
|
198
|
-
buttonHeight: 45,
|
|
199
|
-
disableHeightStyle:
|
|
200
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
201
|
-
labelHeight: 22,
|
|
202
|
-
fontSize: 16,
|
|
203
|
-
marginTop: 2,
|
|
204
|
-
pillBorderRadius: 23,
|
|
205
|
-
spinnerSize: 23,
|
|
206
|
-
gap: 5,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const expectedLegacyDisableMaxHeightStylesLargeBig = {
|
|
210
|
-
APMHeight: 30,
|
|
211
|
-
applePayHeight: 45,
|
|
212
|
-
buttonHeight: 50,
|
|
213
|
-
disableHeightStyle:
|
|
214
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
215
|
-
labelHeight: 24,
|
|
216
|
-
fontSize: 18,
|
|
217
|
-
marginTop: 2,
|
|
218
|
-
pillBorderRadius: 25,
|
|
219
|
-
spinnerSize: 25,
|
|
220
|
-
gap: 5,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const expectedLegacyDisableMaxHeightStylesXL = {
|
|
224
|
-
APMHeight: 33,
|
|
225
|
-
applePayHeight: 49,
|
|
226
|
-
buttonHeight: 55,
|
|
227
|
-
disableHeightStyle:
|
|
228
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
229
|
-
labelHeight: 24,
|
|
230
|
-
fontSize: 20,
|
|
231
|
-
marginTop: 2,
|
|
232
|
-
pillBorderRadius: 28,
|
|
233
|
-
spinnerSize: 28,
|
|
234
|
-
gap: 6,
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const expectedLegacyDisableMaxHeightStylesXXL = {
|
|
238
|
-
APMHeight: 38,
|
|
239
|
-
applePayHeight: 57,
|
|
240
|
-
buttonHeight: 65,
|
|
241
|
-
disableHeightStyle:
|
|
242
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
243
|
-
labelHeight: 28,
|
|
244
|
-
fontSize: 23,
|
|
245
|
-
marginTop: 2,
|
|
246
|
-
pillBorderRadius: 33,
|
|
247
|
-
spinnerSize: 33,
|
|
248
|
-
gap: 7,
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const expectedLegacyDisableMaxHeightStylesXXXL = {
|
|
252
|
-
APMHeight: 43,
|
|
253
|
-
applePayHeight: 65,
|
|
254
|
-
buttonHeight: 75,
|
|
255
|
-
disableHeightStyle:
|
|
256
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
257
|
-
labelHeight: 32,
|
|
258
|
-
fontSize: 27,
|
|
259
|
-
marginTop: 3,
|
|
260
|
-
pillBorderRadius: 38,
|
|
261
|
-
spinnerSize: 38,
|
|
262
|
-
gap: 7,
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
// expected shouldResizeLabel = true style variables for disable max height
|
|
266
|
-
const expectedResizeLabelDisableMaxHeightStylesTiny = {
|
|
267
|
-
APMHeight: 18,
|
|
268
|
-
applePayHeight: 25,
|
|
269
|
-
buttonHeight: 25,
|
|
270
|
-
disableHeightStyle:
|
|
271
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY],
|
|
272
|
-
labelHeight: 14,
|
|
273
|
-
fontSize: 10,
|
|
274
|
-
marginTop: 1,
|
|
275
|
-
pillBorderRadius: 13,
|
|
276
|
-
spinnerSize: 13,
|
|
277
|
-
gap: 3,
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
const expectedResizeLabelDisableMaxHeightStylesSmall = {
|
|
281
|
-
APMHeight: 20,
|
|
282
|
-
applePayHeight: 29,
|
|
283
|
-
buttonHeight: 30,
|
|
284
|
-
disableHeightStyle:
|
|
285
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
286
|
-
labelHeight: 16,
|
|
287
|
-
fontSize: 10,
|
|
288
|
-
marginTop: 1,
|
|
289
|
-
pillBorderRadius: 15,
|
|
290
|
-
spinnerSize: 15,
|
|
291
|
-
gap: 3,
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
const expectedResizeLabelDisableMaxHeightStylesMediumSmall = {
|
|
295
|
-
APMHeight: 23,
|
|
296
|
-
applePayHeight: 33,
|
|
297
|
-
buttonHeight: 35,
|
|
298
|
-
disableHeightStyle:
|
|
299
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
300
|
-
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
301
|
-
],
|
|
302
|
-
labelHeight: 16,
|
|
303
|
-
fontSize: 11,
|
|
304
|
-
marginTop: 1,
|
|
305
|
-
pillBorderRadius: 18,
|
|
306
|
-
spinnerSize: 18,
|
|
307
|
-
gap: 4,
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
const expectedResizeLabelDisableMaxHeightStylesMediumBig = {
|
|
311
|
-
APMHeight: 25,
|
|
312
|
-
applePayHeight: 37,
|
|
313
|
-
buttonHeight: 40,
|
|
314
|
-
disableHeightStyle:
|
|
315
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
316
|
-
labelHeight: 18,
|
|
317
|
-
fontSize: 13,
|
|
318
|
-
marginTop: 1,
|
|
319
|
-
pillBorderRadius: 20,
|
|
320
|
-
spinnerSize: 20,
|
|
321
|
-
gap: 4,
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const expectedResizeLabelDisableMaxHeightStylesLargeSmall = {
|
|
325
|
-
APMHeight: 28,
|
|
326
|
-
applePayHeight: 41,
|
|
327
|
-
buttonHeight: 45,
|
|
328
|
-
disableHeightStyle:
|
|
329
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
330
|
-
labelHeight: 20,
|
|
331
|
-
fontSize: 14,
|
|
332
|
-
marginTop: 1,
|
|
333
|
-
pillBorderRadius: 23,
|
|
334
|
-
spinnerSize: 23,
|
|
335
|
-
gap: 5,
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const expectedResizeLabelDisableMaxHeightStylesLargeBig = {
|
|
339
|
-
APMHeight: 30,
|
|
340
|
-
applePayHeight: 45,
|
|
341
|
-
buttonHeight: 50,
|
|
342
|
-
disableHeightStyle:
|
|
343
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
344
|
-
labelHeight: 22,
|
|
345
|
-
fontSize: 16,
|
|
346
|
-
marginTop: 2,
|
|
347
|
-
pillBorderRadius: 25,
|
|
348
|
-
spinnerSize: 25,
|
|
349
|
-
gap: 5,
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
const expectedResizeLabelDisableMaxHeightStylesXL = {
|
|
353
|
-
APMHeight: 33,
|
|
354
|
-
applePayHeight: 49,
|
|
355
|
-
buttonHeight: 55,
|
|
356
|
-
disableHeightStyle:
|
|
357
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
358
|
-
labelHeight: 24,
|
|
359
|
-
fontSize: 18,
|
|
360
|
-
marginTop: 2,
|
|
361
|
-
pillBorderRadius: 28,
|
|
362
|
-
spinnerSize: 28,
|
|
363
|
-
gap: 6,
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const expectedResizeLabelDisableMaxHeightStylesXXL = {
|
|
367
|
-
APMHeight: 38,
|
|
368
|
-
applePayHeight: 57,
|
|
369
|
-
buttonHeight: 65,
|
|
370
|
-
disableHeightStyle:
|
|
371
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
372
|
-
labelHeight: 26,
|
|
373
|
-
fontSize: 21,
|
|
374
|
-
marginTop: 2,
|
|
375
|
-
pillBorderRadius: 33,
|
|
376
|
-
spinnerSize: 33,
|
|
377
|
-
gap: 7,
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
const expectedResizeLabelDisableMaxHeightStylesXXXL = {
|
|
381
|
-
APMHeight: 43,
|
|
382
|
-
applePayHeight: 65,
|
|
383
|
-
buttonHeight: 75,
|
|
384
|
-
disableHeightStyle:
|
|
385
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
386
|
-
labelHeight: 30,
|
|
387
|
-
fontSize: 24,
|
|
388
|
-
marginTop: 2,
|
|
389
|
-
pillBorderRadius: 38,
|
|
390
|
-
spinnerSize: 38,
|
|
391
|
-
gap: 7,
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
// expected rebrand disable max height responsive styles variables
|
|
395
|
-
const expectedRebrandDisableMaxHeightStylesTiny = {
|
|
396
|
-
APMHeight: 18,
|
|
397
|
-
applePayHeight: 25,
|
|
398
|
-
buttonHeight: 25,
|
|
399
|
-
disableHeightStyle:
|
|
400
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY],
|
|
401
|
-
labelHeight: 13,
|
|
402
|
-
fontSize: 10,
|
|
403
|
-
marginTop: 1,
|
|
404
|
-
spinnerSize: 13,
|
|
405
|
-
gap: 3,
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const expectedRebrandDisableMaxHeightStylesSmall = {
|
|
409
|
-
APMHeight: 20,
|
|
410
|
-
applePayHeight: 29,
|
|
411
|
-
buttonHeight: 30,
|
|
412
|
-
disableHeightStyle:
|
|
413
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
414
|
-
labelHeight: 15,
|
|
415
|
-
fontSize: 11,
|
|
416
|
-
marginTop: 1,
|
|
417
|
-
spinnerSize: 15,
|
|
418
|
-
gap: 3,
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
const expectedRebrandDisableMaxHeightStylesMediumSmall = {
|
|
422
|
-
APMHeight: 23,
|
|
423
|
-
applePayHeight: 33,
|
|
424
|
-
buttonHeight: 35,
|
|
425
|
-
disableHeightStyle:
|
|
426
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
427
|
-
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
428
|
-
],
|
|
429
|
-
labelHeight: 18,
|
|
430
|
-
fontSize: 13,
|
|
431
|
-
marginTop: 1,
|
|
432
|
-
spinnerSize: 18,
|
|
433
|
-
gap: 4,
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
const expectedRebrandDisableMaxHeightStylesMediumBig = {
|
|
437
|
-
APMHeight: 25,
|
|
438
|
-
applePayHeight: 37,
|
|
439
|
-
buttonHeight: 40,
|
|
440
|
-
disableHeightStyle:
|
|
441
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
442
|
-
labelHeight: 20,
|
|
443
|
-
fontSize: 14,
|
|
444
|
-
marginTop: 1,
|
|
445
|
-
spinnerSize: 20,
|
|
446
|
-
gap: 4,
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
const expectedRebrandDisableMaxHeightStylesLargeSmall = {
|
|
450
|
-
APMHeight: 28,
|
|
451
|
-
applePayHeight: 41,
|
|
452
|
-
buttonHeight: 45,
|
|
453
|
-
disableHeightStyle:
|
|
454
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
455
|
-
labelHeight: 23,
|
|
456
|
-
fontSize: 16,
|
|
457
|
-
marginTop: 2,
|
|
458
|
-
spinnerSize: 23,
|
|
459
|
-
gap: 5,
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
const expectedRebrandDisableMaxHeightStylesLargeBig = {
|
|
463
|
-
APMHeight: 30,
|
|
464
|
-
applePayHeight: 45,
|
|
465
|
-
buttonHeight: 50,
|
|
466
|
-
disableHeightStyle:
|
|
467
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
468
|
-
labelHeight: 25,
|
|
469
|
-
fontSize: 18,
|
|
470
|
-
marginTop: 2,
|
|
471
|
-
spinnerSize: 25,
|
|
472
|
-
gap: 5,
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
const expectedRebrandDisableMaxHeightStylesXL = {
|
|
476
|
-
APMHeight: 33,
|
|
477
|
-
applePayHeight: 49,
|
|
478
|
-
buttonHeight: 55,
|
|
479
|
-
disableHeightStyle:
|
|
480
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
481
|
-
labelHeight: 28,
|
|
482
|
-
fontSize: 20,
|
|
483
|
-
marginTop: 2,
|
|
484
|
-
spinnerSize: 28,
|
|
485
|
-
gap: 6,
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
const expectedRebrandDisableMaxHeightStylesXXL = {
|
|
489
|
-
APMHeight: 38,
|
|
490
|
-
applePayHeight: 57,
|
|
491
|
-
buttonHeight: 65,
|
|
492
|
-
disableHeightStyle:
|
|
493
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
494
|
-
labelHeight: 33,
|
|
495
|
-
fontSize: 23,
|
|
496
|
-
marginTop: 2,
|
|
497
|
-
spinnerSize: 33,
|
|
498
|
-
gap: 7,
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
502
|
-
APMHeight: 43,
|
|
503
|
-
applePayHeight: 65,
|
|
504
|
-
buttonHeight: 75,
|
|
505
|
-
disableHeightStyle:
|
|
506
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
507
|
-
labelHeight: 38,
|
|
508
|
-
fontSize: 27,
|
|
509
|
-
marginTop: 3,
|
|
510
|
-
spinnerSize: 38,
|
|
511
|
-
gap: 7,
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
// expected rebrand responsive styles variables
|
|
515
|
-
const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
516
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.EXTRA_SMALL],
|
|
517
|
-
buttonHeight: 20,
|
|
518
|
-
gap: 3,
|
|
519
|
-
defaultHeight: 20,
|
|
520
|
-
minHeight: 20,
|
|
521
|
-
maxHeight: 30,
|
|
522
|
-
minWidth: 50,
|
|
523
|
-
minDualWidth: 300,
|
|
524
|
-
maxWidth: 75,
|
|
525
|
-
fontSize: 10,
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
const expectedRebrandedResponsiveStylesTiny = {
|
|
529
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.TINY],
|
|
530
|
-
buttonHeight: 25,
|
|
531
|
-
gap: 3,
|
|
532
|
-
defaultHeight: 25,
|
|
533
|
-
minHeight: 25,
|
|
534
|
-
maxHeight: 30,
|
|
535
|
-
minWidth: 75,
|
|
536
|
-
minDualWidth: 300,
|
|
537
|
-
maxWidth: 200,
|
|
538
|
-
fontSize: 10,
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
const expectedRebrandedResponsiveStylesSmall = {
|
|
542
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.SMALL],
|
|
543
|
-
buttonHeight: 35,
|
|
544
|
-
gap: 4,
|
|
545
|
-
defaultHeight: 35,
|
|
546
|
-
minHeight: 30,
|
|
547
|
-
maxHeight: 35,
|
|
548
|
-
minWidth: 200,
|
|
549
|
-
minDualWidth: 300,
|
|
550
|
-
maxWidth: 250,
|
|
551
|
-
fontSize: 12,
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
555
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_SMALL],
|
|
556
|
-
buttonHeight: 35,
|
|
557
|
-
gap: 4,
|
|
558
|
-
defaultHeight: 35,
|
|
559
|
-
minHeight: 35,
|
|
560
|
-
maxHeight: 40,
|
|
561
|
-
minWidth: 250,
|
|
562
|
-
minDualWidth: 300,
|
|
563
|
-
maxWidth: 300,
|
|
564
|
-
fontSize: 14,
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
const expectedRebrandedResponsiveStylesMediumBig = {
|
|
568
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_BIG],
|
|
569
|
-
buttonHeight: 45,
|
|
570
|
-
gap: 5,
|
|
571
|
-
defaultHeight: 45,
|
|
572
|
-
minHeight: 40,
|
|
573
|
-
maxHeight: 45,
|
|
574
|
-
minWidth: 300,
|
|
575
|
-
minDualWidth: 300,
|
|
576
|
-
maxWidth: 350,
|
|
577
|
-
fontSize: 14,
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
581
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_SMALL],
|
|
582
|
-
buttonHeight: 45,
|
|
583
|
-
gap: 5,
|
|
584
|
-
defaultHeight: 45,
|
|
585
|
-
minHeight: 45,
|
|
586
|
-
maxHeight: 50,
|
|
587
|
-
minWidth: 350,
|
|
588
|
-
minDualWidth: 300,
|
|
589
|
-
maxWidth: 425,
|
|
590
|
-
fontSize: 16,
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
const expectedRebrandedResponsiveStylesLargeBig = {
|
|
594
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_BIG],
|
|
595
|
-
buttonHeight: 50,
|
|
596
|
-
gap: 5,
|
|
597
|
-
defaultHeight: 50,
|
|
598
|
-
minHeight: 50,
|
|
599
|
-
maxHeight: 55,
|
|
600
|
-
minWidth: 425,
|
|
601
|
-
minDualWidth: 300,
|
|
602
|
-
maxWidth: 500,
|
|
603
|
-
fontSize: 18,
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
const expectedRebrandedResponsiveStylesXlSmall = {
|
|
607
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_SMALL],
|
|
608
|
-
buttonHeight: 55,
|
|
609
|
-
gap: 6,
|
|
610
|
-
defaultHeight: 55,
|
|
611
|
-
minHeight: 55,
|
|
612
|
-
maxHeight: 60,
|
|
613
|
-
minWidth: 500,
|
|
614
|
-
minDualWidth: 300,
|
|
615
|
-
maxWidth: 750,
|
|
616
|
-
fontSize: 18,
|
|
617
|
-
};
|
|
16
|
+
import {
|
|
17
|
+
// Legacy Responsive Styles
|
|
18
|
+
expectedLegacyResponsiveStylesTiny,
|
|
19
|
+
expectedLegacyResponsiveStylesSmall,
|
|
20
|
+
expectedLegacyResponsiveStylesMedium,
|
|
21
|
+
expectedLegacyResponsiveStylesLarge,
|
|
22
|
+
expectedLegacyResponsiveStylesHuge,
|
|
23
|
+
// Resize Label Responsive Styles
|
|
24
|
+
expectedResizeLabelResponsiveStylesTiny,
|
|
25
|
+
expectedResizeLabelResponsiveStylesSmall,
|
|
26
|
+
expectedResizeLabelResponsiveStylesMedium,
|
|
27
|
+
expectedResizeLabelResponsiveStylesLarge,
|
|
28
|
+
expectedResizeLabelResponsiveStylesHuge,
|
|
29
|
+
// Legacy Disable Max Height Styles
|
|
30
|
+
expectedLegacyDisableMaxHeightStylesTiny,
|
|
31
|
+
expectedLegacyDisableMaxHeightStylesSmall,
|
|
32
|
+
expectedLegacyDisableMaxHeightStylesMediumSmall,
|
|
33
|
+
expectedLegacyDisableMaxHeightStylesMediumBig,
|
|
34
|
+
expectedLegacyDisableMaxHeightStylesLargeSmall,
|
|
35
|
+
expectedLegacyDisableMaxHeightStylesLargeBig,
|
|
36
|
+
expectedLegacyDisableMaxHeightStylesXL,
|
|
37
|
+
expectedLegacyDisableMaxHeightStylesXXL,
|
|
38
|
+
expectedLegacyDisableMaxHeightStylesXXXL,
|
|
39
|
+
// Resize Label Disable Max Height Styles
|
|
40
|
+
expectedResizeLabelDisableMaxHeightStylesTiny,
|
|
41
|
+
expectedResizeLabelDisableMaxHeightStylesSmall,
|
|
42
|
+
expectedResizeLabelDisableMaxHeightStylesMediumSmall,
|
|
43
|
+
expectedResizeLabelDisableMaxHeightStylesMediumBig,
|
|
44
|
+
expectedResizeLabelDisableMaxHeightStylesLargeSmall,
|
|
45
|
+
expectedResizeLabelDisableMaxHeightStylesLargeBig,
|
|
46
|
+
expectedResizeLabelDisableMaxHeightStylesXL,
|
|
47
|
+
expectedResizeLabelDisableMaxHeightStylesXXL,
|
|
48
|
+
expectedResizeLabelDisableMaxHeightStylesXXXL,
|
|
49
|
+
// Rebrand Disable Max Height Styles
|
|
50
|
+
expectedRebrandDisableMaxHeightStylesTiny,
|
|
51
|
+
expectedRebrandDisableMaxHeightStylesSmall,
|
|
52
|
+
expectedRebrandDisableMaxHeightStylesMediumSmall,
|
|
53
|
+
expectedRebrandDisableMaxHeightStylesMediumBig,
|
|
54
|
+
expectedRebrandDisableMaxHeightStylesLargeSmall,
|
|
55
|
+
expectedRebrandDisableMaxHeightStylesLargeBig,
|
|
56
|
+
expectedRebrandDisableMaxHeightStylesXL,
|
|
57
|
+
expectedRebrandDisableMaxHeightStylesXXL,
|
|
58
|
+
expectedRebrandDisableMaxHeightStylesXXXL,
|
|
59
|
+
// Rebranded Responsive Styles
|
|
60
|
+
expectedRebrandedResponsiveStylesExtraSmall,
|
|
61
|
+
expectedRebrandedResponsiveStylesTiny,
|
|
62
|
+
expectedRebrandedResponsiveStylesSmall,
|
|
63
|
+
expectedRebrandedResponsiveStylesMediumSmall,
|
|
64
|
+
expectedRebrandedResponsiveStylesMediumBig,
|
|
65
|
+
expectedRebrandedResponsiveStylesLargeSmall,
|
|
66
|
+
expectedRebrandedResponsiveStylesLargeBig,
|
|
67
|
+
expectedRebrandedResponsiveStylesXlSmall,
|
|
68
|
+
} from "./styleUtils.test.constants";
|
|
618
69
|
|
|
619
70
|
describe("test responsive style variables for legacy", () => {
|
|
620
71
|
const shouldApplyRebrandedStyles = false;
|
|
@@ -705,6 +156,67 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
|
|
|
705
156
|
}
|
|
706
157
|
);
|
|
707
158
|
});
|
|
159
|
+
|
|
160
|
+
// Separate describe block needed because JavaScript objects cannot have multiple values for paylater.variant
|
|
161
|
+
// AT and DE both use German labels and trigger shouldResizeLabel, but backend returns distinct variants
|
|
162
|
+
describe("test responsive style variables when shouldResizeLabel == true for Austria variant", () => {
|
|
163
|
+
const shouldApplyRebrandedStyles = false;
|
|
164
|
+
|
|
165
|
+
const fundingEligibility = {
|
|
166
|
+
paypal: {
|
|
167
|
+
eligible: true,
|
|
168
|
+
branded: undefined,
|
|
169
|
+
},
|
|
170
|
+
paylater: {
|
|
171
|
+
eligible: true,
|
|
172
|
+
products: {
|
|
173
|
+
paylater: {
|
|
174
|
+
variant: "AT",
|
|
175
|
+
},
|
|
176
|
+
payIn3: {
|
|
177
|
+
variant: null,
|
|
178
|
+
},
|
|
179
|
+
payIn4: {
|
|
180
|
+
variant: null,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
test.each([
|
|
186
|
+
{
|
|
187
|
+
input: BUTTON_SIZE.TINY,
|
|
188
|
+
expected: expectedResizeLabelResponsiveStylesTiny,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
input: BUTTON_SIZE.SMALL,
|
|
192
|
+
expected: expectedResizeLabelResponsiveStylesSmall,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
input: BUTTON_SIZE.MEDIUM,
|
|
196
|
+
expected: expectedResizeLabelResponsiveStylesMedium,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
input: BUTTON_SIZE.LARGE,
|
|
200
|
+
expected: expectedResizeLabelResponsiveStylesLarge,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
input: BUTTON_SIZE.HUGE,
|
|
204
|
+
expected: expectedResizeLabelResponsiveStylesHuge,
|
|
205
|
+
},
|
|
206
|
+
])(
|
|
207
|
+
`should return responsive styles for size $input with AT variant`,
|
|
208
|
+
({ input, expected }) => {
|
|
209
|
+
expect(
|
|
210
|
+
getResponsiveStyleVariables({
|
|
211
|
+
fundingEligibility,
|
|
212
|
+
shouldApplyRebrandedStyles,
|
|
213
|
+
size: input,
|
|
214
|
+
})
|
|
215
|
+
).toEqual(expected);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
|
|
708
220
|
describe("test responsive style variables for rebranded buttons", () => {
|
|
709
221
|
test.each([
|
|
710
222
|
{
|
|
@@ -884,6 +396,82 @@ describe("test responsive style variables when shouldResizeLabel == true for dis
|
|
|
884
396
|
);
|
|
885
397
|
});
|
|
886
398
|
|
|
399
|
+
// Separate describe block needed because JavaScript objects cannot have multiple values for paylater.variant
|
|
400
|
+
// AT and DE both use German labels and trigger shouldResizeLabel, but backend returns distinct variants
|
|
401
|
+
describe("test responsive style variables when shouldResizeLabel == true for disable max height with Austria variant", () => {
|
|
402
|
+
const shouldApplyRebrandedStyles = false;
|
|
403
|
+
|
|
404
|
+
const fundingEligibility = {
|
|
405
|
+
paypal: {
|
|
406
|
+
eligible: true,
|
|
407
|
+
branded: undefined,
|
|
408
|
+
},
|
|
409
|
+
paylater: {
|
|
410
|
+
eligible: true,
|
|
411
|
+
products: {
|
|
412
|
+
paylater: {
|
|
413
|
+
variant: "AT",
|
|
414
|
+
},
|
|
415
|
+
payIn3: {
|
|
416
|
+
variant: null,
|
|
417
|
+
},
|
|
418
|
+
payIn4: {
|
|
419
|
+
variant: null,
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
test.each([
|
|
425
|
+
{
|
|
426
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY,
|
|
427
|
+
expected: expectedResizeLabelDisableMaxHeightStylesTiny,
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL,
|
|
431
|
+
expected: expectedResizeLabelDisableMaxHeightStylesSmall,
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL,
|
|
435
|
+
expected: expectedResizeLabelDisableMaxHeightStylesMediumSmall,
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG,
|
|
439
|
+
expected: expectedResizeLabelDisableMaxHeightStylesMediumBig,
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL,
|
|
443
|
+
expected: expectedResizeLabelDisableMaxHeightStylesLargeSmall,
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG,
|
|
447
|
+
expected: expectedResizeLabelDisableMaxHeightStylesLargeBig,
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL,
|
|
451
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXL,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL,
|
|
455
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXXL,
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL,
|
|
459
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXXXL,
|
|
460
|
+
},
|
|
461
|
+
])(
|
|
462
|
+
`should return responsive styles for disable max height size $input with AT variant`,
|
|
463
|
+
({ input, expected }) => {
|
|
464
|
+
expect(
|
|
465
|
+
getDisableMaxHeightResponsiveStyleVariables({
|
|
466
|
+
fundingEligibility,
|
|
467
|
+
shouldApplyRebrandedStyles,
|
|
468
|
+
disableMaxHeightSize: input,
|
|
469
|
+
})
|
|
470
|
+
).toEqual(expected);
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
});
|
|
474
|
+
|
|
887
475
|
describe("test rebrand responsive style variables for disable max height", () => {
|
|
888
476
|
const shouldApplyRebrandedStyles = true;
|
|
889
477
|
|