@object-ui/components 0.5.0 → 3.0.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 (119) hide show
  1. package/.turbo/turbo-build.log +12 -25
  2. package/CHANGELOG.md +32 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.js +23987 -22576
  5. package/dist/index.umd.cjs +30 -30
  6. package/dist/src/custom/action-param-dialog.d.ts +21 -0
  7. package/dist/src/custom/index.d.ts +4 -0
  8. package/dist/src/custom/navigation-overlay.d.ts +50 -0
  9. package/dist/src/custom/view-skeleton.d.ts +37 -0
  10. package/dist/src/custom/view-states.d.ts +33 -0
  11. package/dist/src/index.d.ts +1 -0
  12. package/dist/src/renderers/action/action-button.d.ts +11 -0
  13. package/dist/src/renderers/action/action-group.d.ts +25 -0
  14. package/dist/src/renderers/action/action-icon.d.ts +10 -0
  15. package/dist/src/renderers/action/action-menu.d.ts +19 -0
  16. package/dist/src/renderers/action/index.d.ts +0 -0
  17. package/dist/src/renderers/action/resolve-icon.d.ts +6 -0
  18. package/package.json +20 -19
  19. package/src/__tests__/PageRendererRegions.test.tsx +664 -55
  20. package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +811 -0
  21. package/src/__tests__/__snapshots__/snapshot.test.tsx.snap +327 -0
  22. package/src/__tests__/accessibility.test.tsx +137 -0
  23. package/src/__tests__/api-consistency.test.tsx +596 -0
  24. package/src/__tests__/color-contrast.test.tsx +212 -0
  25. package/src/__tests__/compliance.test.tsx +72 -0
  26. package/src/__tests__/edge-cases.test.tsx +285 -0
  27. package/src/__tests__/navigation-overlay.test.tsx +273 -0
  28. package/src/__tests__/snapshot-critical.test.tsx +317 -0
  29. package/src/__tests__/snapshot.test.tsx +205 -0
  30. package/src/__tests__/view-compliance.test.tsx +153 -0
  31. package/src/__tests__/wcag-audit.test.tsx +493 -0
  32. package/src/custom/action-param-dialog.tsx +264 -0
  33. package/src/custom/index.ts +4 -0
  34. package/src/custom/navigation-overlay.tsx +296 -0
  35. package/src/custom/view-skeleton.tsx +243 -0
  36. package/src/custom/view-states.tsx +153 -0
  37. package/src/index.ts +1 -0
  38. package/src/renderers/action/action-button.tsx +147 -0
  39. package/src/renderers/action/action-group.tsx +270 -0
  40. package/src/renderers/action/action-icon.tsx +150 -0
  41. package/src/renderers/action/action-menu.tsx +203 -0
  42. package/src/renderers/action/index.ts +18 -0
  43. package/src/renderers/action/resolve-icon.ts +35 -0
  44. package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +275 -0
  45. package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +120 -0
  46. package/src/renderers/complex/__tests__/data-table-editing.test.tsx +221 -0
  47. package/src/renderers/complex/data-table.tsx +269 -33
  48. package/src/renderers/complex/resizable.tsx +20 -17
  49. package/src/renderers/data-display/list.tsx +1 -1
  50. package/src/renderers/data-display/table.tsx +1 -1
  51. package/src/renderers/data-display/tree-view.tsx +2 -1
  52. package/src/renderers/form/form.tsx +33 -10
  53. package/src/renderers/index.ts +1 -0
  54. package/src/renderers/layout/aspect-ratio.tsx +1 -1
  55. package/src/renderers/layout/page.tsx +416 -52
  56. package/src/renderers/navigation/sidebar.tsx +6 -0
  57. package/src/renderers/placeholders.tsx +2 -2
  58. package/src/stories/MockedData.stories.tsx +87 -37
  59. package/src/stories-json/Accessibility.mdx +297 -0
  60. package/src/stories-json/EdgeCases.stories.tsx +160 -0
  61. package/src/stories-json/GettingStarted.mdx +89 -0
  62. package/src/stories-json/Introduction.mdx +127 -0
  63. package/src/stories-json/accordion.stories.tsx +1 -1
  64. package/src/stories-json/aggrid.stories.tsx +1 -1
  65. package/src/stories-json/alert.stories.tsx +1 -1
  66. package/src/stories-json/aspect-ratio.stories.tsx +1 -1
  67. package/src/stories-json/avatar.stories.tsx +1 -1
  68. package/src/stories-json/badge.stories.tsx +1 -1
  69. package/src/stories-json/breadcrumb.stories.tsx +1 -1
  70. package/src/stories-json/button-group.stories.tsx +1 -1
  71. package/src/stories-json/button.stories.tsx +1 -1
  72. package/src/stories-json/calendar.stories.tsx +1 -1
  73. package/src/stories-json/card.stories.tsx +1 -1
  74. package/src/stories-json/carousel.stories.tsx +1 -1
  75. package/src/stories-json/charts.stories.tsx +1 -1
  76. package/src/stories-json/chatbot.stories.tsx +1 -1
  77. package/src/stories-json/code-editor.stories.tsx +1 -1
  78. package/src/stories-json/collapsible.stories.tsx +1 -1
  79. package/src/stories-json/controls.stories.tsx +1 -1
  80. package/src/stories-json/crm-live-data.stories.tsx +154 -0
  81. package/src/stories-json/data-table.stories.tsx +80 -4
  82. package/src/stories-json/data_display_extras.stories.tsx +1 -1
  83. package/src/stories-json/date-picker.stories.tsx +1 -1
  84. package/src/stories-json/detail-view.stories.tsx +1 -1
  85. package/src/stories-json/dialog.stories.tsx +1 -1
  86. package/src/stories-json/feedback_extras.stories.tsx +1 -1
  87. package/src/stories-json/feedback_others.stories.tsx +1 -1
  88. package/src/stories-json/form-variants.stories.tsx +210 -0
  89. package/src/stories-json/form_advanced.stories.tsx +1 -1
  90. package/src/stories-json/form_extras.stories.tsx +1 -1
  91. package/src/stories-json/grid.stories.tsx +1 -1
  92. package/src/stories-json/icon.stories.tsx +1 -1
  93. package/src/stories-json/input.stories.tsx +1 -1
  94. package/src/stories-json/kanban.stories.tsx +1 -1
  95. package/src/stories-json/layout_extended.stories.tsx +1 -1
  96. package/src/stories-json/layout_flex.stories.tsx +1 -1
  97. package/src/stories-json/list-view.stories.tsx +1 -1
  98. package/src/stories-json/markdown.stories.tsx +1 -1
  99. package/src/stories-json/menus.stories.tsx +1 -1
  100. package/src/stories-json/metric-card.stories.tsx +1 -1
  101. package/src/stories-json/navigation-menu.stories.tsx +1 -1
  102. package/src/stories-json/object-aggrid-advanced.stories.tsx +389 -0
  103. package/src/stories-json/object-aggrid.stories.tsx +1 -1
  104. package/src/stories-json/object-form.stories.tsx +1 -1
  105. package/src/stories-json/object-gantt.stories.tsx +1 -1
  106. package/src/stories-json/object-grid.stories.tsx +159 -1
  107. package/src/stories-json/object-map.stories.tsx +1 -1
  108. package/src/stories-json/object-view.stories.tsx +1 -1
  109. package/src/stories-json/overlay_extras.stories.tsx +1 -1
  110. package/src/stories-json/overlay_others.stories.tsx +1 -1
  111. package/src/stories-json/resizable.stories.tsx +1 -1
  112. package/src/stories-json/select.stories.tsx +1 -1
  113. package/src/stories-json/separator.stories.tsx +1 -1
  114. package/src/stories-json/statistic.stories.tsx +1 -1
  115. package/src/stories-json/tabs.stories.tsx +1 -1
  116. package/src/stories-json/timeline.stories.tsx +1 -1
  117. package/src/stories-json/typography.stories.tsx +1 -1
  118. package/src/ui/slider.tsx +6 -2
  119. package/src/stories/Introduction.mdx +0 -34
@@ -0,0 +1,273 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ import { describe, it, expect, vi } from 'vitest';
10
+ import { render, screen, fireEvent } from '@testing-library/react';
11
+ import React from 'react';
12
+ import { NavigationOverlay } from '../custom/navigation-overlay';
13
+ import type { NavigationOverlayProps } from '../custom/navigation-overlay';
14
+
15
+ // Helper to create default props
16
+ function createProps(overrides: Partial<NavigationOverlayProps> = {}): NavigationOverlayProps {
17
+ return {
18
+ isOpen: true,
19
+ selectedRecord: { _id: '1', name: 'Test Record', email: 'test@example.com' },
20
+ mode: 'drawer',
21
+ close: vi.fn(),
22
+ setIsOpen: vi.fn(),
23
+ isOverlay: true,
24
+ children: (record: Record<string, unknown>) => (
25
+ <div data-testid="record-content">
26
+ <span>{String(record.name)}</span>
27
+ </div>
28
+ ),
29
+ ...overrides,
30
+ };
31
+ }
32
+
33
+ describe('NavigationOverlay', () => {
34
+ // ============================================================
35
+ // Non-overlay modes
36
+ // ============================================================
37
+
38
+ describe('non-overlay modes', () => {
39
+ it('should render nothing for mode: page', () => {
40
+ const { container } = render(
41
+ <NavigationOverlay {...createProps({ mode: 'page' })} />
42
+ );
43
+ expect(container.innerHTML).toBe('');
44
+ });
45
+
46
+ it('should render nothing for mode: new_window', () => {
47
+ const { container } = render(
48
+ <NavigationOverlay {...createProps({ mode: 'new_window' })} />
49
+ );
50
+ expect(container.innerHTML).toBe('');
51
+ });
52
+
53
+ it('should render nothing for mode: none', () => {
54
+ const { container } = render(
55
+ <NavigationOverlay {...createProps({ mode: 'none' })} />
56
+ );
57
+ expect(container.innerHTML).toBe('');
58
+ });
59
+
60
+ it('should render nothing when selectedRecord is null', () => {
61
+ const { container } = render(
62
+ <NavigationOverlay {...createProps({ selectedRecord: null })} />
63
+ );
64
+ expect(container.innerHTML).toBe('');
65
+ });
66
+ });
67
+
68
+ // ============================================================
69
+ // Drawer mode (Sheet)
70
+ // ============================================================
71
+
72
+ describe('drawer mode', () => {
73
+ it('should render Sheet with record content', () => {
74
+ render(<NavigationOverlay {...createProps({ mode: 'drawer' })} />);
75
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
76
+ });
77
+
78
+ it('should render title', () => {
79
+ render(
80
+ <NavigationOverlay
81
+ {...createProps({ mode: 'drawer', title: 'Contact Detail' })}
82
+ />
83
+ );
84
+ expect(screen.getByText('Contact Detail')).toBeInTheDocument();
85
+ });
86
+
87
+ it('should render description when provided', () => {
88
+ render(
89
+ <NavigationOverlay
90
+ {...createProps({
91
+ mode: 'drawer',
92
+ title: 'Detail',
93
+ description: 'View record details',
94
+ })}
95
+ />
96
+ );
97
+ expect(screen.getByText('View record details')).toBeInTheDocument();
98
+ });
99
+
100
+ it('should use default title when none provided', () => {
101
+ render(<NavigationOverlay {...createProps({ mode: 'drawer' })} />);
102
+ expect(screen.getByText('Record Detail')).toBeInTheDocument();
103
+ });
104
+ });
105
+
106
+ // ============================================================
107
+ // Modal mode (Dialog)
108
+ // ============================================================
109
+
110
+ describe('modal mode', () => {
111
+ it('should render Dialog with record content', () => {
112
+ render(<NavigationOverlay {...createProps({ mode: 'modal' })} />);
113
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
114
+ });
115
+
116
+ it('should render title in dialog', () => {
117
+ render(
118
+ <NavigationOverlay
119
+ {...createProps({ mode: 'modal', title: 'Account Detail' })}
120
+ />
121
+ );
122
+ expect(screen.getByText('Account Detail')).toBeInTheDocument();
123
+ });
124
+
125
+ it('should render description in dialog', () => {
126
+ render(
127
+ <NavigationOverlay
128
+ {...createProps({
129
+ mode: 'modal',
130
+ description: 'View account information',
131
+ })}
132
+ />
133
+ );
134
+ expect(screen.getByText('View account information')).toBeInTheDocument();
135
+ });
136
+ });
137
+
138
+ // ============================================================
139
+ // Split mode (ResizablePanelGroup)
140
+ // ============================================================
141
+
142
+ describe('split mode', () => {
143
+ it('should render split panels with main content and record detail', () => {
144
+ render(
145
+ <NavigationOverlay
146
+ {...createProps({
147
+ mode: 'split',
148
+ mainContent: <div data-testid="main">Main Content</div>,
149
+ })}
150
+ />
151
+ );
152
+ expect(screen.getByTestId('main')).toBeInTheDocument();
153
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
154
+ });
155
+
156
+ it('should render nothing when mainContent is not provided', () => {
157
+ const { container } = render(
158
+ <NavigationOverlay
159
+ {...createProps({ mode: 'split', mainContent: undefined })}
160
+ />
161
+ );
162
+ expect(container.innerHTML).toBe('');
163
+ });
164
+
165
+ it('should render close button in split panel', () => {
166
+ render(
167
+ <NavigationOverlay
168
+ {...createProps({
169
+ mode: 'split',
170
+ mainContent: <div>Main</div>,
171
+ })}
172
+ />
173
+ );
174
+ expect(screen.getByLabelText('Close panel')).toBeInTheDocument();
175
+ });
176
+
177
+ it('should call close when close button clicked', () => {
178
+ const close = vi.fn();
179
+ render(
180
+ <NavigationOverlay
181
+ {...createProps({
182
+ mode: 'split',
183
+ close,
184
+ mainContent: <div>Main</div>,
185
+ })}
186
+ />
187
+ );
188
+
189
+ fireEvent.click(screen.getByLabelText('Close panel'));
190
+ expect(close).toHaveBeenCalled();
191
+ });
192
+ });
193
+
194
+ // ============================================================
195
+ // Popover mode
196
+ // ============================================================
197
+
198
+ describe('popover mode', () => {
199
+ it('should render popover with record content when open', () => {
200
+ render(
201
+ <NavigationOverlay
202
+ {...createProps({
203
+ mode: 'popover',
204
+ popoverTrigger: <button>Trigger</button>,
205
+ })}
206
+ />
207
+ );
208
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
209
+ });
210
+
211
+ it('should render title in popover', () => {
212
+ render(
213
+ <NavigationOverlay
214
+ {...createProps({
215
+ mode: 'popover',
216
+ title: 'Quick View',
217
+ })}
218
+ />
219
+ );
220
+ expect(screen.getByText('Quick View')).toBeInTheDocument();
221
+ });
222
+ });
223
+
224
+ // ============================================================
225
+ // Width handling
226
+ // ============================================================
227
+
228
+ describe('width handling', () => {
229
+ it('should render drawer with string width without error', () => {
230
+ render(
231
+ <NavigationOverlay
232
+ {...createProps({ mode: 'drawer', width: '600px' })}
233
+ />
234
+ );
235
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
236
+ });
237
+
238
+ it('should render modal with numeric width without error', () => {
239
+ render(
240
+ <NavigationOverlay
241
+ {...createProps({ mode: 'modal', width: 800 })}
242
+ />
243
+ );
244
+ expect(screen.getByText('Test Record')).toBeInTheDocument();
245
+ });
246
+ });
247
+
248
+ // ============================================================
249
+ // Children render prop
250
+ // ============================================================
251
+
252
+ describe('children render prop', () => {
253
+ it('should pass the selected record to children', () => {
254
+ const record = { _id: '42', name: 'Jane Doe', status: 'active' };
255
+ render(
256
+ <NavigationOverlay
257
+ {...createProps({
258
+ mode: 'drawer',
259
+ selectedRecord: record,
260
+ children: (r: Record<string, unknown>) => (
261
+ <div>
262
+ <span data-testid="name">{String(r.name)}</span>
263
+ <span data-testid="status">{String(r.status)}</span>
264
+ </div>
265
+ ),
266
+ })}
267
+ />
268
+ );
269
+ expect(screen.getByTestId('name')).toHaveTextContent('Jane Doe');
270
+ expect(screen.getByTestId('status')).toHaveTextContent('active');
271
+ });
272
+ });
273
+ });
@@ -0,0 +1,317 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * Snapshot Tests — Additional Critical UI Components
11
+ *
12
+ * Captures render snapshots of Alert, Dialog, Tabs, Accordion, Avatar,
13
+ * Progress, Tooltip, Breadcrumb, Separator, and Skeleton to detect
14
+ * unintended visual regressions.
15
+ */
16
+
17
+ import { describe, it, expect } from 'vitest';
18
+ import { render } from '@testing-library/react';
19
+ import React from 'react';
20
+ import {
21
+ Alert,
22
+ AlertTitle,
23
+ AlertDescription,
24
+ Dialog,
25
+ DialogTrigger,
26
+ DialogContent,
27
+ DialogHeader,
28
+ DialogFooter,
29
+ DialogTitle,
30
+ DialogDescription,
31
+ Tabs,
32
+ TabsList,
33
+ TabsTrigger,
34
+ TabsContent,
35
+ Accordion,
36
+ AccordionItem,
37
+ AccordionTrigger,
38
+ AccordionContent,
39
+ Avatar,
40
+ AvatarImage,
41
+ AvatarFallback,
42
+ Progress,
43
+ TooltipProvider,
44
+ Tooltip,
45
+ TooltipTrigger,
46
+ Breadcrumb,
47
+ BreadcrumbList,
48
+ BreadcrumbItem,
49
+ BreadcrumbLink,
50
+ BreadcrumbPage,
51
+ BreadcrumbSeparator,
52
+ Separator,
53
+ Skeleton,
54
+ } from '@object-ui/components';
55
+
56
+ // ─── Alert Snapshots ────────────────────────────────────────────────────
57
+
58
+ describe('Alert snapshots', () => {
59
+ it('renders default alert with title and description', () => {
60
+ const { container } = render(
61
+ <Alert>
62
+ <AlertTitle>Heads up!</AlertTitle>
63
+ <AlertDescription>
64
+ You can add components to your app using the CLI.
65
+ </AlertDescription>
66
+ </Alert>,
67
+ );
68
+ expect(container.firstChild).toMatchSnapshot();
69
+ });
70
+
71
+ it('renders destructive alert with title and description', () => {
72
+ const { container } = render(
73
+ <Alert variant="destructive">
74
+ <AlertTitle>Error</AlertTitle>
75
+ <AlertDescription>
76
+ Your session has expired. Please log in again.
77
+ </AlertDescription>
78
+ </Alert>,
79
+ );
80
+ expect(container.firstChild).toMatchSnapshot();
81
+ });
82
+ });
83
+
84
+ // ─── Dialog Snapshots ───────────────────────────────────────────────────
85
+
86
+ describe('Dialog snapshots', () => {
87
+ it('renders open dialog structure', () => {
88
+ const { baseElement } = render(
89
+ <Dialog open>
90
+ <DialogTrigger>Open</DialogTrigger>
91
+ <DialogContent>
92
+ <DialogHeader>
93
+ <DialogTitle>Edit Profile</DialogTitle>
94
+ <DialogDescription>
95
+ Make changes to your profile here.
96
+ </DialogDescription>
97
+ </DialogHeader>
98
+ <p>Dialog body content</p>
99
+ <DialogFooter>
100
+ <button type="submit">Save changes</button>
101
+ </DialogFooter>
102
+ </DialogContent>
103
+ </Dialog>,
104
+ );
105
+ expect(baseElement).toMatchSnapshot();
106
+ });
107
+ });
108
+
109
+ // ─── Tabs Snapshots ─────────────────────────────────────────────────────
110
+
111
+ describe('Tabs snapshots', () => {
112
+ it('renders tabs with multiple panels', () => {
113
+ const { container } = render(
114
+ <Tabs defaultValue="account">
115
+ <TabsList>
116
+ <TabsTrigger value="account">Account</TabsTrigger>
117
+ <TabsTrigger value="password">Password</TabsTrigger>
118
+ <TabsTrigger value="settings">Settings</TabsTrigger>
119
+ </TabsList>
120
+ <TabsContent value="account">Account settings here.</TabsContent>
121
+ <TabsContent value="password">Change your password.</TabsContent>
122
+ <TabsContent value="settings">App settings here.</TabsContent>
123
+ </Tabs>,
124
+ );
125
+ expect(container.firstChild).toMatchSnapshot();
126
+ });
127
+
128
+ it('renders tabs with second tab active', () => {
129
+ const { container } = render(
130
+ <Tabs defaultValue="password">
131
+ <TabsList>
132
+ <TabsTrigger value="account">Account</TabsTrigger>
133
+ <TabsTrigger value="password">Password</TabsTrigger>
134
+ </TabsList>
135
+ <TabsContent value="account">Account settings.</TabsContent>
136
+ <TabsContent value="password">Password settings.</TabsContent>
137
+ </Tabs>,
138
+ );
139
+ expect(container.firstChild).toMatchSnapshot();
140
+ });
141
+ });
142
+
143
+ // ─── Accordion Snapshots ────────────────────────────────────────────────
144
+
145
+ describe('Accordion snapshots', () => {
146
+ it('renders accordion with multiple items', () => {
147
+ const { container } = render(
148
+ <Accordion type="single" collapsible>
149
+ <AccordionItem value="item-1">
150
+ <AccordionTrigger>Is it accessible?</AccordionTrigger>
151
+ <AccordionContent>
152
+ Yes. It adheres to the WAI-ARIA design pattern.
153
+ </AccordionContent>
154
+ </AccordionItem>
155
+ <AccordionItem value="item-2">
156
+ <AccordionTrigger>Is it styled?</AccordionTrigger>
157
+ <AccordionContent>
158
+ Yes. It comes with default styles that match the design system.
159
+ </AccordionContent>
160
+ </AccordionItem>
161
+ <AccordionItem value="item-3">
162
+ <AccordionTrigger>Is it animated?</AccordionTrigger>
163
+ <AccordionContent>
164
+ Yes. It uses CSS animations for smooth transitions.
165
+ </AccordionContent>
166
+ </AccordionItem>
167
+ </Accordion>,
168
+ );
169
+ expect(container.firstChild).toMatchSnapshot();
170
+ });
171
+
172
+ it('renders accordion with first item expanded', () => {
173
+ const { container } = render(
174
+ <Accordion type="single" defaultValue="item-1">
175
+ <AccordionItem value="item-1">
176
+ <AccordionTrigger>Section One</AccordionTrigger>
177
+ <AccordionContent>Content for section one.</AccordionContent>
178
+ </AccordionItem>
179
+ <AccordionItem value="item-2">
180
+ <AccordionTrigger>Section Two</AccordionTrigger>
181
+ <AccordionContent>Content for section two.</AccordionContent>
182
+ </AccordionItem>
183
+ </Accordion>,
184
+ );
185
+ expect(container.firstChild).toMatchSnapshot();
186
+ });
187
+ });
188
+
189
+ // ─── Avatar Snapshots ───────────────────────────────────────────────────
190
+
191
+ describe('Avatar snapshots', () => {
192
+ it('renders avatar with image and fallback', () => {
193
+ const { container } = render(
194
+ <Avatar>
195
+ <AvatarImage src="https://example.com/avatar.png" alt="User avatar" />
196
+ <AvatarFallback>JD</AvatarFallback>
197
+ </Avatar>,
198
+ );
199
+ expect(container.firstChild).toMatchSnapshot();
200
+ });
201
+
202
+ it('renders avatar with fallback only', () => {
203
+ const { container } = render(
204
+ <Avatar>
205
+ <AvatarFallback>AB</AvatarFallback>
206
+ </Avatar>,
207
+ );
208
+ expect(container.firstChild).toMatchSnapshot();
209
+ });
210
+ });
211
+
212
+ // ─── Progress Snapshots ─────────────────────────────────────────────────
213
+
214
+ describe('Progress snapshots', () => {
215
+ it('renders progress at 0%', () => {
216
+ const { container } = render(<Progress value={0} />);
217
+ expect(container.firstChild).toMatchSnapshot();
218
+ });
219
+
220
+ it('renders progress at 50%', () => {
221
+ const { container } = render(<Progress value={50} />);
222
+ expect(container.firstChild).toMatchSnapshot();
223
+ });
224
+
225
+ it('renders progress at 100%', () => {
226
+ const { container } = render(<Progress value={100} />);
227
+ expect(container.firstChild).toMatchSnapshot();
228
+ });
229
+ });
230
+
231
+ // ─── Tooltip Snapshots ──────────────────────────────────────────────────
232
+
233
+ describe('Tooltip snapshots', () => {
234
+ it('renders tooltip trigger', () => {
235
+ const { container } = render(
236
+ <TooltipProvider>
237
+ <Tooltip>
238
+ <TooltipTrigger asChild>
239
+ <button>Hover me</button>
240
+ </TooltipTrigger>
241
+ </Tooltip>
242
+ </TooltipProvider>,
243
+ );
244
+ expect(container.firstChild).toMatchSnapshot();
245
+ });
246
+ });
247
+
248
+ // ─── Breadcrumb Snapshots ───────────────────────────────────────────────
249
+
250
+ describe('Breadcrumb snapshots', () => {
251
+ it('renders multi-level breadcrumb', () => {
252
+ const { container } = render(
253
+ <Breadcrumb>
254
+ <BreadcrumbList>
255
+ <BreadcrumbItem>
256
+ <BreadcrumbLink href="/">Home</BreadcrumbLink>
257
+ </BreadcrumbItem>
258
+ <BreadcrumbSeparator />
259
+ <BreadcrumbItem>
260
+ <BreadcrumbLink href="/products">Products</BreadcrumbLink>
261
+ </BreadcrumbItem>
262
+ <BreadcrumbSeparator />
263
+ <BreadcrumbItem>
264
+ <BreadcrumbPage>Current Page</BreadcrumbPage>
265
+ </BreadcrumbItem>
266
+ </BreadcrumbList>
267
+ </Breadcrumb>,
268
+ );
269
+ expect(container.firstChild).toMatchSnapshot();
270
+ });
271
+ });
272
+
273
+ // ─── Separator Snapshots ────────────────────────────────────────────────
274
+
275
+ describe('Separator snapshots', () => {
276
+ it('renders horizontal separator', () => {
277
+ const { container } = render(<Separator />);
278
+ expect(container.firstChild).toMatchSnapshot();
279
+ });
280
+
281
+ it('renders vertical separator', () => {
282
+ const { container } = render(<Separator orientation="vertical" />);
283
+ expect(container.firstChild).toMatchSnapshot();
284
+ });
285
+ });
286
+
287
+ // ─── Skeleton Snapshots ─────────────────────────────────────────────────
288
+
289
+ describe('Skeleton snapshots', () => {
290
+ it('renders default skeleton', () => {
291
+ const { container } = render(<Skeleton />);
292
+ expect(container.firstChild).toMatchSnapshot();
293
+ });
294
+
295
+ it('renders skeleton with text line dimensions', () => {
296
+ const { container } = render(<Skeleton className="h-4 w-[250px]" />);
297
+ expect(container.firstChild).toMatchSnapshot();
298
+ });
299
+
300
+ it('renders skeleton with circular avatar dimensions', () => {
301
+ const { container } = render(<Skeleton className="h-12 w-12 rounded-full" />);
302
+ expect(container.firstChild).toMatchSnapshot();
303
+ });
304
+
305
+ it('renders skeleton loading card layout', () => {
306
+ const { container } = render(
307
+ <div className="flex flex-col space-y-3">
308
+ <Skeleton className="h-[125px] w-[250px] rounded-xl" />
309
+ <div className="space-y-2">
310
+ <Skeleton className="h-4 w-[250px]" />
311
+ <Skeleton className="h-4 w-[200px]" />
312
+ </div>
313
+ </div>,
314
+ );
315
+ expect(container.firstChild).toMatchSnapshot();
316
+ });
317
+ });