@paypal/checkout-components 5.0.426-alpha-ea5d1e6.0 → 5.0.427

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.
Files changed (67) hide show
  1. package/dist/button.js +1 -1
  2. package/dist/test/button.js +1 -1
  3. package/package.json +8 -8
  4. package/src/connect/component.jsx +1 -1
  5. package/src/connect/component.test.js +2 -2
  6. package/src/funding/card/config.jsx +3 -3
  7. package/src/funding/card/config.test.jsx +10 -10
  8. package/src/funding/funding.js +6 -6
  9. package/src/funding/funding.test.js +3 -3
  10. package/src/funding/paylater/config.jsx +2 -2
  11. package/src/funding/paypal/template.jsx +8 -8
  12. package/src/funding/util.js +2 -2
  13. package/src/funding/util.test.js +16 -16
  14. package/src/hosted-buttons/index.test.js +9 -9
  15. package/src/hosted-buttons/types.js +3 -3
  16. package/src/hosted-buttons/utils.js +8 -8
  17. package/src/hosted-buttons/utils.test.js +43 -43
  18. package/src/lib/api.js +2 -2
  19. package/src/lib/appSwitchResume.js +1 -1
  20. package/src/lib/perceived-latency-instrumentation.js +1 -1
  21. package/src/lib/security.js +1 -1
  22. package/src/marks/component.jsx +4 -4
  23. package/src/marks/templateRebrand.test.jsx +1 -1
  24. package/src/shopper-insights/shopperSession.js +13 -13
  25. package/src/shopper-insights/shopperSession.test.js +25 -25
  26. package/src/three-domain-secure/api.js +1 -1
  27. package/src/three-domain-secure/api.test.js +4 -4
  28. package/src/three-domain-secure/component.jsx +3 -3
  29. package/src/three-domain-secure/component.test.js +14 -14
  30. package/src/ui/buttons/buttons.jsx +2 -2
  31. package/src/ui/buttons/buttons.test.js +4 -4
  32. package/src/ui/buttons/config.js +1 -1
  33. package/src/ui/buttons/poweredBy.jsx +1 -1
  34. package/src/ui/buttons/props.bnpl.test.js +1 -1
  35. package/src/ui/buttons/props.js +43 -43
  36. package/src/ui/buttons/props.test.js +8 -8
  37. package/src/ui/buttons/script.jsx +10 -10
  38. package/src/ui/buttons/styles/button.js +2 -2
  39. package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +1 -1
  40. package/src/ui/buttons/styles/labelContainerHeight.test.js +5 -5
  41. package/src/ui/buttons/styles/labels.js +7 -7
  42. package/src/ui/buttons/styles/page.js +1 -1
  43. package/src/ui/buttons/styles/responsive.js +137 -137
  44. package/src/ui/buttons/styles/styleUtils.js +14 -12
  45. package/src/ui/buttons/styles/styleUtils.test.constants.js +731 -0
  46. package/src/ui/buttons/styles/styleUtils.test.js +198 -610
  47. package/src/ui/buttons/util.js +4 -4
  48. package/src/ui/overlay/paypal-app-switch/style.jsx +1 -1
  49. package/src/ui/overlay/three-domain-secure/overlay.jsx +1 -1
  50. package/src/ui/overlay/three-domain-secure/style.jsx +1 -1
  51. package/src/ui/saved-payment-methods/template.jsx +1 -1
  52. package/src/ui/text/text.jsx +1 -1
  53. package/src/zoid/buttons/component.jsx +13 -13
  54. package/src/zoid/buttons/container.jsx +2 -2
  55. package/src/zoid/buttons/prerender.jsx +3 -3
  56. package/src/zoid/buttons/util.js +10 -10
  57. package/src/zoid/buttons/util.test.js +2 -2
  58. package/src/zoid/card-fields/component.jsx +8 -9
  59. package/src/zoid/card-form/component.js +3 -3
  60. package/src/zoid/checkout/component.jsx +2 -2
  61. package/src/zoid/payment-fields/component.jsx +1 -1
  62. package/src/zoid/qr-code/container.test.jsx +2 -2
  63. package/src/zoid/qr-code/prerender.test.jsx +1 -1
  64. package/src/zoid/saved-payment-methods/component.jsx +8 -8
  65. package/src/zoid/saved-payment-methods/util.js +2 -2
  66. package/src/zoid/saved-payment-methods/util.test.js +14 -14
  67. package/src/zoid/wallet/component.jsx +1 -1
@@ -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
- // expected legacy responsive styles variables
23
- const expectedLegacyResponsiveStylesTiny = {
24
- style: BUTTON_SIZE_STYLE[BUTTON_SIZE.TINY],
25
- buttonHeight: 25,
26
- minDualWidth: 300,
27
- textPercPercentage: 36,
28
- smallerLabelHeight: 14,
29
- labelHeight: 14,
30
- pillBorderRadius: 13,
31
- gap: 3,
32
- };
33
-
34
- const expectedLegacyResponsiveStylesSmall = {
35
- style: BUTTON_SIZE_STYLE[BUTTON_SIZE.SMALL],
36
- buttonHeight: 25,
37
- minDualWidth: 300,
38
- textPercPercentage: 36,
39
- smallerLabelHeight: 14,
40
- labelHeight: 14,
41
- pillBorderRadius: 13,
42
- gap: 3,
43
- };
44
-
45
- const expectedLegacyResponsiveStylesMedium = {
46
- style: BUTTON_SIZE_STYLE[BUTTON_SIZE.MEDIUM],
47
- buttonHeight: 35,
48
- minDualWidth: 300,
49
- textPercPercentage: 36,
50
- smallerLabelHeight: 18,
51
- labelHeight: 18,
52
- pillBorderRadius: 18,
53
- gap: 4,
54
- };
55
-
56
- const expectedLegacyResponsiveStylesLarge = {
57
- style: BUTTON_SIZE_STYLE[BUTTON_SIZE.LARGE],
58
- buttonHeight: 45,
59
- minDualWidth: 300,
60
- textPercPercentage: 36,
61
- smallerLabelHeight: 22,
62
- labelHeight: 22,
63
- pillBorderRadius: 23,
64
- gap: 5,
65
- };
66
-
67
- const expectedLegacyResponsiveStylesHuge = {
68
- style: BUTTON_SIZE_STYLE[BUTTON_SIZE.HUGE],
69
- buttonHeight: 55,
70
- minDualWidth: 300,
71
- textPercPercentage: 36,
72
- smallerLabelHeight: 24,
73
- labelHeight: 24,
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;
@@ -642,9 +93,9 @@ describe("test responsive style variables for legacy", () => {
642
93
  shouldApplyRebrandedStyles,
643
94
  fundingEligibility,
644
95
  size: input,
645
- })
96
+ }),
646
97
  ).toEqual(expected);
647
- }
98
+ },
648
99
  );
649
100
  });
650
101
 
@@ -694,6 +145,66 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
694
145
  },
695
146
  ])(
696
147
  `should return responsive styles for size $input`,
148
+ ({ input, expected }) => {
149
+ expect(
150
+ getResponsiveStyleVariables({
151
+ fundingEligibility,
152
+ shouldApplyRebrandedStyles,
153
+ size: input,
154
+ }),
155
+ ).toEqual(expected);
156
+ },
157
+ );
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`,
697
208
  ({ input, expected }) => {
698
209
  expect(
699
210
  getResponsiveStyleVariables({
@@ -705,6 +216,7 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
705
216
  }
706
217
  );
707
218
  });
219
+
708
220
  describe("test responsive style variables for rebranded buttons", () => {
709
221
  test.each([
710
222
  {
@@ -745,9 +257,9 @@ describe("test responsive style variables for rebranded buttons", () => {
745
257
  expect(
746
258
  getResponsiveRebrandedStyleVariables({
747
259
  redesignSize: input,
748
- })
260
+ }),
749
261
  ).toEqual(expected);
750
- }
262
+ },
751
263
  );
752
264
  });
753
265
  describe("test responsive style variables for legacy disable max height", () => {
@@ -805,9 +317,9 @@ describe("test responsive style variables for legacy disable max height", () =>
805
317
  fundingEligibility,
806
318
  shouldApplyRebrandedStyles,
807
319
  disableMaxHeightSize: input,
808
- })
320
+ }),
809
321
  ).toEqual(expected);
810
- }
322
+ },
811
323
  );
812
324
  });
813
325
  describe("test responsive style variables when shouldResizeLabel == true for disable max height", () => {
@@ -872,6 +384,82 @@ describe("test responsive style variables when shouldResizeLabel == true for dis
872
384
  },
873
385
  ])(
874
386
  `should return responsive styles for disable max height size $input`,
387
+ ({ input, expected }) => {
388
+ expect(
389
+ getDisableMaxHeightResponsiveStyleVariables({
390
+ fundingEligibility,
391
+ shouldApplyRebrandedStyles,
392
+ disableMaxHeightSize: input,
393
+ }),
394
+ ).toEqual(expected);
395
+ },
396
+ );
397
+ });
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`,
875
463
  ({ input, expected }) => {
876
464
  expect(
877
465
  getDisableMaxHeightResponsiveStyleVariables({
@@ -939,8 +527,8 @@ describe("test rebrand responsive style variables for disable max height", () =>
939
527
  fundingEligibility,
940
528
  shouldApplyRebrandedStyles,
941
529
  disableMaxHeightSize: input,
942
- })
530
+ }),
943
531
  ).toMatchObject(expected);
944
- }
532
+ },
945
533
  );
946
534
  });