@stylexjs/stylex 0.2.0-beta.19 → 0.2.0-beta.21

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.
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ var _stylex = require("../stylex");
4
+ const mockOptions = {
5
+ customProperties: {
6
+ testVar: "red",
7
+ testVar2: "blue",
8
+ boxShadowVar1: "5px 5px 5px black",
9
+ rawNumber: 10,
10
+ pixelNumber: "10px",
11
+ emNumber: "10em",
12
+ refToRawNumber: "var(--rawNumber)",
13
+ refToPixelNumber: "var(--pixelNumber)",
14
+ refToRefToRawNumber: "var(--refToRawNumber)"
15
+ },
16
+ viewportHeight: 600,
17
+ viewportWidth: 320
18
+ };
19
+ function resolveColorValue(colorValue) {
20
+ const styles = _stylex.stylex.create({
21
+ root: {
22
+ color: colorValue
23
+ }
24
+ });
25
+ return _stylex.stylex.spread(styles.root, mockOptions).style.color;
26
+ }
27
+ describe("stylex CSSCustomProperty value test", () => {
28
+ beforeEach(() => {
29
+ jest.spyOn(console, "warn");
30
+ console.warn.mockImplementation(() => {});
31
+ });
32
+ afterEach(() => {
33
+ console.warn.mockRestore();
34
+ });
35
+ test("parses a basic variable correctly", () => {
36
+ expect(resolveColorValue("var(--testVar)")).toEqual("red");
37
+ });
38
+ test("parses kebab case to camel case", () => {
39
+ expect(resolveColorValue("var(--test-var)")).toEqual("red");
40
+ });
41
+ test("parses a variable with a default value", () => {
42
+ expect(resolveColorValue("var(--testVar, blue)")).toEqual("red");
43
+ expect(resolveColorValue("var(--notFound, blue)")).toEqual("blue");
44
+ });
45
+ test("parses kebab case with a default value", () => {
46
+ expect(resolveColorValue("var(--test-var, blue)")).toEqual("red");
47
+ expect(resolveColorValue("var(--not-found, blue)")).toEqual("blue");
48
+ });
49
+ test("parses a variable with a default value with spaces", () => {
50
+ const styles = _stylex.stylex.create({
51
+ root: {
52
+ boxShadow: "var(--boxShadowVar1, 0px 0px 0px black)"
53
+ }
54
+ });
55
+ expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
56
+ });
57
+ test("falls back to a default value with spaces", () => {
58
+ const styles = _stylex.stylex.create({
59
+ root: {
60
+ boxShadow: "var(--boxShadowVarNotFound, 0px 0px 0px black)"
61
+ }
62
+ });
63
+ expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
64
+ });
65
+ test("parses and falls back to default value containing a variable", () => {
66
+ const styles = _stylex.stylex.create({
67
+ root: {
68
+ color: "var(--colorNotFound, var(--testVar2))"
69
+ }
70
+ });
71
+ expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
72
+ });
73
+ test("parses and falls back to a default value containing spaces and embedded variables", () => {
74
+ const styles = _stylex.stylex.create({
75
+ root: {
76
+ boxShadow: "var(--boxShadowVarNotFound, 0px 0px 0px var(--testVar2))"
77
+ }
78
+ });
79
+ expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
80
+ });
81
+ test("does not parse malformed vars", () => {
82
+ expect(resolveColorValue("var(--testUnfinished")).toEqual("var(--testUnfinished");
83
+ expect(resolveColorValue("var(bad--input)")).toEqual("var(bad--input)");
84
+ expect(resolveColorValue("--testMulti")).toEqual("--testMulti");
85
+ expect(resolveColorValue("var ( --testMulti)")).toEqual("var ( --testMulti)");
86
+ });
87
+ test("basic value lookup works", () => {
88
+ const styles = _stylex.stylex.create({
89
+ root: {
90
+ borderWidth: 10
91
+ },
92
+ withVars: {
93
+ borderWidth: "var(--rawNumber)"
94
+ }
95
+ });
96
+ const rootStyle = _stylex.stylex.spread(styles.root, mockOptions).style;
97
+ expect(rootStyle.borderWidth).toEqual(10);
98
+ expect(_stylex.stylex.spread(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
99
+ });
100
+ test("value lookup with pixel prop conversion", () => {
101
+ const styles = _stylex.stylex.create({
102
+ root: {
103
+ borderWidth: "10px"
104
+ },
105
+ withVars: {
106
+ borderWidth: "var(--pixelNumber)"
107
+ }
108
+ });
109
+ const rootStyle = _stylex.stylex.spread(styles.root, mockOptions).style;
110
+ expect(rootStyle.borderWidth).toEqual(10);
111
+ expect(_stylex.stylex.spread(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
112
+ });
113
+ test("value lookup with em prop conversion", () => {
114
+ const styles = _stylex.stylex.create({
115
+ root: {
116
+ fontSize: "10em"
117
+ },
118
+ withVars: {
119
+ fontSize: "var(--emNumber)"
120
+ }
121
+ });
122
+ const rootStyle = _stylex.stylex.spread(styles.root, mockOptions).style;
123
+ expect(rootStyle.fontSize).toEqual(160);
124
+ expect(_stylex.stylex.spread(styles.withVars, mockOptions).style.fontSize).toEqual(rootStyle.fontSize);
125
+ });
126
+ test("prop lookup with ref", () => {
127
+ const styles = _stylex.stylex.create({
128
+ root: {
129
+ borderWidth: "var(--refToRawNumber)"
130
+ },
131
+ withVars: {
132
+ borderWidth: "var(--refToPixelNumber)"
133
+ }
134
+ });
135
+ const rootStyle = _stylex.stylex.spread(styles.root, mockOptions).style;
136
+ expect(rootStyle.borderWidth).toEqual(10);
137
+ expect(_stylex.stylex.spread(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
138
+ });
139
+ test("prop lookup with ref to ref", () => {
140
+ const styles = _stylex.stylex.create({
141
+ root: {
142
+ borderWidth: "var(--refToRefToRawNumber)"
143
+ }
144
+ });
145
+ const rootStyle = _stylex.stylex.spread(styles.root, mockOptions).style;
146
+ expect(rootStyle.borderWidth).toEqual(10);
147
+ });
148
+ });
@@ -8,11 +8,11 @@ const mockOptions = {
8
8
  };
9
9
  describe("styles", () => {
10
10
  beforeEach(() => {
11
- jest.spyOn(console, "error");
12
- console.error.mockImplementation(() => {});
11
+ jest.spyOn(console, "warn");
12
+ console.warn.mockImplementation(() => {});
13
13
  });
14
14
  afterEach(() => {
15
- console.error.mockRestore();
15
+ console.warn.mockRestore();
16
16
  });
17
17
  test("animation-delay", () => {
18
18
  const styles = _stylex.stylex.create({
@@ -37,7 +37,7 @@ describe("styles", () => {
37
37
  }
38
38
  });
39
39
  _stylex.stylex.spread(styles.root, mockOptions);
40
- expect(console.error).toHaveBeenCalled();
40
+ expect(console.warn).toHaveBeenCalled();
41
41
  });
42
42
  test("border-style", () => {
43
43
  const styles = _stylex.stylex.create({
@@ -65,14 +65,91 @@ describe("styles", () => {
65
65
  }
66
66
  });
67
67
  _stylex.stylex.spread(styles2.root, mockOptions);
68
- expect(console.error).toHaveBeenCalledTimes(1);
68
+ expect(console.warn).toHaveBeenCalledTimes(1);
69
69
  const styles3 = _stylex.stylex.create({
70
70
  root: {
71
71
  boxShadow: "inset 1px 2px 3px 4px red"
72
72
  }
73
73
  });
74
74
  _stylex.stylex.spread(styles3.root, mockOptions);
75
- expect(console.error).toHaveBeenCalledTimes(2);
75
+ expect(console.warn).toHaveBeenCalledTimes(2);
76
+ });
77
+ test("box-sizing: content-box", () => {
78
+ const styles = _stylex.stylex.create({
79
+ width: {
80
+ boxSizing: "content-box",
81
+ borderWidth: 2,
82
+ padding: 10,
83
+ width: 100,
84
+ overflow: "hidden"
85
+ },
86
+ height: {
87
+ boxSizing: "content-box",
88
+ borderWidth: 2,
89
+ padding: 10,
90
+ height: 50
91
+ },
92
+ maxWidth: {
93
+ boxSizing: "content-box",
94
+ borderWidth: 2,
95
+ padding: 10,
96
+ maxWidth: 100
97
+ },
98
+ minWidth: {
99
+ boxSizing: "content-box",
100
+ borderWidth: 2,
101
+ padding: 10,
102
+ minWidth: 100
103
+ },
104
+ maxHeight: {
105
+ boxSizing: "content-box",
106
+ borderWidth: 2,
107
+ padding: 10,
108
+ maxHeight: 50
109
+ },
110
+ minHeight: {
111
+ boxSizing: "content-box",
112
+ borderWidth: 2,
113
+ padding: 10,
114
+ minHeight: 50
115
+ },
116
+ units: {
117
+ boxSizing: "content-box",
118
+ borderWidth: 2,
119
+ padding: "1rem",
120
+ width: "100px",
121
+ height: 50
122
+ },
123
+ allDifferent: {
124
+ boxSizing: "content-box",
125
+ borderTopWidth: 1,
126
+ borderRightWidth: 2,
127
+ borderBottomWidth: 3,
128
+ borderLeftWidth: 4,
129
+ paddingTop: 10,
130
+ paddingRight: 20,
131
+ paddingBottom: 30,
132
+ paddingLeft: 40,
133
+ width: 100,
134
+ height: 100
135
+ },
136
+ auto: {
137
+ boxSizing: "content-box",
138
+ borderWidth: 2,
139
+ padding: 10,
140
+ height: 50,
141
+ width: "auto"
142
+ }
143
+ });
144
+ expect(_stylex.stylex.spread(styles.width, mockOptions)).toMatchSnapshot("width");
145
+ expect(_stylex.stylex.spread(styles.height, mockOptions)).toMatchSnapshot("height");
146
+ expect(_stylex.stylex.spread(styles.maxWidth, mockOptions)).toMatchSnapshot("maxWidth");
147
+ expect(_stylex.stylex.spread(styles.maxHeight, mockOptions)).toMatchSnapshot("maxHeight");
148
+ expect(_stylex.stylex.spread(styles.minWidth, mockOptions)).toMatchSnapshot("minWidth");
149
+ expect(_stylex.stylex.spread(styles.minHeight, mockOptions)).toMatchSnapshot("minHeight");
150
+ expect(_stylex.stylex.spread(styles.units, mockOptions)).toMatchSnapshot("units");
151
+ expect(_stylex.stylex.spread(styles.allDifferent, mockOptions)).toMatchSnapshot("allDifferent");
152
+ expect(_stylex.stylex.spread(styles.auto, mockOptions)).toMatchSnapshot("auto");
76
153
  });
77
154
  test("direction", () => {
78
155
  const styles = _stylex.stylex.create({
@@ -130,6 +207,26 @@ describe("styles", () => {
130
207
  });
131
208
  expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
132
209
  });
210
+ test("line-height", () => {
211
+ const styles = _stylex.stylex.create({
212
+ numeric: {
213
+ lineHeight: 1.5
214
+ },
215
+ string: {
216
+ lineHeight: "1.5"
217
+ },
218
+ rem: {
219
+ lineHeight: "1.5rem"
220
+ },
221
+ px: {
222
+ lineHeight: "24px"
223
+ }
224
+ });
225
+ expect(_stylex.stylex.spread(styles.numeric, mockOptions)).toMatchSnapshot("unitless number");
226
+ expect(_stylex.stylex.spread(styles.string, mockOptions)).toMatchSnapshot("unitless string");
227
+ expect(_stylex.stylex.spread(styles.rem, mockOptions)).toMatchSnapshot("rem");
228
+ expect(_stylex.stylex.spread(styles.px, mockOptions)).toMatchSnapshot("px");
229
+ });
133
230
  test("object-fit", () => {
134
231
  const styles = _stylex.stylex.create({
135
232
  contain: {
@@ -180,12 +277,12 @@ describe("styles", () => {
180
277
  position: "sticky"
181
278
  }
182
279
  });
183
- expect(console.error).toHaveBeenCalledTimes(2);
184
280
  expect(_stylex.stylex.spread(styles.static, mockOptions)).toMatchSnapshot("static");
185
281
  expect(_stylex.stylex.spread(styles.relative, mockOptions)).toMatchSnapshot("relative");
186
282
  expect(_stylex.stylex.spread(styles.absolute, mockOptions)).toMatchSnapshot("absolute");
187
283
  expect(_stylex.stylex.spread(styles.fixed, mockOptions)).toMatchSnapshot("fixed");
188
284
  expect(_stylex.stylex.spread(styles.sticky, mockOptions)).toMatchSnapshot("sticky");
285
+ expect(console.warn).toHaveBeenCalledTimes(3);
189
286
  });
190
287
  test("text-shadow", () => {
191
288
  const styles = _stylex.stylex.create({
@@ -200,7 +297,7 @@ describe("styles", () => {
200
297
  }
201
298
  });
202
299
  expect(_stylex.stylex.spread(styles2.root, mockOptions)).toMatchSnapshot();
203
- expect(console.error).toHaveBeenCalledTimes(1);
300
+ expect(console.warn).toHaveBeenCalledTimes(1);
204
301
  });
205
302
  test("transform", () => {
206
303
  const styles = _stylex.stylex.create({
@@ -279,7 +376,107 @@ describe("styles", () => {
279
376
  expect(_stylex.stylex.spread(styles.middle, mockOptions)).toMatchSnapshot("middle");
280
377
  expect(_stylex.stylex.spread(styles.top, mockOptions)).toMatchSnapshot("top");
281
378
  });
282
- test("logical border radius", () => {
379
+ });
380
+ describe("logical styles", () => {
381
+ test("blockSize", () => {
382
+ const styles = _stylex.stylex.create({
383
+ blockSize: {
384
+ blockSize: "100px"
385
+ },
386
+ maxBlockSize: {
387
+ maxBlockSize: "100px"
388
+ },
389
+ minBlockSize: {
390
+ minBlockSize: "100px"
391
+ }
392
+ });
393
+ expect(_stylex.stylex.spread(styles.blockSize, mockOptions)).toMatchSnapshot("blockSize");
394
+ expect(_stylex.stylex.spread([{
395
+ height: 200
396
+ }, styles.blockSize], mockOptions)).toMatchSnapshot("blockSize after height");
397
+ expect(_stylex.stylex.spread(styles.maxBlockSize, mockOptions)).toMatchSnapshot("maxBlockSize");
398
+ expect(_stylex.stylex.spread([{
399
+ maxHeight: 200
400
+ }, styles.maxBlockSize], mockOptions)).toMatchSnapshot("maxBlockSize after maxHeight");
401
+ expect(_stylex.stylex.spread(styles.minBlockSize, mockOptions)).toMatchSnapshot("minBlockSize");
402
+ expect(_stylex.stylex.spread([{
403
+ minHeight: 200
404
+ }, styles.minBlockSize], mockOptions)).toMatchSnapshot("minBlockSize after minHeight");
405
+ });
406
+ test("inlineSize", () => {
407
+ const styles = _stylex.stylex.create({
408
+ inlineSize: {
409
+ inlineSize: "100px"
410
+ },
411
+ maxInlineSize: {
412
+ maxInlineSize: "100px"
413
+ },
414
+ minInlineSize: {
415
+ minInlineSize: "100px"
416
+ }
417
+ });
418
+ expect(_stylex.stylex.spread(styles.inlineSize, mockOptions)).toMatchSnapshot("inlineSize");
419
+ expect(_stylex.stylex.spread([{
420
+ width: 200
421
+ }, styles.inlineSize], mockOptions)).toMatchSnapshot("inlineSize after width");
422
+ expect(_stylex.stylex.spread(styles.maxInlineSize, mockOptions)).toMatchSnapshot("maxInlineSize");
423
+ expect(_stylex.stylex.spread([{
424
+ maxWidth: 200
425
+ }, styles.maxInlineSize], mockOptions)).toMatchSnapshot("maxInlineSize after maxWidth");
426
+ expect(_stylex.stylex.spread(styles.minInlineSize, mockOptions)).toMatchSnapshot("minInlineSize");
427
+ expect(_stylex.stylex.spread([{
428
+ minWidth: 200
429
+ }, styles.minInlineSize], mockOptions)).toMatchSnapshot("minInlineSize after minWidth");
430
+ });
431
+ test("borderBlock", () => {
432
+ const styles = _stylex.stylex.create({
433
+ borderBlock: {
434
+ borderBlockColor: "black",
435
+ borderBlockStyle: "solid",
436
+ borderBlockWidth: 1
437
+ },
438
+ borderBlockEnd: {
439
+ borderBlockEndColor: "red",
440
+ borderBlockEndStyle: "dotted",
441
+ borderBlockEndWidth: 2
442
+ },
443
+ borderBlockStart: {
444
+ borderBlockStartColor: "green",
445
+ borderBlockStartStyle: "dashed",
446
+ borderBlockStartWidth: 3
447
+ }
448
+ });
449
+ expect(_stylex.stylex.spread(styles.borderBlock, mockOptions)).toMatchSnapshot("borderBlock");
450
+ expect(_stylex.stylex.spread(styles.borderBlockEnd, mockOptions)).toMatchSnapshot("borderBlockEnd");
451
+ expect(_stylex.stylex.spread(styles.borderBlockStart, mockOptions)).toMatchSnapshot("borderBlockStart");
452
+ expect(_stylex.stylex.spread([styles.borderBlockEnd, styles.borderBlock], mockOptions)).toMatchSnapshot("borderBlock after borderBlockEnd");
453
+ expect(_stylex.stylex.spread([styles.borderBlockStart, styles.borderBlock], mockOptions)).toMatchSnapshot("borderBlock after borderBlockStart");
454
+ });
455
+ test("borderInline", () => {
456
+ const styles = _stylex.stylex.create({
457
+ borderInline: {
458
+ borderInlineColor: "black",
459
+ borderInlineStyle: "solid",
460
+ borderInlineWidth: 1
461
+ },
462
+ borderInlineEnd: {
463
+ borderInlineEndColor: "red",
464
+ borderInlineEndStyle: "dotted",
465
+ borderInlineEndWidth: 2
466
+ },
467
+ borderInlineStart: {
468
+ borderInlineStartColor: "green",
469
+ borderInlineStartStyle: "dashed",
470
+ borderInlineStartWidth: 3
471
+ }
472
+ });
473
+ expect(_stylex.stylex.spread(styles.borderInline, mockOptions)).toMatchSnapshot("borderInline");
474
+ expect(_stylex.stylex.spread(styles.borderInlineEnd, mockOptions)).toMatchSnapshot("borderInlineEnd");
475
+ expect(_stylex.stylex.spread(styles.borderInlineStart, mockOptions)).toMatchSnapshot("borderInlineStart");
476
+ expect(_stylex.stylex.spread([styles.borderInlineEnd, styles.borderInline], mockOptions)).toMatchSnapshot("borderInline after borderInlineEnd");
477
+ expect(_stylex.stylex.spread([styles.borderInlineStart, styles.borderInline], mockOptions)).toMatchSnapshot("borderInline after borderInlineStart");
478
+ });
479
+ test("borderRadius", () => {
283
480
  const styles = _stylex.stylex.create({
284
481
  startstart: {
285
482
  borderStartStartRadius: 10
@@ -299,34 +496,133 @@ describe("styles", () => {
299
496
  expect(_stylex.stylex.spread(styles.endstart, mockOptions)).toMatchSnapshot("endstart");
300
497
  expect(_stylex.stylex.spread(styles.endend, mockOptions)).toMatchSnapshot("endend");
301
498
  });
302
- test.skip("logical border short-forms", () => {
499
+ test.skip("borderStyle", () => {
303
500
  const styles = _stylex.stylex.create({
304
501
  root: {}
305
502
  });
306
503
  expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
307
504
  });
308
- test.skip("logical border long-forms", () => {
505
+ test.skip("borderWidth", () => {
309
506
  const styles = _stylex.stylex.create({
310
507
  root: {}
311
508
  });
312
509
  expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
313
510
  });
314
- test.skip("logical inset short-forms", () => {
511
+ test("inset", () => {
315
512
  const styles = _stylex.stylex.create({
316
- root: {
317
- insetBlock: 5,
318
- insetInline: 10
513
+ inset: {
514
+ inset: 1
515
+ },
516
+ insetBlock: {
517
+ insetBlock: 2
518
+ },
519
+ insetBlockStart: {
520
+ insetBlockStart: 3
521
+ },
522
+ insetBlockEnd: {
523
+ insetBlockEnd: 4
524
+ },
525
+ insetInline: {
526
+ insetInline: 5
527
+ },
528
+ insetInlineStart: {
529
+ insetInlineStart: 6
530
+ },
531
+ insetInlineEnd: {
532
+ insetInlineEnd: 7
533
+ }
534
+ });
535
+ expect(_stylex.stylex.spread(styles.inset, mockOptions)).toMatchSnapshot("inset");
536
+ expect(_stylex.stylex.spread(styles.insetBlock, mockOptions)).toMatchSnapshot("insetBlock");
537
+ expect(_stylex.stylex.spread(styles.insetBlockStart, mockOptions)).toMatchSnapshot("insetBlockStart");
538
+ expect(_stylex.stylex.spread(styles.insetBlockEnd, mockOptions)).toMatchSnapshot("insetBlockEnd");
539
+ expect(_stylex.stylex.spread(styles.insetInline, mockOptions)).toMatchSnapshot("insetInline");
540
+ expect(_stylex.stylex.spread(styles.insetInlineStart, mockOptions)).toMatchSnapshot("insetInlineStart");
541
+ expect(_stylex.stylex.spread(styles.insetInlineEnd, mockOptions)).toMatchSnapshot("insetInlineEnd");
542
+ expect(_stylex.stylex.spread([{
543
+ left: 10,
544
+ right: 10,
545
+ bottom: 100,
546
+ top: 100
547
+ }, styles.insetBlockStart], mockOptions)).toMatchSnapshot("inset vs top");
548
+ expect(_stylex.stylex.spread([{
549
+ bottom: 100,
550
+ top: 100
551
+ }, styles.insetBlockStart], mockOptions)).toMatchSnapshot("insetBlock vs top");
552
+ expect(_stylex.stylex.spread([{
553
+ top: 100
554
+ }, styles.insetBlockStart], mockOptions)).toMatchSnapshot("insetBlockStart vs top");
555
+ expect(_stylex.stylex.spread([{
556
+ bottom: 100
557
+ }, styles.insetBlockEnd], mockOptions)).toMatchSnapshot("insetBlockEnd vs bottom");
558
+ });
559
+ test("margin", () => {
560
+ const styles = _stylex.stylex.create({
561
+ marginBlock: {
562
+ marginBlock: 1
563
+ },
564
+ marginBlockStart: {
565
+ marginBlockStart: 2
566
+ },
567
+ marginBlockEnd: {
568
+ marginBlockEnd: 3
569
+ },
570
+ marginInline: {
571
+ marginInline: 1
572
+ },
573
+ marginInlineStart: {
574
+ marginInlineStart: 2
575
+ },
576
+ marginInlineEnd: {
577
+ marginInlineEnd: 3
319
578
  }
320
579
  });
321
- expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
580
+ expect(_stylex.stylex.spread(styles.marginBlock, mockOptions)).toMatchSnapshot("marginBlock");
581
+ expect(_stylex.stylex.spread(styles.marginBlockStart, mockOptions)).toMatchSnapshot("marginBlockStart");
582
+ expect(_stylex.stylex.spread(styles.marginBlockEnd, mockOptions)).toMatchSnapshot("marginBlockEnd");
583
+ expect(_stylex.stylex.spread(styles.marginInline, mockOptions)).toMatchSnapshot("marginInline");
584
+ expect(_stylex.stylex.spread(styles.marginInlineStart, mockOptions)).toMatchSnapshot("marginInlineStart");
585
+ expect(_stylex.stylex.spread(styles.marginInlineEnd, mockOptions)).toMatchSnapshot("marginInlineEnd");
322
586
  });
323
- test.skip("logical text alignment", () => {
587
+ test("padding", () => {
324
588
  const styles = _stylex.stylex.create({
325
- root: {
589
+ paddingBlock: {
590
+ paddingBlock: 1
591
+ },
592
+ paddingBlockStart: {
593
+ paddingBlockStart: 2
594
+ },
595
+ paddingBlockEnd: {
596
+ paddingBlockEnd: 3
597
+ },
598
+ paddingInline: {
599
+ paddingInline: 1
600
+ },
601
+ paddingInlineStart: {
602
+ paddingInlineStart: 2
603
+ },
604
+ paddingInlineEnd: {
605
+ paddingInlineEnd: 3
606
+ }
607
+ });
608
+ expect(_stylex.stylex.spread(styles.paddingBlock, mockOptions)).toMatchSnapshot("paddingBlock");
609
+ expect(_stylex.stylex.spread(styles.paddingBlockStart, mockOptions)).toMatchSnapshot("paddingBlockStart");
610
+ expect(_stylex.stylex.spread(styles.paddingBlockEnd, mockOptions)).toMatchSnapshot("paddingBlockEnd");
611
+ expect(_stylex.stylex.spread(styles.paddingInline, mockOptions)).toMatchSnapshot("paddingInline");
612
+ expect(_stylex.stylex.spread(styles.paddingInlineStart, mockOptions)).toMatchSnapshot("paddingInlineStart");
613
+ expect(_stylex.stylex.spread(styles.paddingInlineEnd, mockOptions)).toMatchSnapshot("paddingInlineEnd");
614
+ });
615
+ test("textAlign", () => {
616
+ const styles = _stylex.stylex.create({
617
+ start: {
326
618
  textAlign: "start"
619
+ },
620
+ end: {
621
+ textAlign: "end"
327
622
  }
328
623
  });
329
- expect(_stylex.stylex.spread(styles.root, mockOptions)).toMatchSnapshot();
624
+ expect(_stylex.stylex.spread(styles.start, mockOptions)).toMatchSnapshot("start");
625
+ expect(_stylex.stylex.spread(styles.end, mockOptions)).toMatchSnapshot("end");
330
626
  });
331
627
  });
332
628
  describe("length units", () => {
@@ -469,13 +765,10 @@ describe("media queries", () => {
469
765
  });
470
766
  describe("unsupported style properties", () => {
471
767
  beforeEach(() => {
472
- jest.spyOn(console, "error");
473
- console.error.mockImplementation(() => {});
474
768
  jest.spyOn(console, "warn");
475
769
  console.warn.mockImplementation(() => {});
476
770
  });
477
771
  afterEach(() => {
478
- console.error.mockRestore();
479
772
  console.warn.mockRestore();
480
773
  });
481
774
  test("\"filter\"", () => {
@@ -487,7 +780,7 @@ describe("unsupported style properties", () => {
487
780
  }
488
781
  });
489
782
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
490
- expect(console.error).toHaveBeenCalled();
783
+ expect(console.warn).toHaveBeenCalled();
491
784
  });
492
785
  test("\"marginStart\"", () => {
493
786
  const {
@@ -498,7 +791,7 @@ describe("unsupported style properties", () => {
498
791
  }
499
792
  });
500
793
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
501
- expect(console.warn).not.toHaveBeenCalled();
794
+ expect(console.warn).toHaveBeenCalled();
502
795
  });
503
796
  test("\"marginEnd\"", () => {
504
797
  const {
@@ -509,7 +802,7 @@ describe("unsupported style properties", () => {
509
802
  }
510
803
  });
511
804
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
512
- expect(console.warn).not.toHaveBeenCalled();
805
+ expect(console.warn).toHaveBeenCalled();
513
806
  });
514
807
  test("\"marginHorizontal\"", () => {
515
808
  const {
@@ -567,16 +860,16 @@ describe("unsupported style properties", () => {
567
860
  ...mockOptions,
568
861
  passthroughProperties: ["transitionProperty"]
569
862
  })).toMatchSnapshot();
570
- expect(console.error).not.toHaveBeenCalled();
863
+ expect(console.warn).not.toHaveBeenCalled();
571
864
  });
572
865
  });
573
866
  describe("unsupported style values", () => {
574
867
  beforeEach(() => {
575
- jest.spyOn(console, "error");
576
- console.error.mockImplementation(() => {});
868
+ jest.spyOn(console, "warn");
869
+ console.warn.mockImplementation(() => {});
577
870
  });
578
871
  afterEach(() => {
579
- console.error.mockRestore();
872
+ console.warn.mockRestore();
580
873
  });
581
874
  test("calc", () => {
582
875
  const {
@@ -587,7 +880,7 @@ describe("unsupported style values", () => {
587
880
  }
588
881
  });
589
882
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
590
- expect(console.error).toHaveBeenCalled();
883
+ expect(console.warn).toHaveBeenCalled();
591
884
  });
592
885
  test("inherit", () => {
593
886
  const {
@@ -598,7 +891,7 @@ describe("unsupported style values", () => {
598
891
  }
599
892
  });
600
893
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
601
- expect(console.error).toHaveBeenCalled();
894
+ expect(console.warn).toHaveBeenCalled();
602
895
  });
603
896
  test("initial", () => {
604
897
  const {
@@ -609,6 +902,6 @@ describe("unsupported style values", () => {
609
902
  }
610
903
  });
611
904
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
612
- expect(console.error).toHaveBeenCalled();
905
+ expect(console.warn).toHaveBeenCalled();
613
906
  });
614
907
  });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ type FlatStyle = { [key: string]: unknown };
11
+ export declare function fixContentBox(flatStyle: FlatStyle): FlatStyle;