@fpkit/acss 2.2.0 → 3.1.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.
Files changed (81) hide show
  1. package/libs/chunk-5RAWNUVD.js +8 -0
  2. package/libs/chunk-5RAWNUVD.js.map +1 -0
  3. package/libs/{chunk-UJAQVHWC.js → chunk-CWRNJA4P.js} +2 -2
  4. package/libs/{chunk-R7NLLZU2.cjs → chunk-DYFAUAB7.cjs} +3 -3
  5. package/libs/chunk-NWJDAHP6.cjs +17 -0
  6. package/libs/chunk-NWJDAHP6.cjs.map +1 -0
  7. package/libs/components/breadcrumbs/breadcrumb.cjs +5 -5
  8. package/libs/components/breadcrumbs/breadcrumb.d.cts +2 -2
  9. package/libs/components/breadcrumbs/breadcrumb.d.ts +2 -2
  10. package/libs/components/breadcrumbs/breadcrumb.js +2 -2
  11. package/libs/components/flexbox/flex.css +1 -0
  12. package/libs/components/flexbox/flex.css.map +1 -0
  13. package/libs/components/flexbox/flex.min.css +3 -0
  14. package/libs/components/link/link.cjs +5 -5
  15. package/libs/components/link/link.css +1 -1
  16. package/libs/components/link/link.css.map +1 -1
  17. package/libs/components/link/link.d.cts +2 -131
  18. package/libs/components/link/link.d.ts +2 -131
  19. package/libs/components/link/link.js +1 -1
  20. package/libs/components/link/link.min.css +2 -2
  21. package/libs/components/nav/nav.css +1 -1
  22. package/libs/components/nav/nav.css.map +1 -1
  23. package/libs/components/nav/nav.min.css +2 -2
  24. package/libs/hooks.cjs +3 -3
  25. package/libs/hooks.d.cts +1 -1
  26. package/libs/hooks.d.ts +1 -1
  27. package/libs/hooks.js +2 -2
  28. package/libs/index.cjs +30 -29
  29. package/libs/index.cjs.map +1 -1
  30. package/libs/index.css +1 -1
  31. package/libs/index.css.map +1 -1
  32. package/libs/index.d.cts +246 -290
  33. package/libs/index.d.ts +246 -290
  34. package/libs/index.js +15 -15
  35. package/libs/index.js.map +1 -1
  36. package/libs/link-59ad884f.d.ts +371 -0
  37. package/package.json +2 -2
  38. package/src/components/flexbox/README.mdx +996 -0
  39. package/src/components/flexbox/flex.scss +847 -0
  40. package/src/components/flexbox/flex.stories.tsx +1233 -0
  41. package/src/components/flexbox/flex.test.tsx +689 -0
  42. package/src/components/flexbox/flex.tsx +484 -0
  43. package/src/components/flexbox/flex.types.ts +224 -0
  44. package/src/components/link/link.scss +4 -10
  45. package/src/components/link/link.tsx +18 -3
  46. package/src/components/nav/nav.scss +1 -1
  47. package/src/index.scss +1 -0
  48. package/src/index.ts +19 -2
  49. package/src/patterns/page/page-header.tsx +1 -3
  50. package/src/styles/flexbox/flex.css +736 -0
  51. package/src/styles/flexbox/flex.css.map +1 -0
  52. package/src/styles/index.css +739 -9
  53. package/src/styles/index.css.map +1 -1
  54. package/src/styles/link/link.css +2 -6
  55. package/src/styles/link/link.css.map +1 -1
  56. package/src/styles/nav/nav.css +3 -3
  57. package/libs/chunk-5PJYLVFY.cjs +0 -17
  58. package/libs/chunk-5PJYLVFY.cjs.map +0 -1
  59. package/libs/chunk-NNTBIHSD.js +0 -8
  60. package/libs/chunk-NNTBIHSD.js.map +0 -1
  61. package/libs/components/alert/alert.min.min.css +0 -2
  62. package/libs/components/badge/badge.min.min.css +0 -2
  63. package/libs/components/breadcrumbs/breadcrumb.min.min.css +0 -2
  64. package/libs/components/buttons/button.min.min.css +0 -2
  65. package/libs/components/cards/card-style.min.min.css +0 -2
  66. package/libs/components/cards/card.min.min.css +0 -2
  67. package/libs/components/details/details.min.min.css +0 -2
  68. package/libs/components/dialog/dialog.min.min.css +0 -2
  69. package/libs/components/form/form.min.min.css +0 -2
  70. package/libs/components/icons/icon.min.min.css +0 -2
  71. package/libs/components/images/img.min.min.css +0 -2
  72. package/libs/components/layout/landmarks.min.min.css +0 -2
  73. package/libs/components/link/link.min.min.css +0 -2
  74. package/libs/components/list/list.min.min.css +0 -2
  75. package/libs/components/nav/nav.min.min.css +0 -2
  76. package/libs/components/progress/progress.min.min.css +0 -2
  77. package/libs/components/styles/index.min.min.css +0 -2
  78. package/libs/components/tag/tag.min.min.css +0 -2
  79. package/libs/components/text-to-speech/text-to-speech.min.min.css +0 -2
  80. /package/libs/{chunk-UJAQVHWC.js.map → chunk-CWRNJA4P.js.map} +0 -0
  81. /package/libs/{chunk-R7NLLZU2.cjs.map → chunk-DYFAUAB7.cjs.map} +0 -0
@@ -0,0 +1,689 @@
1
+ import React from "react";
2
+ import { describe, it, expect } from "vitest";
3
+ import { render, screen } from "@testing-library/react";
4
+ import Flex from "./flex";
5
+
6
+ describe("Flex", () => {
7
+ describe("Rendering", () => {
8
+ it("should render flex container with children", () => {
9
+ render(
10
+ <Flex data-testid="flex">
11
+ <div>Item 1</div>
12
+ <div>Item 2</div>
13
+ </Flex>
14
+ );
15
+
16
+ const flex = screen.getByTestId("flex");
17
+ expect(flex).toBeInTheDocument();
18
+ expect(flex).toHaveClass("flex");
19
+ });
20
+
21
+ it("should render as div by default", () => {
22
+ render(<Flex data-testid="flex">Content</Flex>);
23
+
24
+ const flex = screen.getByTestId("flex");
25
+ expect(flex.tagName).toBe("DIV");
26
+ });
27
+
28
+ it("should render as custom element with 'as' prop", () => {
29
+ render(
30
+ <Flex as="section" data-testid="flex">
31
+ Content
32
+ </Flex>
33
+ );
34
+
35
+ const flex = screen.getByTestId("flex");
36
+ expect(flex.tagName).toBe("SECTION");
37
+ });
38
+
39
+ it("should apply inline flex class when inline prop is true", () => {
40
+ render(
41
+ <Flex inline data-testid="flex">
42
+ Content
43
+ </Flex>
44
+ );
45
+
46
+ const flex = screen.getByTestId("flex");
47
+ expect(flex).toHaveClass("flex-inline");
48
+ expect(flex).not.toHaveClass("flex");
49
+ });
50
+
51
+ it("should merge custom className with generated classes", () => {
52
+ render(
53
+ <Flex className="custom-class" direction="row" data-testid="flex">
54
+ Content
55
+ </Flex>
56
+ );
57
+
58
+ const flex = screen.getByTestId("flex");
59
+ expect(flex).toHaveClass("flex", "flex-row", "custom-class");
60
+ });
61
+
62
+ it("should apply custom styles", () => {
63
+ render(
64
+ <Flex
65
+ styles={{ "--flex-gap": "2rem" } as React.CSSProperties}
66
+ data-testid="flex"
67
+ >
68
+ Content
69
+ </Flex>
70
+ );
71
+
72
+ const flex = screen.getByTestId("flex");
73
+ expect(flex).toHaveStyle({ "--flex-gap": "2rem" });
74
+ });
75
+ });
76
+
77
+ describe("Direction Props", () => {
78
+ it("should apply flex-row class for row direction", () => {
79
+ render(
80
+ <Flex direction="row" data-testid="flex">
81
+ Content
82
+ </Flex>
83
+ );
84
+
85
+ expect(screen.getByTestId("flex")).toHaveClass("flex-row");
86
+ });
87
+
88
+ it("should apply flex-col class for column direction", () => {
89
+ render(
90
+ <Flex direction="column" data-testid="flex">
91
+ Content
92
+ </Flex>
93
+ );
94
+
95
+ expect(screen.getByTestId("flex")).toHaveClass("flex-col");
96
+ });
97
+
98
+ it("should apply flex-row-reverse class for row-reverse direction", () => {
99
+ render(
100
+ <Flex direction="row-reverse" data-testid="flex">
101
+ Content
102
+ </Flex>
103
+ );
104
+
105
+ expect(screen.getByTestId("flex")).toHaveClass("flex-row-reverse");
106
+ });
107
+
108
+ it("should apply flex-col-reverse class for column-reverse direction", () => {
109
+ render(
110
+ <Flex direction="column-reverse" data-testid="flex">
111
+ Content
112
+ </Flex>
113
+ );
114
+
115
+ expect(screen.getByTestId("flex")).toHaveClass("flex-col-reverse");
116
+ });
117
+ });
118
+
119
+ describe("Wrap Props", () => {
120
+ it("should apply flex-wrap class", () => {
121
+ render(
122
+ <Flex wrap="wrap" data-testid="flex">
123
+ Content
124
+ </Flex>
125
+ );
126
+
127
+ expect(screen.getByTestId("flex")).toHaveClass("flex-wrap");
128
+ });
129
+
130
+ it("should apply flex-nowrap class", () => {
131
+ render(
132
+ <Flex wrap="nowrap" data-testid="flex">
133
+ Content
134
+ </Flex>
135
+ );
136
+
137
+ expect(screen.getByTestId("flex")).toHaveClass("flex-nowrap");
138
+ });
139
+
140
+ it("should apply flex-wrap-reverse class", () => {
141
+ render(
142
+ <Flex wrap="wrap-reverse" data-testid="flex">
143
+ Content
144
+ </Flex>
145
+ );
146
+
147
+ expect(screen.getByTestId("flex")).toHaveClass("flex-wrap-reverse");
148
+ });
149
+ });
150
+
151
+ describe("Gap Props", () => {
152
+ it("should apply gap-md class", () => {
153
+ render(
154
+ <Flex gap="md" data-testid="flex">
155
+ Content
156
+ </Flex>
157
+ );
158
+
159
+ expect(screen.getByTestId("flex")).toHaveClass("gap-md");
160
+ });
161
+
162
+ it("should apply row-gap class", () => {
163
+ render(
164
+ <Flex rowGap="lg" data-testid="flex">
165
+ Content
166
+ </Flex>
167
+ );
168
+
169
+ expect(screen.getByTestId("flex")).toHaveClass("row-gap-lg");
170
+ });
171
+
172
+ it("should apply col-gap class", () => {
173
+ render(
174
+ <Flex colGap="sm" data-testid="flex">
175
+ Content
176
+ </Flex>
177
+ );
178
+
179
+ expect(screen.getByTestId("flex")).toHaveClass("col-gap-sm");
180
+ });
181
+ });
182
+
183
+ describe("Justify Props", () => {
184
+ it("should apply justify-start class", () => {
185
+ render(
186
+ <Flex justify="start" data-testid="flex">
187
+ Content
188
+ </Flex>
189
+ );
190
+
191
+ expect(screen.getByTestId("flex")).toHaveClass("justify-start");
192
+ });
193
+
194
+ it("should apply justify-center class", () => {
195
+ render(
196
+ <Flex justify="center" data-testid="flex">
197
+ Content
198
+ </Flex>
199
+ );
200
+
201
+ expect(screen.getByTestId("flex")).toHaveClass("justify-center");
202
+ });
203
+
204
+ it("should apply justify-between class", () => {
205
+ render(
206
+ <Flex justify="between" data-testid="flex">
207
+ Content
208
+ </Flex>
209
+ );
210
+
211
+ expect(screen.getByTestId("flex")).toHaveClass("justify-between");
212
+ });
213
+
214
+ it("should apply justify-around class", () => {
215
+ render(
216
+ <Flex justify="around" data-testid="flex">
217
+ Content
218
+ </Flex>
219
+ );
220
+
221
+ expect(screen.getByTestId("flex")).toHaveClass("justify-around");
222
+ });
223
+
224
+ it("should apply justify-evenly class", () => {
225
+ render(
226
+ <Flex justify="evenly" data-testid="flex">
227
+ Content
228
+ </Flex>
229
+ );
230
+
231
+ expect(screen.getByTestId("flex")).toHaveClass("justify-evenly");
232
+ });
233
+ });
234
+
235
+ describe("Align Props", () => {
236
+ it("should apply items-start class", () => {
237
+ render(
238
+ <Flex align="start" data-testid="flex">
239
+ Content
240
+ </Flex>
241
+ );
242
+
243
+ expect(screen.getByTestId("flex")).toHaveClass("items-start");
244
+ });
245
+
246
+ it("should apply items-center class", () => {
247
+ render(
248
+ <Flex align="center" data-testid="flex">
249
+ Content
250
+ </Flex>
251
+ );
252
+
253
+ expect(screen.getByTestId("flex")).toHaveClass("items-center");
254
+ });
255
+
256
+ it("should apply items-stretch class", () => {
257
+ render(
258
+ <Flex align="stretch" data-testid="flex">
259
+ Content
260
+ </Flex>
261
+ );
262
+
263
+ expect(screen.getByTestId("flex")).toHaveClass("items-stretch");
264
+ });
265
+
266
+ it("should apply items-baseline class", () => {
267
+ render(
268
+ <Flex align="baseline" data-testid="flex">
269
+ Content
270
+ </Flex>
271
+ );
272
+
273
+ expect(screen.getByTestId("flex")).toHaveClass("items-baseline");
274
+ });
275
+ });
276
+
277
+ describe("Align Content Props", () => {
278
+ it("should apply content-start class", () => {
279
+ render(
280
+ <Flex alignContent="start" data-testid="flex">
281
+ Content
282
+ </Flex>
283
+ );
284
+
285
+ expect(screen.getByTestId("flex")).toHaveClass("content-start");
286
+ });
287
+
288
+ it("should apply content-between class", () => {
289
+ render(
290
+ <Flex alignContent="between" data-testid="flex">
291
+ Content
292
+ </Flex>
293
+ );
294
+
295
+ expect(screen.getByTestId("flex")).toHaveClass("content-between");
296
+ });
297
+
298
+ it("should apply content-stretch class", () => {
299
+ render(
300
+ <Flex alignContent="stretch" data-testid="flex">
301
+ Content
302
+ </Flex>
303
+ );
304
+
305
+ expect(screen.getByTestId("flex")).toHaveClass("content-stretch");
306
+ });
307
+ });
308
+
309
+ describe("Preset Variants", () => {
310
+ it("should apply flex-center class for center variant", () => {
311
+ render(
312
+ <Flex variant="center" data-testid="flex">
313
+ Content
314
+ </Flex>
315
+ );
316
+
317
+ expect(screen.getByTestId("flex")).toHaveClass("flex-center");
318
+ });
319
+
320
+ it("should apply flex-between class for between variant", () => {
321
+ render(
322
+ <Flex variant="between" data-testid="flex">
323
+ Content
324
+ </Flex>
325
+ );
326
+
327
+ expect(screen.getByTestId("flex")).toHaveClass("flex-between");
328
+ });
329
+
330
+ it("should apply flex-around class for around variant", () => {
331
+ render(
332
+ <Flex variant="around" data-testid="flex">
333
+ Content
334
+ </Flex>
335
+ );
336
+
337
+ expect(screen.getByTestId("flex")).toHaveClass("flex-around");
338
+ });
339
+
340
+ it("should apply flex-stack class for stack variant", () => {
341
+ render(
342
+ <Flex variant="stack" data-testid="flex">
343
+ Content
344
+ </Flex>
345
+ );
346
+
347
+ expect(screen.getByTestId("flex")).toHaveClass("flex-stack");
348
+ });
349
+
350
+ it("should apply flex-spread class for spread variant", () => {
351
+ render(
352
+ <Flex variant="spread" data-testid="flex">
353
+ Content
354
+ </Flex>
355
+ );
356
+
357
+ expect(screen.getByTestId("flex")).toHaveClass("flex-spread");
358
+ });
359
+ });
360
+
361
+ describe("Responsive Props", () => {
362
+ it("should apply sm responsive classes", () => {
363
+ render(
364
+ <Flex sm={{ direction: "row", gap: "md" }} data-testid="flex">
365
+ Content
366
+ </Flex>
367
+ );
368
+
369
+ const flex = screen.getByTestId("flex");
370
+ expect(flex).toHaveClass("sm:flex-row", "sm:gap-md");
371
+ });
372
+
373
+ it("should apply md responsive classes", () => {
374
+ render(
375
+ <Flex md={{ justify: "between", align: "center" }} data-testid="flex">
376
+ Content
377
+ </Flex>
378
+ );
379
+
380
+ const flex = screen.getByTestId("flex");
381
+ expect(flex).toHaveClass("md:justify-between", "md:items-center");
382
+ });
383
+
384
+ it("should apply lg responsive classes", () => {
385
+ render(
386
+ <Flex lg={{ direction: "column", wrap: "wrap" }} data-testid="flex">
387
+ Content
388
+ </Flex>
389
+ );
390
+
391
+ const flex = screen.getByTestId("flex");
392
+ expect(flex).toHaveClass("lg:flex-col", "lg:flex-wrap");
393
+ });
394
+
395
+ it("should apply xl responsive classes", () => {
396
+ render(
397
+ <Flex xl={{ gap: "xl", justify: "evenly" }} data-testid="flex">
398
+ Content
399
+ </Flex>
400
+ );
401
+
402
+ const flex = screen.getByTestId("flex");
403
+ expect(flex).toHaveClass("xl:gap-xl", "xl:justify-evenly");
404
+ });
405
+
406
+ it("should combine base and responsive classes", () => {
407
+ render(
408
+ <Flex
409
+ direction="column"
410
+ gap="sm"
411
+ md={{ direction: "row", gap: "lg" }}
412
+ data-testid="flex"
413
+ >
414
+ Content
415
+ </Flex>
416
+ );
417
+
418
+ const flex = screen.getByTestId("flex");
419
+ expect(flex).toHaveClass(
420
+ "flex",
421
+ "flex-col",
422
+ "gap-sm",
423
+ "md:flex-row",
424
+ "md:gap-lg"
425
+ );
426
+ });
427
+ });
428
+
429
+ describe("Flex.Item", () => {
430
+ it("should render Flex.Item component", () => {
431
+ render(<Flex.Item data-testid="flex-item">Item content</Flex.Item>);
432
+
433
+ const item = screen.getByTestId("flex-item");
434
+ expect(item).toBeInTheDocument();
435
+ expect(item.tagName).toBe("DIV");
436
+ });
437
+
438
+ it("should apply flex-1 class", () => {
439
+ render(
440
+ <Flex.Item flex="1" data-testid="flex-item">
441
+ Item
442
+ </Flex.Item>
443
+ );
444
+
445
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-1");
446
+ });
447
+
448
+ it("should apply flex-auto class", () => {
449
+ render(
450
+ <Flex.Item flex="auto" data-testid="flex-item">
451
+ Item
452
+ </Flex.Item>
453
+ );
454
+
455
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-auto");
456
+ });
457
+
458
+ it("should apply flex-none class", () => {
459
+ render(
460
+ <Flex.Item flex="none" data-testid="flex-item">
461
+ Item
462
+ </Flex.Item>
463
+ );
464
+
465
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-none");
466
+ });
467
+
468
+ it("should apply flex-initial class", () => {
469
+ render(
470
+ <Flex.Item flex="initial" data-testid="flex-item">
471
+ Item
472
+ </Flex.Item>
473
+ );
474
+
475
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-initial");
476
+ });
477
+
478
+ it("should apply flex-grow class", () => {
479
+ render(
480
+ <Flex.Item grow={1} data-testid="flex-item">
481
+ Item
482
+ </Flex.Item>
483
+ );
484
+
485
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-grow-1");
486
+ });
487
+
488
+ it("should apply flex-shrink class", () => {
489
+ render(
490
+ <Flex.Item shrink={0} data-testid="flex-item">
491
+ Item
492
+ </Flex.Item>
493
+ );
494
+
495
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-shrink-0");
496
+ });
497
+
498
+ it("should apply flex-basis class", () => {
499
+ render(
500
+ <Flex.Item basis="auto" data-testid="flex-item">
501
+ Item
502
+ </Flex.Item>
503
+ );
504
+
505
+ expect(screen.getByTestId("flex-item")).toHaveClass("flex-basis-auto");
506
+ });
507
+
508
+ it("should apply align-self class", () => {
509
+ render(
510
+ <Flex.Item alignSelf="end" data-testid="flex-item">
511
+ Item
512
+ </Flex.Item>
513
+ );
514
+
515
+ expect(screen.getByTestId("flex-item")).toHaveClass("self-end");
516
+ });
517
+
518
+ it("should apply order class", () => {
519
+ render(
520
+ <Flex.Item order="first" data-testid="flex-item">
521
+ Item
522
+ </Flex.Item>
523
+ );
524
+
525
+ expect(screen.getByTestId("flex-item")).toHaveClass("order-first");
526
+ });
527
+
528
+ it("should apply responsive flex classes", () => {
529
+ render(
530
+ <Flex.Item
531
+ flex="none"
532
+ md={{ flex: "1" }}
533
+ lg={{ flex: "auto" }}
534
+ data-testid="flex-item"
535
+ >
536
+ Item
537
+ </Flex.Item>
538
+ );
539
+
540
+ const item = screen.getByTestId("flex-item");
541
+ expect(item).toHaveClass("flex-none", "md:flex-1", "lg:flex-auto");
542
+ });
543
+
544
+ it("should render as custom element", () => {
545
+ render(
546
+ <Flex.Item as="article" data-testid="flex-item">
547
+ Item
548
+ </Flex.Item>
549
+ );
550
+
551
+ const item = screen.getByTestId("flex-item");
552
+ expect(item.tagName).toBe("ARTICLE");
553
+ });
554
+ });
555
+
556
+ describe("Flex.Spacer", () => {
557
+ it("should render Flex.Spacer component", () => {
558
+ render(<Flex.Spacer data-testid="flex-spacer" />);
559
+
560
+ const spacer = screen.getByTestId("flex-spacer");
561
+ expect(spacer).toBeInTheDocument();
562
+ expect(spacer.tagName).toBe("DIV");
563
+ });
564
+
565
+ it("should apply flex-1 class by default", () => {
566
+ render(<Flex.Spacer data-testid="flex-spacer" />);
567
+
568
+ expect(screen.getByTestId("flex-spacer")).toHaveClass("flex-1");
569
+ });
570
+
571
+ it("should render as custom element", () => {
572
+ render(<Flex.Spacer as="section" data-testid="flex-spacer" />);
573
+
574
+ const spacer = screen.getByTestId("flex-spacer");
575
+ expect(spacer.tagName).toBe("SECTION");
576
+ });
577
+
578
+ it("should merge custom className", () => {
579
+ render(<Flex.Spacer className="custom-spacer" data-testid="flex-spacer" />);
580
+
581
+ const spacer = screen.getByTestId("flex-spacer");
582
+ expect(spacer).toHaveClass("flex-1", "custom-spacer");
583
+ });
584
+ });
585
+
586
+ describe("Composition", () => {
587
+ it("should render Flex with Flex.Item children", () => {
588
+ render(
589
+ <Flex data-testid="flex">
590
+ <Flex.Item flex="1" data-testid="item-1">
591
+ Item 1
592
+ </Flex.Item>
593
+ <Flex.Item flex="1" data-testid="item-2">
594
+ Item 2
595
+ </Flex.Item>
596
+ </Flex>
597
+ );
598
+
599
+ expect(screen.getByTestId("flex")).toBeInTheDocument();
600
+ expect(screen.getByTestId("item-1")).toBeInTheDocument();
601
+ expect(screen.getByTestId("item-2")).toBeInTheDocument();
602
+ });
603
+
604
+ it("should render Flex with Flex.Spacer", () => {
605
+ render(
606
+ <Flex data-testid="flex">
607
+ <div data-testid="left">Left</div>
608
+ <Flex.Spacer data-testid="spacer" />
609
+ <div data-testid="right">Right</div>
610
+ </Flex>
611
+ );
612
+
613
+ expect(screen.getByTestId("flex")).toBeInTheDocument();
614
+ expect(screen.getByTestId("spacer")).toBeInTheDocument();
615
+ expect(screen.getByTestId("left")).toBeInTheDocument();
616
+ expect(screen.getByTestId("right")).toBeInTheDocument();
617
+ });
618
+
619
+ it("should support nested Flex containers", () => {
620
+ render(
621
+ <Flex data-testid="outer">
622
+ <Flex data-testid="inner">
623
+ <div>Nested content</div>
624
+ </Flex>
625
+ </Flex>
626
+ );
627
+
628
+ expect(screen.getByTestId("outer")).toBeInTheDocument();
629
+ expect(screen.getByTestId("inner")).toBeInTheDocument();
630
+ });
631
+ });
632
+
633
+ describe("Accessibility", () => {
634
+ it("should forward ARIA attributes", () => {
635
+ render(
636
+ <Flex aria-label="Main navigation" role="navigation" data-testid="flex">
637
+ Content
638
+ </Flex>
639
+ );
640
+
641
+ const flex = screen.getByTestId("flex");
642
+ expect(flex).toHaveAttribute("aria-label", "Main navigation");
643
+ expect(flex).toHaveAttribute("role", "navigation");
644
+ });
645
+
646
+ it("should forward data attributes", () => {
647
+ render(
648
+ <Flex data-testid="flex" data-custom="value">
649
+ Content
650
+ </Flex>
651
+ );
652
+
653
+ const flex = screen.getByTestId("flex");
654
+ expect(flex).toHaveAttribute("data-custom", "value");
655
+ });
656
+
657
+ it("should support ref forwarding", () => {
658
+ const ref = React.createRef<HTMLDivElement>();
659
+
660
+ render(
661
+ <Flex ref={ref} data-testid="flex">
662
+ Content
663
+ </Flex>
664
+ );
665
+
666
+ expect(ref.current).toBe(screen.getByTestId("flex"));
667
+ });
668
+
669
+ it("should support Flex.Item ref forwarding", () => {
670
+ const ref = React.createRef<HTMLDivElement>();
671
+
672
+ render(
673
+ <Flex.Item ref={ref} data-testid="flex-item">
674
+ Item
675
+ </Flex.Item>
676
+ );
677
+
678
+ expect(ref.current).toBe(screen.getByTestId("flex-item"));
679
+ });
680
+
681
+ it("should support Flex.Spacer ref forwarding", () => {
682
+ const ref = React.createRef<HTMLDivElement>();
683
+
684
+ render(<Flex.Spacer ref={ref} data-testid="flex-spacer" />);
685
+
686
+ expect(ref.current).toBe(screen.getByTestId("flex-spacer"));
687
+ });
688
+ });
689
+ });