@paypal/checkout-components 5.0.402 → 5.0.404-alpha-e012ebc.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/constants/class.js +0 -2
- package/src/funding/paylater/config.jsx +7 -0
- package/src/ui/buttons/button.jsx +1 -5
- package/src/ui/buttons/buttons.jsx +1 -7
- package/src/ui/buttons/props.js +0 -4
- package/src/ui/buttons/styles/button.js +0 -7
- package/src/ui/buttons/styles/styleUtils.js +2 -0
- package/src/ui/buttons/styles/styleUtils.test.constants.js +738 -0
- package/src/ui/buttons/styles/styleUtils.test.js +192 -647
- package/src/zoid/buttons/component.jsx +0 -6
- package/src/ui/buttons/button.test.js +0 -59
|
@@ -7,659 +7,67 @@ 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
|
-
|
|
75
|
-
|
|
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: 19,
|
|
402
|
-
fontSize: 10,
|
|
403
|
-
marginTop: 1,
|
|
404
|
-
pillBorderRadius: 13,
|
|
405
|
-
spinnerSize: 13,
|
|
406
|
-
gap: 3,
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
const expectedRebrandDisableMaxHeightStylesSmall = {
|
|
410
|
-
APMHeight: 20,
|
|
411
|
-
applePayHeight: 29,
|
|
412
|
-
buttonHeight: 30,
|
|
413
|
-
disableHeightStyle:
|
|
414
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
415
|
-
labelHeight: 23,
|
|
416
|
-
fontSize: 11,
|
|
417
|
-
marginTop: 1,
|
|
418
|
-
pillBorderRadius: 15,
|
|
419
|
-
spinnerSize: 15,
|
|
420
|
-
gap: 3,
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const expectedRebrandDisableMaxHeightStylesMediumSmall = {
|
|
424
|
-
APMHeight: 23,
|
|
425
|
-
applePayHeight: 33,
|
|
426
|
-
buttonHeight: 35,
|
|
427
|
-
disableHeightStyle:
|
|
428
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
429
|
-
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
430
|
-
],
|
|
431
|
-
labelHeight: 27,
|
|
432
|
-
fontSize: 13,
|
|
433
|
-
marginTop: 1,
|
|
434
|
-
pillBorderRadius: 18,
|
|
435
|
-
spinnerSize: 18,
|
|
436
|
-
gap: 4,
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
const expectedRebrandDisableMaxHeightStylesMediumBig = {
|
|
440
|
-
APMHeight: 25,
|
|
441
|
-
applePayHeight: 37,
|
|
442
|
-
buttonHeight: 40,
|
|
443
|
-
disableHeightStyle:
|
|
444
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
445
|
-
labelHeight: 30,
|
|
446
|
-
fontSize: 14,
|
|
447
|
-
marginTop: 1,
|
|
448
|
-
pillBorderRadius: 20,
|
|
449
|
-
spinnerSize: 20,
|
|
450
|
-
gap: 4,
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
const expectedRebrandDisableMaxHeightStylesLargeSmall = {
|
|
454
|
-
APMHeight: 28,
|
|
455
|
-
applePayHeight: 41,
|
|
456
|
-
buttonHeight: 45,
|
|
457
|
-
disableHeightStyle:
|
|
458
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
459
|
-
labelHeight: 34,
|
|
460
|
-
fontSize: 16,
|
|
461
|
-
marginTop: 2,
|
|
462
|
-
pillBorderRadius: 23,
|
|
463
|
-
spinnerSize: 23,
|
|
464
|
-
gap: 5,
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
const expectedRebrandDisableMaxHeightStylesLargeBig = {
|
|
468
|
-
APMHeight: 30,
|
|
469
|
-
applePayHeight: 45,
|
|
470
|
-
buttonHeight: 50,
|
|
471
|
-
disableHeightStyle:
|
|
472
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
473
|
-
labelHeight: 38,
|
|
474
|
-
fontSize: 18,
|
|
475
|
-
marginTop: 2,
|
|
476
|
-
pillBorderRadius: 25,
|
|
477
|
-
spinnerSize: 25,
|
|
478
|
-
gap: 5,
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
const expectedRebrandDisableMaxHeightStylesXL = {
|
|
482
|
-
APMHeight: 33,
|
|
483
|
-
applePayHeight: 49,
|
|
484
|
-
buttonHeight: 55,
|
|
485
|
-
disableHeightStyle:
|
|
486
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
487
|
-
labelHeight: 42,
|
|
488
|
-
fontSize: 20,
|
|
489
|
-
marginTop: 2,
|
|
490
|
-
pillBorderRadius: 28,
|
|
491
|
-
spinnerSize: 28,
|
|
492
|
-
gap: 6,
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
const expectedRebrandDisableMaxHeightStylesXXL = {
|
|
496
|
-
APMHeight: 38,
|
|
497
|
-
applePayHeight: 57,
|
|
498
|
-
buttonHeight: 65,
|
|
499
|
-
disableHeightStyle:
|
|
500
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
501
|
-
labelHeight: 49,
|
|
502
|
-
fontSize: 23,
|
|
503
|
-
marginTop: 2,
|
|
504
|
-
pillBorderRadius: 33,
|
|
505
|
-
spinnerSize: 33,
|
|
506
|
-
gap: 7,
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
510
|
-
APMHeight: 43,
|
|
511
|
-
applePayHeight: 65,
|
|
512
|
-
buttonHeight: 75,
|
|
513
|
-
disableHeightStyle:
|
|
514
|
-
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
515
|
-
labelHeight: 57,
|
|
516
|
-
fontSize: 27,
|
|
517
|
-
marginTop: 3,
|
|
518
|
-
pillBorderRadius: 38,
|
|
519
|
-
spinnerSize: 38,
|
|
520
|
-
gap: 7,
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
// expected rebrand responsive styles variables
|
|
524
|
-
const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
525
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.EXTRA_SMALL],
|
|
526
|
-
buttonHeight: 20,
|
|
527
|
-
pillBorderRadius: 10,
|
|
528
|
-
gap: 3,
|
|
529
|
-
defaultHeight: 20,
|
|
530
|
-
minHeight: 20,
|
|
531
|
-
maxHeight: 30,
|
|
532
|
-
minWidth: 50,
|
|
533
|
-
minDualWidth: 300,
|
|
534
|
-
maxWidth: 75,
|
|
535
|
-
fontSize: 12,
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
const expectedRebrandedResponsiveStylesTiny = {
|
|
539
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.TINY],
|
|
540
|
-
buttonHeight: 25,
|
|
541
|
-
pillBorderRadius: 13,
|
|
542
|
-
gap: 3,
|
|
543
|
-
defaultHeight: 25,
|
|
544
|
-
minHeight: 25,
|
|
545
|
-
maxHeight: 30,
|
|
546
|
-
minWidth: 75,
|
|
547
|
-
minDualWidth: 300,
|
|
548
|
-
maxWidth: 200,
|
|
549
|
-
fontSize: 12,
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
const expectedRebrandedResponsiveStylesSmall = {
|
|
553
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.SMALL],
|
|
554
|
-
buttonHeight: 35,
|
|
555
|
-
pillBorderRadius: 18,
|
|
556
|
-
gap: 3,
|
|
557
|
-
defaultHeight: 35,
|
|
558
|
-
minHeight: 30,
|
|
559
|
-
maxHeight: 35,
|
|
560
|
-
minWidth: 200,
|
|
561
|
-
minDualWidth: 300,
|
|
562
|
-
maxWidth: 250,
|
|
563
|
-
fontSize: 14,
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
567
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_SMALL],
|
|
568
|
-
buttonHeight: 35,
|
|
569
|
-
pillBorderRadius: 18,
|
|
570
|
-
gap: 4,
|
|
571
|
-
defaultHeight: 35,
|
|
572
|
-
minHeight: 35,
|
|
573
|
-
maxHeight: 40,
|
|
574
|
-
minWidth: 250,
|
|
575
|
-
minDualWidth: 300,
|
|
576
|
-
maxWidth: 300,
|
|
577
|
-
fontSize: 16,
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
const expectedRebrandedResponsiveStylesMediumBig = {
|
|
581
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_BIG],
|
|
582
|
-
buttonHeight: 45,
|
|
583
|
-
pillBorderRadius: 23,
|
|
584
|
-
gap: 4,
|
|
585
|
-
defaultHeight: 45,
|
|
586
|
-
minHeight: 40,
|
|
587
|
-
maxHeight: 45,
|
|
588
|
-
minWidth: 300,
|
|
589
|
-
minDualWidth: 300,
|
|
590
|
-
maxWidth: 350,
|
|
591
|
-
fontSize: 16,
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
595
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_SMALL],
|
|
596
|
-
buttonHeight: 45,
|
|
597
|
-
pillBorderRadius: 23,
|
|
598
|
-
gap: 5,
|
|
599
|
-
defaultHeight: 45,
|
|
600
|
-
minHeight: 45,
|
|
601
|
-
maxHeight: 50,
|
|
602
|
-
minWidth: 350,
|
|
603
|
-
minDualWidth: 300,
|
|
604
|
-
maxWidth: 425,
|
|
605
|
-
fontSize: 18,
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
const expectedRebrandedResponsiveStylesLargeBig = {
|
|
609
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_BIG],
|
|
610
|
-
buttonHeight: 45,
|
|
611
|
-
pillBorderRadius: 23,
|
|
612
|
-
gap: 5,
|
|
613
|
-
defaultHeight: 45,
|
|
614
|
-
minHeight: 50,
|
|
615
|
-
maxHeight: 55,
|
|
616
|
-
minWidth: 425,
|
|
617
|
-
minDualWidth: 300,
|
|
618
|
-
maxWidth: 500,
|
|
619
|
-
fontSize: 20,
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const expectedRebrandedResponsiveStylesXlSmall = {
|
|
623
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_SMALL],
|
|
624
|
-
buttonHeight: 55,
|
|
625
|
-
pillBorderRadius: 28,
|
|
626
|
-
gap: 6,
|
|
627
|
-
defaultHeight: 55,
|
|
628
|
-
minHeight: 55,
|
|
629
|
-
maxHeight: 60,
|
|
630
|
-
minWidth: 500,
|
|
631
|
-
minDualWidth: 300,
|
|
632
|
-
maxWidth: 550,
|
|
633
|
-
fontSize: 22,
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
const expectedRebrandedResponsiveStylesXlBig = {
|
|
637
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_BIG],
|
|
638
|
-
buttonHeight: 55,
|
|
639
|
-
pillBorderRadius: 28,
|
|
640
|
-
gap: 7,
|
|
641
|
-
defaultHeight: 55,
|
|
642
|
-
minHeight: 60,
|
|
643
|
-
maxHeight: 65,
|
|
644
|
-
minWidth: 550,
|
|
645
|
-
minDualWidth: 300,
|
|
646
|
-
maxWidth: 650,
|
|
647
|
-
fontSize: 24,
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
const expectedRebrandedResponsiveStylesXXL = {
|
|
651
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XXL],
|
|
652
|
-
buttonHeight: 55,
|
|
653
|
-
pillBorderRadius: 28,
|
|
654
|
-
gap: 7,
|
|
655
|
-
defaultHeight: 55,
|
|
656
|
-
minHeight: 65,
|
|
657
|
-
maxHeight: 100,
|
|
658
|
-
minWidth: 650,
|
|
659
|
-
minDualWidth: 300,
|
|
660
|
-
maxWidth: 750,
|
|
661
|
-
fontSize: 26,
|
|
662
|
-
};
|
|
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
|
+
expectedRebrandedResponsiveStylesXlBig,
|
|
69
|
+
expectedRebrandedResponsiveStylesXXL,
|
|
70
|
+
} from "./styleUtils.test.constants";
|
|
663
71
|
|
|
664
72
|
describe("test responsive style variables for legacy", () => {
|
|
665
73
|
const shouldApplyRebrandedStyles = false;
|
|
@@ -750,6 +158,67 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
|
|
|
750
158
|
}
|
|
751
159
|
);
|
|
752
160
|
});
|
|
161
|
+
|
|
162
|
+
// Separate describe block needed because JavaScript objects cannot have multiple values for paylater.variant
|
|
163
|
+
// AT and DE both use German labels and trigger shouldResizeLabel, but backend returns distinct variants
|
|
164
|
+
describe("test responsive style variables when shouldResizeLabel == true for Austria variant", () => {
|
|
165
|
+
const shouldApplyRebrandedStyles = false;
|
|
166
|
+
|
|
167
|
+
const fundingEligibility = {
|
|
168
|
+
paypal: {
|
|
169
|
+
eligible: true,
|
|
170
|
+
branded: undefined,
|
|
171
|
+
},
|
|
172
|
+
paylater: {
|
|
173
|
+
eligible: true,
|
|
174
|
+
products: {
|
|
175
|
+
paylater: {
|
|
176
|
+
variant: "AT",
|
|
177
|
+
},
|
|
178
|
+
payIn3: {
|
|
179
|
+
variant: null,
|
|
180
|
+
},
|
|
181
|
+
payIn4: {
|
|
182
|
+
variant: null,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
test.each([
|
|
188
|
+
{
|
|
189
|
+
input: BUTTON_SIZE.TINY,
|
|
190
|
+
expected: expectedResizeLabelResponsiveStylesTiny,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
input: BUTTON_SIZE.SMALL,
|
|
194
|
+
expected: expectedResizeLabelResponsiveStylesSmall,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
input: BUTTON_SIZE.MEDIUM,
|
|
198
|
+
expected: expectedResizeLabelResponsiveStylesMedium,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
input: BUTTON_SIZE.LARGE,
|
|
202
|
+
expected: expectedResizeLabelResponsiveStylesLarge,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
input: BUTTON_SIZE.HUGE,
|
|
206
|
+
expected: expectedResizeLabelResponsiveStylesHuge,
|
|
207
|
+
},
|
|
208
|
+
])(
|
|
209
|
+
`should return responsive styles for size $input with AT variant`,
|
|
210
|
+
({ input, expected }) => {
|
|
211
|
+
expect(
|
|
212
|
+
getResponsiveStyleVariables({
|
|
213
|
+
fundingEligibility,
|
|
214
|
+
shouldApplyRebrandedStyles,
|
|
215
|
+
size: input,
|
|
216
|
+
})
|
|
217
|
+
).toEqual(expected);
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
|
|
753
222
|
describe("test responsive style variables for rebranded buttons", () => {
|
|
754
223
|
test.each([
|
|
755
224
|
{
|
|
@@ -937,6 +406,82 @@ describe("test responsive style variables when shouldResizeLabel == true for dis
|
|
|
937
406
|
);
|
|
938
407
|
});
|
|
939
408
|
|
|
409
|
+
// Separate describe block needed because JavaScript objects cannot have multiple values for paylater.variant
|
|
410
|
+
// AT and DE both use German labels and trigger shouldResizeLabel, but backend returns distinct variants
|
|
411
|
+
describe("test responsive style variables when shouldResizeLabel == true for disable max height with Austria variant", () => {
|
|
412
|
+
const shouldApplyRebrandedStyles = false;
|
|
413
|
+
|
|
414
|
+
const fundingEligibility = {
|
|
415
|
+
paypal: {
|
|
416
|
+
eligible: true,
|
|
417
|
+
branded: undefined,
|
|
418
|
+
},
|
|
419
|
+
paylater: {
|
|
420
|
+
eligible: true,
|
|
421
|
+
products: {
|
|
422
|
+
paylater: {
|
|
423
|
+
variant: "AT",
|
|
424
|
+
},
|
|
425
|
+
payIn3: {
|
|
426
|
+
variant: null,
|
|
427
|
+
},
|
|
428
|
+
payIn4: {
|
|
429
|
+
variant: null,
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
test.each([
|
|
435
|
+
{
|
|
436
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY,
|
|
437
|
+
expected: expectedResizeLabelDisableMaxHeightStylesTiny,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL,
|
|
441
|
+
expected: expectedResizeLabelDisableMaxHeightStylesSmall,
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL,
|
|
445
|
+
expected: expectedResizeLabelDisableMaxHeightStylesMediumSmall,
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG,
|
|
449
|
+
expected: expectedResizeLabelDisableMaxHeightStylesMediumBig,
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL,
|
|
453
|
+
expected: expectedResizeLabelDisableMaxHeightStylesLargeSmall,
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG,
|
|
457
|
+
expected: expectedResizeLabelDisableMaxHeightStylesLargeBig,
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL,
|
|
461
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXL,
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL,
|
|
465
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXXL,
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
input: BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL,
|
|
469
|
+
expected: expectedResizeLabelDisableMaxHeightStylesXXXL,
|
|
470
|
+
},
|
|
471
|
+
])(
|
|
472
|
+
`should return responsive styles for disable max height size $input with AT variant`,
|
|
473
|
+
({ input, expected }) => {
|
|
474
|
+
expect(
|
|
475
|
+
getDisableMaxHeightResponsiveStyleVariables({
|
|
476
|
+
fundingEligibility,
|
|
477
|
+
shouldApplyRebrandedStyles,
|
|
478
|
+
disableMaxHeightSize: input,
|
|
479
|
+
})
|
|
480
|
+
).toEqual(expected);
|
|
481
|
+
}
|
|
482
|
+
);
|
|
483
|
+
});
|
|
484
|
+
|
|
940
485
|
describe("test rebrand responsive style variables for disable max height", () => {
|
|
941
486
|
const shouldApplyRebrandedStyles = true;
|
|
942
487
|
|