@xynolog/react-ui 0.8.0 → 0.8.1

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 (235) hide show
  1. package/README.md +26 -46
  2. package/package.json +12 -9
  3. package/src/components/Button/Button.tsx +0 -188
  4. package/src/components/Button/__tests__/Button.test.tsx +0 -449
  5. package/src/components/CodeMirrorRenderer.tsx +0 -536
  6. package/src/components/DelegateProgress.tsx +0 -308
  7. package/src/components/ErrorBoundary.tsx +0 -174
  8. package/src/components/ItemFoundLog.tsx +0 -42
  9. package/src/components/LiveRegion.tsx +0 -261
  10. package/src/components/ProtectedErrorBoundary.tsx +0 -114
  11. package/src/components/ResizeHandle.tsx +0 -167
  12. package/src/components/ResourceTagsInline.tsx +0 -120
  13. package/src/components/SessionExpiryBanner.tsx +0 -74
  14. package/src/components/SessionTimer.tsx +0 -17
  15. package/src/components/StatusDisplay.tsx +0 -131
  16. package/src/components/Toast.tsx +0 -217
  17. package/src/components/Toolbar.tsx +0 -194
  18. package/src/components/UserMenuSkeleton.tsx +0 -13
  19. package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
  20. package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
  21. package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
  22. package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
  23. package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
  24. package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
  25. package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
  26. package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
  27. package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
  28. package/src/components/__tests__/SessionTimer.test.tsx +0 -199
  29. package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
  30. package/src/components/__tests__/Toast.test.tsx +0 -96
  31. package/src/components/__tests__/Toolbar.test.tsx +0 -111
  32. package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
  33. package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
  34. package/src/components/annotation/AnnotateToolbar.tsx +0 -531
  35. package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
  36. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
  37. package/src/components/annotation-popups/JsonLdView.tsx +0 -127
  38. package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
  39. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
  40. package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
  41. package/src/components/branding/XynologBranding.tsx +0 -41
  42. package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
  43. package/src/components/error-states/ResourceErrorState.tsx +0 -30
  44. package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
  45. package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
  46. package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
  47. package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
  48. package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
  49. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
  50. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
  51. package/src/components/layout/LeftSidebar.tsx +0 -150
  52. package/src/components/layout/PageLayout.tsx +0 -49
  53. package/src/components/layout/SkipLinks.tsx +0 -36
  54. package/src/components/layout/UnifiedHeader.tsx +0 -151
  55. package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
  56. package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
  57. package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
  58. package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
  59. package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
  60. package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
  61. package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
  62. package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
  63. package/src/components/modals/ComposeStep.tsx +0 -245
  64. package/src/components/modals/ConfigureGatherStep.tsx +0 -110
  65. package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
  66. package/src/components/modals/ConfigureSearchStep.tsx +0 -124
  67. package/src/components/modals/ContextSummary.tsx +0 -317
  68. package/src/components/modals/CorpusPane.tsx +0 -96
  69. package/src/components/modals/DiscardPrompt.tsx +0 -44
  70. package/src/components/modals/GatherContextStep.tsx +0 -480
  71. package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
  72. package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
  73. package/src/components/modals/PermissionDeniedModal.tsx +0 -207
  74. package/src/components/modals/ReferenceWizardModal.tsx +0 -656
  75. package/src/components/modals/ResourceGenerateModal.tsx +0 -457
  76. package/src/components/modals/SearchModal.tsx +0 -334
  77. package/src/components/modals/SearchResultsStep.tsx +0 -117
  78. package/src/components/modals/SessionEndedModal.tsx +0 -148
  79. package/src/components/modals/WizardFooter.tsx +0 -72
  80. package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
  81. package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
  82. package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
  83. package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
  84. package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
  85. package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
  86. package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
  87. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
  88. package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
  89. package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
  90. package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
  91. package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
  92. package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
  93. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
  94. package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
  95. package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
  96. package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
  97. package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
  98. package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
  99. package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
  100. package/src/components/navigation/NavigationMenu.tsx +0 -66
  101. package/src/components/navigation/ObservableLink.tsx +0 -90
  102. package/src/components/navigation/SimpleNavigation.tsx +0 -169
  103. package/src/components/navigation/SortableResourceTab.tsx +0 -122
  104. package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
  105. package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
  106. package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
  107. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
  108. package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
  109. package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
  110. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
  111. package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
  112. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
  113. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
  114. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
  115. package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
  116. package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
  117. package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
  118. package/src/components/pdf-annotation/rects-for-page.ts +0 -50
  119. package/src/components/resource/AnnotateView.tsx +0 -373
  120. package/src/components/resource/AnnotationHistory.tsx +0 -169
  121. package/src/components/resource/BrowseView.tsx +0 -440
  122. package/src/components/resource/DownloadFileLink.tsx +0 -53
  123. package/src/components/resource/HistoryEvent.tsx +0 -186
  124. package/src/components/resource/ResourceViewer.tsx +0 -617
  125. package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
  126. package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
  127. package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
  128. package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
  129. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
  130. package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
  131. package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
  132. package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
  133. package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
  134. package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
  135. package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
  136. package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
  137. package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
  138. package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
  139. package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
  140. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
  141. package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
  142. package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
  143. package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
  144. package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
  145. package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
  146. package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
  147. package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
  148. package/src/components/resource/__tests__/download-link.test.tsx +0 -171
  149. package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
  150. package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
  151. package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
  152. package/src/components/resource/annotate-renderers.tsx +0 -186
  153. package/src/components/resource/browse-renderers.tsx +0 -133
  154. package/src/components/resource/event-formatting.ts +0 -393
  155. package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
  156. package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
  157. package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
  158. package/src/components/resource/panels/CommentEntry.tsx +0 -242
  159. package/src/components/resource/panels/CommentsPanel.tsx +0 -320
  160. package/src/components/resource/panels/DelegateSection.tsx +0 -282
  161. package/src/components/resource/panels/DelegateShell.tsx +0 -134
  162. package/src/components/resource/panels/HighlightEntry.tsx +0 -83
  163. package/src/components/resource/panels/HighlightPanel.tsx +0 -212
  164. package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
  165. package/src/components/resource/panels/PanelHeader.tsx +0 -22
  166. package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
  167. package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
  168. package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
  169. package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
  170. package/src/components/resource/panels/TagEntry.tsx +0 -87
  171. package/src/components/resource/panels/TaggingPanel.tsx +0 -554
  172. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
  173. package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
  174. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
  175. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
  176. package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
  177. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
  178. package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
  179. package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
  180. package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
  181. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
  182. package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
  183. package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
  184. package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
  185. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
  186. package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
  187. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
  188. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
  189. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
  190. package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
  191. package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
  192. package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
  193. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
  194. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
  195. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
  196. package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
  197. package/src/components/resource/panels/agent-label.ts +0 -35
  198. package/src/components/settings/SettingsPanel.tsx +0 -251
  199. package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
  200. package/src/components/viewers/ImageViewer.tsx +0 -18
  201. package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
  202. package/src/components/viewers/index.ts +0 -1
  203. package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
  204. package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
  205. package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
  206. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
  207. package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
  208. package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
  209. package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
  210. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
  211. package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
  212. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
  213. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
  214. package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
  215. package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
  216. package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
  217. package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
  218. package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
  219. package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
  220. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
  221. package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
  222. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
  223. package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
  224. package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
  225. package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
  226. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
  227. package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
  228. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
  229. package/src/features/resource-viewer/generation-params.ts +0 -23
  230. package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
  231. package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
  232. package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
  233. package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
  234. package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
  235. package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
@@ -1,555 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render, screen, fireEvent } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import { UnifiedHeader } from '../UnifiedHeader';
5
- import type {
6
- LinkComponentProps,
7
- RouteBuilder,
8
- } from '../../../contexts/RoutingContext';
9
-
10
- // Mock only hooks - using real components via composition
11
- vi.mock('@/hooks/useUI', () => ({
12
- useDropdown: vi.fn(() => ({
13
- isOpen: false,
14
- toggle: vi.fn(),
15
- open: vi.fn(),
16
- close: vi.fn(),
17
- dropdownRef: { current: null },
18
- })),
19
- }));
20
-
21
- import { useDropdown } from '@/hooks/useUI';
22
-
23
- // Mock Link component
24
- const MockLink = ({ href, children, ...props }: LinkComponentProps) => (
25
- <a href={href} {...props}>
26
- {children}
27
- </a>
28
- );
29
-
30
- // Mock routes: the layout links to no resource, and leaves the others to their defaults
31
- const mockRoutes: RouteBuilder = {
32
- resourceDetail: (id: string) => `/resource/${id}`,
33
- };
34
-
35
- // Mock translation functions
36
- const mockT = (key: string) => `nav.${key}`;
37
- const mockTHome = (key: string) => `home.${key}`;
38
-
39
- describe('UnifiedHeader Component', () => {
40
- beforeEach(() => {
41
- vi.clearAllMocks();
42
- vi.mocked(useDropdown).mockReturnValue({
43
- isOpen: false,
44
- toggle: vi.fn(),
45
- open: vi.fn(),
46
- close: vi.fn(),
47
- dropdownRef: { current: null },
48
- });
49
- });
50
-
51
- describe('Rendering - Standalone Variant', () => {
52
- it('should render standalone variant with header element', () => {
53
- const { container } = render(
54
- <UnifiedHeader
55
- Link={MockLink}
56
- routes={mockRoutes}
57
- t={mockT}
58
- tHome={mockTHome}
59
- variant="standalone"
60
- />,
61
- );
62
-
63
- const header = container.querySelector('header');
64
- expect(header).toBeInTheDocument();
65
- expect(header).toHaveClass('xynolog-unified-header');
66
- });
67
-
68
- it('should render branding in standalone variant', () => {
69
- render(
70
- <UnifiedHeader
71
- Link={MockLink}
72
- routes={mockRoutes}
73
- t={mockT}
74
- tHome={mockTHome}
75
- variant="standalone"
76
- />,
77
- );
78
-
79
- // Real XynologBranding renders "Xynolog" text
80
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
81
- });
82
-
83
- it('should default to standalone variant', () => {
84
- const { container } = render(
85
- <UnifiedHeader
86
- Link={MockLink}
87
- routes={mockRoutes}
88
- t={mockT}
89
- tHome={mockTHome}
90
- />,
91
- );
92
-
93
- const header = container.querySelector('header');
94
- expect(header).toBeInTheDocument();
95
- });
96
- });
97
-
98
- describe('Rendering - Embedded Variant', () => {
99
- it('should render embedded variant without header element', () => {
100
- const { container } = render(
101
- <UnifiedHeader
102
- Link={MockLink}
103
- routes={mockRoutes}
104
- t={mockT}
105
- tHome={mockTHome}
106
- variant="embedded"
107
- />,
108
- );
109
-
110
- const header = container.querySelector('header');
111
- expect(header).not.toBeInTheDocument();
112
- });
113
-
114
- it('should render branding in embedded variant', () => {
115
- render(
116
- <UnifiedHeader
117
- Link={MockLink}
118
- routes={mockRoutes}
119
- t={mockT}
120
- tHome={mockTHome}
121
- variant="embedded"
122
- />,
123
- );
124
-
125
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
126
- });
127
- });
128
-
129
- describe('Rendering - Floating Variant', () => {
130
- it('should render floating variant with fixed positioning', () => {
131
- const { container } = render(
132
- <UnifiedHeader
133
- Link={MockLink}
134
- routes={mockRoutes}
135
- t={mockT}
136
- tHome={mockTHome}
137
- variant="floating"
138
- />,
139
- );
140
-
141
- const floatingDiv = container.querySelector(
142
- '.xynolog-unified-header--floating',
143
- );
144
- expect(floatingDiv).toBeInTheDocument();
145
- });
146
-
147
- it('should render branding in floating variant', () => {
148
- render(
149
- <UnifiedHeader
150
- Link={MockLink}
151
- routes={mockRoutes}
152
- t={mockT}
153
- tHome={mockTHome}
154
- variant="floating"
155
- />,
156
- );
157
-
158
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
159
- });
160
-
161
- it('should not render floating variant when showBranding is false', () => {
162
- const { container } = render(
163
- <UnifiedHeader
164
- Link={MockLink}
165
- routes={mockRoutes}
166
- t={mockT}
167
- tHome={mockTHome}
168
- variant="floating"
169
- showBranding={false}
170
- />,
171
- );
172
-
173
- const floatingDiv = container.querySelector(
174
- '.xynolog-unified-header--floating',
175
- );
176
- expect(floatingDiv).not.toBeInTheDocument();
177
- });
178
- });
179
-
180
- describe('Branding Display', () => {
181
- it('should show branding by default', () => {
182
- render(
183
- <UnifiedHeader
184
- Link={MockLink}
185
- routes={mockRoutes}
186
- t={mockT}
187
- tHome={mockTHome}
188
- />,
189
- );
190
-
191
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
192
- });
193
-
194
- it('should hide branding when showBranding is false', () => {
195
- render(
196
- <UnifiedHeader
197
- Link={MockLink}
198
- routes={mockRoutes}
199
- t={mockT}
200
- tHome={mockTHome}
201
- showBranding={false}
202
- />,
203
- );
204
-
205
- expect(screen.queryByText('Xynolog')).not.toBeInTheDocument();
206
- });
207
-
208
- it('should render navigation button for branding', () => {
209
- render(
210
- <UnifiedHeader
211
- Link={MockLink}
212
- routes={mockRoutes}
213
- t={mockT}
214
- tHome={mockTHome}
215
- />,
216
- );
217
-
218
- const button = screen.getByLabelText('Navigation menu');
219
- expect(button).toBeInTheDocument();
220
- });
221
- });
222
-
223
- describe('Dropdown Menu', () => {
224
- it('should toggle dropdown when branding button clicked', () => {
225
- const mockToggle = vi.fn();
226
- vi.mocked(useDropdown).mockReturnValue({
227
- isOpen: false,
228
- toggle: mockToggle,
229
- open: vi.fn(),
230
- close: vi.fn(),
231
- dropdownRef: { current: null },
232
- });
233
-
234
- render(
235
- <UnifiedHeader
236
- Link={MockLink}
237
- routes={mockRoutes}
238
- t={mockT}
239
- tHome={mockTHome}
240
- />,
241
- );
242
-
243
- const button = screen.getByLabelText('Navigation menu');
244
- fireEvent.click(button);
245
-
246
- expect(mockToggle).toHaveBeenCalledOnce();
247
- });
248
-
249
- it('should show dropdown menu when open and authenticated', () => {
250
- vi.mocked(useDropdown).mockReturnValue({
251
- isOpen: true,
252
- toggle: vi.fn(),
253
- open: vi.fn(),
254
- close: vi.fn(),
255
- dropdownRef: { current: null },
256
- });
257
-
258
- render(
259
- <UnifiedHeader
260
- Link={MockLink}
261
- routes={mockRoutes}
262
- t={mockT}
263
- tHome={mockTHome}
264
- isAuthenticated={true}
265
- />,
266
- );
267
-
268
- // Real NavigationMenu renders nav.know link
269
- expect(screen.getByText('nav.know')).toBeInTheDocument();
270
- });
271
-
272
- it('should not show dropdown menu when not authenticated', () => {
273
- vi.mocked(useDropdown).mockReturnValue({
274
- isOpen: true,
275
- toggle: vi.fn(),
276
- open: vi.fn(),
277
- close: vi.fn(),
278
- dropdownRef: { current: null },
279
- });
280
-
281
- render(
282
- <UnifiedHeader
283
- Link={MockLink}
284
- routes={mockRoutes}
285
- t={mockT}
286
- tHome={mockTHome}
287
- isAuthenticated={false}
288
- />,
289
- );
290
-
291
- expect(screen.queryByText('nav.know')).not.toBeInTheDocument();
292
- });
293
-
294
- it('should not show dropdown menu when closed', () => {
295
- vi.mocked(useDropdown).mockReturnValue({
296
- isOpen: false,
297
- toggle: vi.fn(),
298
- open: vi.fn(),
299
- close: vi.fn(),
300
- dropdownRef: { current: null },
301
- });
302
-
303
- render(
304
- <UnifiedHeader
305
- Link={MockLink}
306
- routes={mockRoutes}
307
- t={mockT}
308
- tHome={mockTHome}
309
- isAuthenticated={true}
310
- />,
311
- );
312
-
313
- expect(screen.queryByText('nav.know')).not.toBeInTheDocument();
314
- });
315
-
316
- it('should close dropdown when menu item clicked', () => {
317
- const mockClose = vi.fn();
318
- vi.mocked(useDropdown).mockReturnValue({
319
- isOpen: true,
320
- toggle: vi.fn(),
321
- open: vi.fn(),
322
- close: mockClose,
323
- dropdownRef: { current: null },
324
- });
325
-
326
- render(
327
- <UnifiedHeader
328
- Link={MockLink}
329
- routes={mockRoutes}
330
- t={mockT}
331
- tHome={mockTHome}
332
- isAuthenticated={true}
333
- />,
334
- );
335
-
336
- // Real NavigationMenu renders nav.know link
337
- const menuItem = screen.getByText('nav.know');
338
- fireEvent.click(menuItem);
339
-
340
- expect(mockClose).toHaveBeenCalledOnce();
341
- });
342
- });
343
-
344
- describe('Props Handling', () => {
345
- it('should use custom branding link', () => {
346
- vi.mocked(useDropdown).mockReturnValue({
347
- isOpen: false,
348
- toggle: vi.fn(),
349
- open: vi.fn(),
350
- close: vi.fn(),
351
- dropdownRef: { current: null },
352
- });
353
-
354
- render(
355
- <UnifiedHeader
356
- Link={MockLink}
357
- routes={mockRoutes}
358
- t={mockT}
359
- tHome={mockTHome}
360
- brandingLink="/custom"
361
- />,
362
- );
363
-
364
- // Should render branding with custom link
365
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
366
- });
367
-
368
- it('should default branding link to /', () => {
369
- render(
370
- <UnifiedHeader
371
- Link={MockLink}
372
- routes={mockRoutes}
373
- t={mockT}
374
- tHome={mockTHome}
375
- />,
376
- );
377
-
378
- expect(screen.getByText('Xynolog')).toBeInTheDocument();
379
- });
380
-
381
- it('should pass moderator status to NavigationMenu', () => {
382
- vi.mocked(useDropdown).mockReturnValue({
383
- isOpen: true,
384
- toggle: vi.fn(),
385
- open: vi.fn(),
386
- close: vi.fn(),
387
- dropdownRef: { current: null },
388
- });
389
-
390
- render(
391
- <UnifiedHeader
392
- Link={MockLink}
393
- routes={mockRoutes}
394
- t={mockT}
395
- tHome={mockTHome}
396
- isAuthenticated={true}
397
- />,
398
- );
399
-
400
- // Real NavigationMenu renders moderate link
401
- expect(screen.getByText('nav.moderate')).toBeInTheDocument();
402
- });
403
- });
404
-
405
- describe('Accessibility', () => {
406
- it('should have proper ARIA attributes on navigation button - standalone', () => {
407
- render(
408
- <UnifiedHeader
409
- Link={MockLink}
410
- routes={mockRoutes}
411
- t={mockT}
412
- tHome={mockTHome}
413
- variant="standalone"
414
- />,
415
- );
416
-
417
- const button = screen.getByLabelText('Navigation menu');
418
- expect(button).toHaveAttribute('aria-expanded', 'false');
419
- expect(button).toHaveAttribute('aria-controls', 'nav-menu-dropdown-2');
420
- expect(button).toHaveAttribute('aria-haspopup', 'true');
421
- expect(button).toHaveAttribute('id', 'nav-menu-button-2');
422
- });
423
-
424
- it('should have proper ARIA attributes on navigation button - floating', () => {
425
- render(
426
- <UnifiedHeader
427
- Link={MockLink}
428
- routes={mockRoutes}
429
- t={mockT}
430
- tHome={mockTHome}
431
- variant="floating"
432
- />,
433
- );
434
-
435
- const button = screen.getByLabelText('Navigation menu');
436
- expect(button).toHaveAttribute('aria-expanded', 'false');
437
- expect(button).toHaveAttribute('aria-controls', 'nav-menu-dropdown-1');
438
- expect(button).toHaveAttribute('aria-haspopup', 'true');
439
- expect(button).toHaveAttribute('id', 'nav-menu-button-1');
440
- });
441
-
442
- it('should update aria-expanded when dropdown opens', () => {
443
- vi.mocked(useDropdown).mockReturnValue({
444
- isOpen: true,
445
- toggle: vi.fn(),
446
- open: vi.fn(),
447
- close: vi.fn(),
448
- dropdownRef: { current: null },
449
- });
450
-
451
- render(
452
- <UnifiedHeader
453
- Link={MockLink}
454
- routes={mockRoutes}
455
- t={mockT}
456
- tHome={mockTHome}
457
- />,
458
- );
459
-
460
- const button = screen.getByLabelText('Navigation menu');
461
- expect(button).toHaveAttribute('aria-expanded', 'true');
462
- });
463
-
464
- it('should have proper menu role attributes', () => {
465
- vi.mocked(useDropdown).mockReturnValue({
466
- isOpen: true,
467
- toggle: vi.fn(),
468
- open: vi.fn(),
469
- close: vi.fn(),
470
- dropdownRef: { current: null },
471
- });
472
-
473
- render(
474
- <UnifiedHeader
475
- Link={MockLink}
476
- routes={mockRoutes}
477
- t={mockT}
478
- tHome={mockTHome}
479
- isAuthenticated={true}
480
- />,
481
- );
482
-
483
- const dropdown = screen.getByRole('menu');
484
- expect(dropdown).toHaveAttribute('aria-orientation', 'vertical');
485
- expect(dropdown).toHaveAttribute('aria-labelledby', 'nav-menu-button-2');
486
- expect(dropdown).toHaveAttribute('id', 'nav-menu-dropdown-2');
487
- });
488
- });
489
-
490
- describe('Styling', () => {
491
- it('should have proper standalone header styling', () => {
492
- const { container } = render(
493
- <UnifiedHeader
494
- Link={MockLink}
495
- routes={mockRoutes}
496
- t={mockT}
497
- tHome={mockTHome}
498
- variant="standalone"
499
- />,
500
- );
501
-
502
- const header = container.querySelector('header');
503
- expect(header).toHaveClass('xynolog-unified-header');
504
- });
505
-
506
- it('should have proper floating variant styling', () => {
507
- const { container } = render(
508
- <UnifiedHeader
509
- Link={MockLink}
510
- routes={mockRoutes}
511
- t={mockT}
512
- tHome={mockTHome}
513
- variant="floating"
514
- />,
515
- );
516
-
517
- const floatingDiv = container.querySelector(
518
- '.xynolog-unified-header--floating',
519
- );
520
- expect(floatingDiv).toBeInTheDocument();
521
- });
522
-
523
- it('should have different layout classes for standalone vs embedded', () => {
524
- const { container: standaloneContainer } = render(
525
- <UnifiedHeader
526
- Link={MockLink}
527
- routes={mockRoutes}
528
- t={mockT}
529
- tHome={mockTHome}
530
- variant="standalone"
531
- />,
532
- );
533
-
534
- const { container: embeddedContainer } = render(
535
- <UnifiedHeader
536
- Link={MockLink}
537
- routes={mockRoutes}
538
- t={mockT}
539
- tHome={mockTHome}
540
- variant="embedded"
541
- />,
542
- );
543
-
544
- const standaloneContent = standaloneContainer.querySelector(
545
- '.xynolog-unified-header',
546
- );
547
- expect(standaloneContent).toBeInTheDocument();
548
-
549
- // Embedded variant has branding directly in container
550
- const embeddedContent =
551
- embeddedContainer.querySelector('.xynolog-branding');
552
- expect(embeddedContent).toBeInTheDocument();
553
- });
554
- });
555
- });
@@ -1,19 +0,0 @@
1
- /**
2
- * ComposeLoadingState Component
3
- *
4
- * Simple loading state display for the compose page.
5
- */
6
-
7
- export interface ComposeLoadingStateProps {
8
- message: string;
9
- }
10
-
11
- export function ComposeLoadingState({ message }: ComposeLoadingStateProps) {
12
- return (
13
- <div className="xynolog-loading-state-wrapper">
14
- <div className="xynolog-loading-state xynolog-loading-state-compose">
15
- <p className="xynolog-loading-message">{message}</p>
16
- </div>
17
- </div>
18
- );
19
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * ResourceLoadingState - Loading state component for resource viewer
3
- *
4
- * Pure React component - no Next.js dependencies.
5
- */
6
-
7
- export function ResourceLoadingState() {
8
- return (
9
- <div className="xynolog-loading-state xynolog-loading-state-resource">
10
- <p className="xynolog-loading-message">Loading resource...</p>
11
- </div>
12
- );
13
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Tests for ComposeLoadingState component
3
- *
4
- * Simple tests for a simple component. No mocking required.
5
- */
6
-
7
- import { describe, it, expect } from 'vitest';
8
- import { render, screen } from '@testing-library/react';
9
- import { ComposeLoadingState } from '../ComposeLoadingState';
10
-
11
- describe('ComposeLoadingState', () => {
12
- it('renders loading message', () => {
13
- render(<ComposeLoadingState message="Loading..." />);
14
-
15
- expect(screen.getByText('Loading...')).toBeInTheDocument();
16
- });
17
-
18
- it('renders custom message', () => {
19
- render(<ComposeLoadingState message="Checking authentication..." />);
20
-
21
- expect(screen.getByText('Checking authentication...')).toBeInTheDocument();
22
- });
23
-
24
- it('renders with correct styling', () => {
25
- render(<ComposeLoadingState message="Loading..." />);
26
-
27
- const container = screen.getByText('Loading...').parentElement;
28
- expect(container).toHaveClass('xynolog-loading-state');
29
- });
30
-
31
- it('renders text with correct styling', () => {
32
- render(<ComposeLoadingState message="Loading..." />);
33
-
34
- const text = screen.getByText('Loading...');
35
- expect(text).toHaveClass('xynolog-loading-message');
36
- });
37
- });
@@ -1,31 +0,0 @@
1
- /**
2
- * Tests for ResourceLoadingState component
3
- *
4
- * Simple tests for a simple component. No mocking required.
5
- */
6
-
7
- import { describe, it, expect } from 'vitest';
8
- import { render, screen } from '@testing-library/react';
9
- import { ResourceLoadingState } from '../ResourceLoadingState';
10
-
11
- describe('ResourceLoadingState', () => {
12
- it('renders loading message', () => {
13
- render(<ResourceLoadingState />);
14
-
15
- expect(screen.getByText('Loading resource...')).toBeInTheDocument();
16
- });
17
-
18
- it('renders with correct styling', () => {
19
- render(<ResourceLoadingState />);
20
-
21
- const container = screen.getByText('Loading resource...').parentElement;
22
- expect(container).toHaveClass('xynolog-loading-state');
23
- });
24
-
25
- it('renders text with correct styling', () => {
26
- render(<ResourceLoadingState />);
27
-
28
- const text = screen.getByText('Loading resource...');
29
- expect(text).toHaveClass('xynolog-loading-message');
30
- });
31
- });