@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.
- package/README.md +26 -46
- package/package.json +12 -9
- package/src/components/Button/Button.tsx +0 -188
- package/src/components/Button/__tests__/Button.test.tsx +0 -449
- package/src/components/CodeMirrorRenderer.tsx +0 -536
- package/src/components/DelegateProgress.tsx +0 -308
- package/src/components/ErrorBoundary.tsx +0 -174
- package/src/components/ItemFoundLog.tsx +0 -42
- package/src/components/LiveRegion.tsx +0 -261
- package/src/components/ProtectedErrorBoundary.tsx +0 -114
- package/src/components/ResizeHandle.tsx +0 -167
- package/src/components/ResourceTagsInline.tsx +0 -120
- package/src/components/SessionExpiryBanner.tsx +0 -74
- package/src/components/SessionTimer.tsx +0 -17
- package/src/components/StatusDisplay.tsx +0 -131
- package/src/components/Toast.tsx +0 -217
- package/src/components/Toolbar.tsx +0 -194
- package/src/components/UserMenuSkeleton.tsx +0 -13
- package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
- package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
- package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
- package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
- package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
- package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
- package/src/components/__tests__/SessionTimer.test.tsx +0 -199
- package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
- package/src/components/__tests__/Toast.test.tsx +0 -96
- package/src/components/__tests__/Toolbar.test.tsx +0 -111
- package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
- package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
- package/src/components/annotation/AnnotateToolbar.tsx +0 -531
- package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
- package/src/components/annotation-popups/JsonLdView.tsx +0 -127
- package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
- package/src/components/branding/XynologBranding.tsx +0 -41
- package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
- package/src/components/error-states/ResourceErrorState.tsx +0 -30
- package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
- package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
- package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
- package/src/components/layout/LeftSidebar.tsx +0 -150
- package/src/components/layout/PageLayout.tsx +0 -49
- package/src/components/layout/SkipLinks.tsx +0 -36
- package/src/components/layout/UnifiedHeader.tsx +0 -151
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
- package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
- package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
- package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
- package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
- package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
- package/src/components/modals/ComposeStep.tsx +0 -245
- package/src/components/modals/ConfigureGatherStep.tsx +0 -110
- package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
- package/src/components/modals/ConfigureSearchStep.tsx +0 -124
- package/src/components/modals/ContextSummary.tsx +0 -317
- package/src/components/modals/CorpusPane.tsx +0 -96
- package/src/components/modals/DiscardPrompt.tsx +0 -44
- package/src/components/modals/GatherContextStep.tsx +0 -480
- package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
- package/src/components/modals/PermissionDeniedModal.tsx +0 -207
- package/src/components/modals/ReferenceWizardModal.tsx +0 -656
- package/src/components/modals/ResourceGenerateModal.tsx +0 -457
- package/src/components/modals/SearchModal.tsx +0 -334
- package/src/components/modals/SearchResultsStep.tsx +0 -117
- package/src/components/modals/SessionEndedModal.tsx +0 -148
- package/src/components/modals/WizardFooter.tsx +0 -72
- package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
- package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
- package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
- package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
- package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
- package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
- package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
- package/src/components/navigation/NavigationMenu.tsx +0 -66
- package/src/components/navigation/ObservableLink.tsx +0 -90
- package/src/components/navigation/SimpleNavigation.tsx +0 -169
- package/src/components/navigation/SortableResourceTab.tsx +0 -122
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
- package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
- package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
- package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
- package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
- package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
- package/src/components/pdf-annotation/rects-for-page.ts +0 -50
- package/src/components/resource/AnnotateView.tsx +0 -373
- package/src/components/resource/AnnotationHistory.tsx +0 -169
- package/src/components/resource/BrowseView.tsx +0 -440
- package/src/components/resource/DownloadFileLink.tsx +0 -53
- package/src/components/resource/HistoryEvent.tsx +0 -186
- package/src/components/resource/ResourceViewer.tsx +0 -617
- package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
- package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
- package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
- package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
- package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
- package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
- package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
- package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
- package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
- package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
- package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
- package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
- package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
- package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
- package/src/components/resource/__tests__/download-link.test.tsx +0 -171
- package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
- package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
- package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
- package/src/components/resource/annotate-renderers.tsx +0 -186
- package/src/components/resource/browse-renderers.tsx +0 -133
- package/src/components/resource/event-formatting.ts +0 -393
- package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
- package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
- package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
- package/src/components/resource/panels/CommentEntry.tsx +0 -242
- package/src/components/resource/panels/CommentsPanel.tsx +0 -320
- package/src/components/resource/panels/DelegateSection.tsx +0 -282
- package/src/components/resource/panels/DelegateShell.tsx +0 -134
- package/src/components/resource/panels/HighlightEntry.tsx +0 -83
- package/src/components/resource/panels/HighlightPanel.tsx +0 -212
- package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
- package/src/components/resource/panels/PanelHeader.tsx +0 -22
- package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
- package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
- package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
- package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
- package/src/components/resource/panels/TagEntry.tsx +0 -87
- package/src/components/resource/panels/TaggingPanel.tsx +0 -554
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
- package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
- package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
- package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
- package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
- package/src/components/resource/panels/agent-label.ts +0 -35
- package/src/components/settings/SettingsPanel.tsx +0 -251
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
- package/src/components/viewers/ImageViewer.tsx +0 -18
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
- package/src/components/viewers/index.ts +0 -1
- package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
- package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
- package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
- package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
- package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
- package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
- package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
- package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
- package/src/features/resource-viewer/generation-params.ts +0 -23
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for AuthErrorDisplay 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 { AuthErrorDisplay } from '../components/AuthErrorDisplay';
|
|
10
|
-
|
|
11
|
-
// Mock Link component for testing
|
|
12
|
-
const MockLink: React.ComponentType<{
|
|
13
|
-
href: string;
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
className?: string;
|
|
16
|
-
}> = ({ href, children, className }) => (
|
|
17
|
-
<a href={href} className={className}>
|
|
18
|
-
{children}
|
|
19
|
-
</a>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const mockTranslations = {
|
|
23
|
-
pageTitle: 'Authentication Error',
|
|
24
|
-
tryAgain: 'Try signing in again',
|
|
25
|
-
errorConfiguration: 'There is a problem with the server configuration.',
|
|
26
|
-
errorAccessDenied: 'Your account is not permitted to sign in.',
|
|
27
|
-
errorVerification: 'The verification link is invalid or has expired.',
|
|
28
|
-
errorGeneric: 'An authentication error occurred. Please try again.',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
describe('AuthErrorDisplay', () => {
|
|
32
|
-
describe('Error Message Display', () => {
|
|
33
|
-
it('displays Configuration error message', () => {
|
|
34
|
-
render(
|
|
35
|
-
<AuthErrorDisplay
|
|
36
|
-
Link={MockLink}
|
|
37
|
-
errorType="Configuration"
|
|
38
|
-
translations={mockTranslations}
|
|
39
|
-
/>,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(screen.getByText('Authentication Error')).toBeInTheDocument();
|
|
43
|
-
expect(
|
|
44
|
-
screen.getByText('There is a problem with the server configuration.'),
|
|
45
|
-
).toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('displays AccessDenied error message', () => {
|
|
49
|
-
render(
|
|
50
|
-
<AuthErrorDisplay
|
|
51
|
-
Link={MockLink}
|
|
52
|
-
errorType="AccessDenied"
|
|
53
|
-
translations={mockTranslations}
|
|
54
|
-
/>,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
expect(
|
|
58
|
-
screen.getByText('Your account is not permitted to sign in.'),
|
|
59
|
-
).toBeInTheDocument();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('displays Verification error message', () => {
|
|
63
|
-
render(
|
|
64
|
-
<AuthErrorDisplay
|
|
65
|
-
Link={MockLink}
|
|
66
|
-
errorType="Verification"
|
|
67
|
-
translations={mockTranslations}
|
|
68
|
-
/>,
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
expect(
|
|
72
|
-
screen.getByText('The verification link is invalid or has expired.'),
|
|
73
|
-
).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('displays generic error message for unknown error type', () => {
|
|
77
|
-
render(
|
|
78
|
-
<AuthErrorDisplay
|
|
79
|
-
Link={MockLink}
|
|
80
|
-
errorType="UnknownError"
|
|
81
|
-
translations={mockTranslations}
|
|
82
|
-
/>,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
expect(
|
|
86
|
-
screen.getByText('An authentication error occurred. Please try again.'),
|
|
87
|
-
).toBeInTheDocument();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('displays generic error message when errorType is null', () => {
|
|
91
|
-
render(
|
|
92
|
-
<AuthErrorDisplay
|
|
93
|
-
Link={MockLink}
|
|
94
|
-
errorType={null}
|
|
95
|
-
translations={mockTranslations}
|
|
96
|
-
/>,
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
expect(
|
|
100
|
-
screen.getByText('An authentication error occurred. Please try again.'),
|
|
101
|
-
).toBeInTheDocument();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
describe('UI Elements', () => {
|
|
106
|
-
it('renders the page title', () => {
|
|
107
|
-
render(
|
|
108
|
-
<AuthErrorDisplay
|
|
109
|
-
Link={MockLink}
|
|
110
|
-
errorType="AccessDenied"
|
|
111
|
-
translations={mockTranslations}
|
|
112
|
-
/>,
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
expect(screen.getByText('Authentication Error')).toBeInTheDocument();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('renders error message in styled container', () => {
|
|
119
|
-
render(
|
|
120
|
-
<AuthErrorDisplay
|
|
121
|
-
Link={MockLink}
|
|
122
|
-
errorType="AccessDenied"
|
|
123
|
-
translations={mockTranslations}
|
|
124
|
-
/>,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
const errorText = screen.getByText(
|
|
128
|
-
'Your account is not permitted to sign in.',
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
expect(errorText).toHaveClass(
|
|
132
|
-
'xynolog-auth-error-display__error-message',
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('renders try again link', () => {
|
|
137
|
-
render(
|
|
138
|
-
<AuthErrorDisplay
|
|
139
|
-
Link={MockLink}
|
|
140
|
-
errorType="AccessDenied"
|
|
141
|
-
translations={mockTranslations}
|
|
142
|
-
/>,
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
const link = screen.getByRole('link', { name: 'Try signing in again' });
|
|
146
|
-
expect(link).toBeInTheDocument();
|
|
147
|
-
expect(link).toHaveAttribute('href', '/auth/signin');
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('Accessibility', () => {
|
|
152
|
-
it('has proper heading hierarchy', () => {
|
|
153
|
-
render(
|
|
154
|
-
<AuthErrorDisplay
|
|
155
|
-
Link={MockLink}
|
|
156
|
-
errorType="AccessDenied"
|
|
157
|
-
translations={mockTranslations}
|
|
158
|
-
/>,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const heading = screen.getByRole('heading', {
|
|
162
|
-
name: 'Authentication Error',
|
|
163
|
-
});
|
|
164
|
-
expect(heading).toBeInTheDocument();
|
|
165
|
-
expect(heading.tagName).toBe('H2');
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('has accessible link to sign-in', () => {
|
|
169
|
-
render(
|
|
170
|
-
<AuthErrorDisplay
|
|
171
|
-
Link={MockLink}
|
|
172
|
-
errorType="AccessDenied"
|
|
173
|
-
translations={mockTranslations}
|
|
174
|
-
/>,
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const link = screen.getByRole('link', { name: 'Try signing in again' });
|
|
178
|
-
expect(link).toBeInTheDocument();
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AuthErrorDisplay - Pure React component for displaying authentication errors
|
|
3
|
-
*
|
|
4
|
-
* No Next.js dependencies - receives error type and translations via props.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import type { LinkComponentProps } from '../../../contexts/RoutingContext';
|
|
9
|
-
|
|
10
|
-
export interface AuthErrorDisplayProps {
|
|
11
|
-
/**
|
|
12
|
-
* Link component for routing - passed from parent
|
|
13
|
-
*/
|
|
14
|
-
Link: React.ComponentType<LinkComponentProps>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Error type from URL parameter
|
|
18
|
-
*/
|
|
19
|
-
errorType: string | null;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Translation strings
|
|
23
|
-
*/
|
|
24
|
-
translations: {
|
|
25
|
-
pageTitle: string;
|
|
26
|
-
tryAgain: string;
|
|
27
|
-
errorConfiguration: string;
|
|
28
|
-
errorAccessDenied: string;
|
|
29
|
-
errorVerification: string;
|
|
30
|
-
errorGeneric: string;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get error message based on error type
|
|
36
|
-
*/
|
|
37
|
-
function getErrorMessage(
|
|
38
|
-
errorType: string | null,
|
|
39
|
-
t: AuthErrorDisplayProps['translations'],
|
|
40
|
-
): string {
|
|
41
|
-
switch (errorType) {
|
|
42
|
-
case 'Configuration':
|
|
43
|
-
return t.errorConfiguration;
|
|
44
|
-
case 'AccessDenied':
|
|
45
|
-
return t.errorAccessDenied;
|
|
46
|
-
case 'Verification':
|
|
47
|
-
return t.errorVerification;
|
|
48
|
-
default:
|
|
49
|
-
return t.errorGeneric;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* AuthErrorDisplay component
|
|
55
|
-
*
|
|
56
|
-
* Displays authentication error messages with a link to try again.
|
|
57
|
-
*/
|
|
58
|
-
export function AuthErrorDisplay({
|
|
59
|
-
errorType,
|
|
60
|
-
Link,
|
|
61
|
-
translations: t,
|
|
62
|
-
}: AuthErrorDisplayProps) {
|
|
63
|
-
const errorMessage = getErrorMessage(errorType, t);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<div className="xynolog-auth-error-display">
|
|
67
|
-
<div className="xynolog-auth-error-display__container">
|
|
68
|
-
<div>
|
|
69
|
-
<h2 className="xynolog-auth-error-display__title">{t.pageTitle}</h2>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div className="xynolog-auth-error-display__error-box">
|
|
73
|
-
<div className="xynolog-auth-error-display__error-message">
|
|
74
|
-
{errorMessage}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div className="xynolog-auth-error-display__actions">
|
|
79
|
-
<Link
|
|
80
|
-
href="/auth/signin"
|
|
81
|
-
className="xynolog-auth-error-display__link"
|
|
82
|
-
>
|
|
83
|
-
{t.tryAgain}
|
|
84
|
-
</Link>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for EntityTagsPage component
|
|
3
|
-
*
|
|
4
|
-
* Tests the moderation entity tags management page.
|
|
5
|
-
* No Next.js mocking required - all dependencies passed as props!
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
9
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
10
|
-
import { EntityTagsPage } from '../components/EntityTagsPage';
|
|
11
|
-
import type { EntityTagsPageProps } from '../components/EntityTagsPage';
|
|
12
|
-
|
|
13
|
-
const createMockProps = (
|
|
14
|
-
overrides?: Partial<EntityTagsPageProps>,
|
|
15
|
-
): EntityTagsPageProps => ({
|
|
16
|
-
entityTypes: ['Document', 'Person', 'Organization'],
|
|
17
|
-
isLoading: false,
|
|
18
|
-
error: '',
|
|
19
|
-
newTag: '',
|
|
20
|
-
onNewTagChange: vi.fn(),
|
|
21
|
-
onAddTag: vi.fn(),
|
|
22
|
-
isAddingTag: false,
|
|
23
|
-
theme: 'light',
|
|
24
|
-
activePanel: null,
|
|
25
|
-
translations: {
|
|
26
|
-
pageTitle: 'Entity Tags',
|
|
27
|
-
pageDescription: 'Manage entity type tags',
|
|
28
|
-
sectionTitle: 'Available Tags',
|
|
29
|
-
sectionDescription: 'Tags for categorizing entities',
|
|
30
|
-
inputPlaceholder: 'Enter new tag',
|
|
31
|
-
addTag: 'Add Tag',
|
|
32
|
-
adding: 'Adding...',
|
|
33
|
-
},
|
|
34
|
-
ToolbarPanels: () => <div data-testid="toolbar-panels" />,
|
|
35
|
-
Toolbar: () => <div data-testid="toolbar" />,
|
|
36
|
-
...overrides,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('EntityTagsPage', () => {
|
|
40
|
-
describe('Basic Rendering', () => {
|
|
41
|
-
it('renders page title and description', () => {
|
|
42
|
-
const props = createMockProps();
|
|
43
|
-
render(<EntityTagsPage {...props} />);
|
|
44
|
-
|
|
45
|
-
expect(screen.getByText('Entity Tags')).toBeInTheDocument();
|
|
46
|
-
expect(screen.getByText('Manage entity type tags')).toBeInTheDocument();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('renders section title and description', () => {
|
|
50
|
-
const props = createMockProps();
|
|
51
|
-
render(<EntityTagsPage {...props} />);
|
|
52
|
-
|
|
53
|
-
expect(screen.getByText('Available Tags')).toBeInTheDocument();
|
|
54
|
-
expect(
|
|
55
|
-
screen.getByText('Tags for categorizing entities'),
|
|
56
|
-
).toBeInTheDocument();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('renders tag icon', () => {
|
|
60
|
-
const props = createMockProps();
|
|
61
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
62
|
-
|
|
63
|
-
const icon = container.querySelector('.xynolog-entity-tags__icon');
|
|
64
|
-
expect(icon).toBeInTheDocument();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
describe('Entity Tags Display', () => {
|
|
69
|
-
it('displays all entity tags', () => {
|
|
70
|
-
const props = createMockProps();
|
|
71
|
-
render(<EntityTagsPage {...props} />);
|
|
72
|
-
|
|
73
|
-
expect(screen.getByText('Document')).toBeInTheDocument();
|
|
74
|
-
expect(screen.getByText('Person')).toBeInTheDocument();
|
|
75
|
-
expect(screen.getByText('Organization')).toBeInTheDocument();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('renders tags with correct styling', () => {
|
|
79
|
-
const props = createMockProps();
|
|
80
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
81
|
-
|
|
82
|
-
const tagBadge = container.querySelector('.xynolog-tag');
|
|
83
|
-
expect(tagBadge).toBeInTheDocument();
|
|
84
|
-
expect(tagBadge).toHaveTextContent('Document');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('handles empty entity types', () => {
|
|
88
|
-
const props = createMockProps({ entityTypes: [] });
|
|
89
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
90
|
-
|
|
91
|
-
const tags = container.querySelectorAll('.xynolog-tag');
|
|
92
|
-
expect(tags.length).toBe(0);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('handles many entity types', () => {
|
|
96
|
-
const manyTags = Array.from({ length: 20 }, (_, i) => `Tag${i}`);
|
|
97
|
-
const props = createMockProps({ entityTypes: manyTags });
|
|
98
|
-
render(<EntityTagsPage {...props} />);
|
|
99
|
-
|
|
100
|
-
expect(screen.getByText('Tag0')).toBeInTheDocument();
|
|
101
|
-
expect(screen.getByText('Tag19')).toBeInTheDocument();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
describe('Add Tag Input', () => {
|
|
106
|
-
it('renders input with placeholder', () => {
|
|
107
|
-
const props = createMockProps();
|
|
108
|
-
render(<EntityTagsPage {...props} />);
|
|
109
|
-
|
|
110
|
-
expect(screen.getByPlaceholderText('Enter new tag')).toBeInTheDocument();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('calls onNewTagChange when typing', () => {
|
|
114
|
-
const onNewTagChange = vi.fn();
|
|
115
|
-
const props = createMockProps({ onNewTagChange });
|
|
116
|
-
render(<EntityTagsPage {...props} />);
|
|
117
|
-
|
|
118
|
-
const input = screen.getByPlaceholderText('Enter new tag');
|
|
119
|
-
fireEvent.change(input, { target: { value: 'NewTag' } });
|
|
120
|
-
|
|
121
|
-
expect(onNewTagChange).toHaveBeenCalledWith('NewTag');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('displays current newTag value', () => {
|
|
125
|
-
const props = createMockProps({ newTag: 'Current Value' });
|
|
126
|
-
render(<EntityTagsPage {...props} />);
|
|
127
|
-
|
|
128
|
-
const input = screen.getByPlaceholderText(
|
|
129
|
-
'Enter new tag',
|
|
130
|
-
) as HTMLInputElement;
|
|
131
|
-
expect(input.value).toBe('Current Value');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('disables input when adding tag', () => {
|
|
135
|
-
const props = createMockProps({ isAddingTag: true });
|
|
136
|
-
render(<EntityTagsPage {...props} />);
|
|
137
|
-
|
|
138
|
-
const input = screen.getByPlaceholderText('Enter new tag');
|
|
139
|
-
expect(input).toBeDisabled();
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('calls onAddTag when Enter key pressed', () => {
|
|
143
|
-
const onAddTag = vi.fn();
|
|
144
|
-
const props = createMockProps({ onAddTag, newTag: 'Test' });
|
|
145
|
-
render(<EntityTagsPage {...props} />);
|
|
146
|
-
|
|
147
|
-
const input = screen.getByPlaceholderText('Enter new tag');
|
|
148
|
-
fireEvent.keyDown(input, { key: 'Enter' });
|
|
149
|
-
|
|
150
|
-
expect(onAddTag).toHaveBeenCalledTimes(1);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('does not call onAddTag for other keys', () => {
|
|
154
|
-
const onAddTag = vi.fn();
|
|
155
|
-
const props = createMockProps({ onAddTag });
|
|
156
|
-
render(<EntityTagsPage {...props} />);
|
|
157
|
-
|
|
158
|
-
const input = screen.getByPlaceholderText('Enter new tag');
|
|
159
|
-
fireEvent.keyDown(input, { key: 'a' });
|
|
160
|
-
fireEvent.keyDown(input, { key: 'Escape' });
|
|
161
|
-
|
|
162
|
-
expect(onAddTag).not.toHaveBeenCalled();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe('Add Tag Button', () => {
|
|
167
|
-
it('renders add tag button', () => {
|
|
168
|
-
const props = createMockProps();
|
|
169
|
-
render(<EntityTagsPage {...props} />);
|
|
170
|
-
|
|
171
|
-
expect(
|
|
172
|
-
screen.getByRole('button', { name: /Add Tag/i }),
|
|
173
|
-
).toBeInTheDocument();
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('calls onAddTag when clicked', () => {
|
|
177
|
-
const onAddTag = vi.fn();
|
|
178
|
-
const props = createMockProps({ onAddTag, newTag: 'Test' });
|
|
179
|
-
render(<EntityTagsPage {...props} />);
|
|
180
|
-
|
|
181
|
-
fireEvent.click(screen.getByRole('button', { name: /Add Tag/i }));
|
|
182
|
-
expect(onAddTag).toHaveBeenCalledTimes(1);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it('disables button when adding', () => {
|
|
186
|
-
const props = createMockProps({ isAddingTag: true });
|
|
187
|
-
render(<EntityTagsPage {...props} />);
|
|
188
|
-
|
|
189
|
-
const button = screen.getByRole('button');
|
|
190
|
-
expect(button).toBeDisabled();
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('disables button when newTag is empty', () => {
|
|
194
|
-
const props = createMockProps({ newTag: '' });
|
|
195
|
-
render(<EntityTagsPage {...props} />);
|
|
196
|
-
|
|
197
|
-
const button = screen.getByRole('button');
|
|
198
|
-
expect(button).toBeDisabled();
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('disables button when newTag is whitespace only', () => {
|
|
202
|
-
const props = createMockProps({ newTag: ' ' });
|
|
203
|
-
render(<EntityTagsPage {...props} />);
|
|
204
|
-
|
|
205
|
-
const button = screen.getByRole('button');
|
|
206
|
-
expect(button).toBeDisabled();
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('enables button when newTag has value', () => {
|
|
210
|
-
const props = createMockProps({ newTag: 'NewTag' });
|
|
211
|
-
render(<EntityTagsPage {...props} />);
|
|
212
|
-
|
|
213
|
-
const button = screen.getByRole('button');
|
|
214
|
-
expect(button).not.toBeDisabled();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('shows adding text when isAddingTag is true', () => {
|
|
218
|
-
const props = createMockProps({ isAddingTag: true });
|
|
219
|
-
render(<EntityTagsPage {...props} />);
|
|
220
|
-
|
|
221
|
-
expect(screen.getByText('Adding...')).toBeInTheDocument();
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('shows add tag icon when not adding', () => {
|
|
225
|
-
const props = createMockProps();
|
|
226
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
227
|
-
|
|
228
|
-
const plusIcon = container.querySelector('.xynolog-icon--small');
|
|
229
|
-
expect(plusIcon).toBeInTheDocument();
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
describe('Error Display', () => {
|
|
234
|
-
it('shows error message when error prop is set', () => {
|
|
235
|
-
const props = createMockProps({ error: 'Failed to add tag' });
|
|
236
|
-
render(<EntityTagsPage {...props} />);
|
|
237
|
-
|
|
238
|
-
expect(screen.getByText('Failed to add tag')).toBeInTheDocument();
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('shows error icon with error message', () => {
|
|
242
|
-
const props = createMockProps({ error: 'Error occurred' });
|
|
243
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
244
|
-
|
|
245
|
-
const errorIcon = container.querySelector(
|
|
246
|
-
'.xynolog-entity-tags__error-icon',
|
|
247
|
-
);
|
|
248
|
-
expect(errorIcon).toBeInTheDocument();
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('does not show error when error is empty', () => {
|
|
252
|
-
const props = createMockProps({ error: '' });
|
|
253
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
254
|
-
|
|
255
|
-
const errorMessage = container.querySelector(
|
|
256
|
-
'.xynolog-entity-tags__error',
|
|
257
|
-
);
|
|
258
|
-
expect(errorMessage).not.toBeInTheDocument();
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('applies correct error styling', () => {
|
|
262
|
-
const props = createMockProps({ error: 'Test error' });
|
|
263
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
264
|
-
|
|
265
|
-
const errorDiv = container.querySelector('.xynolog-entity-tags__error');
|
|
266
|
-
expect(errorDiv).toBeInTheDocument();
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
describe('Toolbar Integration', () => {
|
|
271
|
-
it('renders toolbar panels', () => {
|
|
272
|
-
const props = createMockProps();
|
|
273
|
-
render(<EntityTagsPage {...props} />);
|
|
274
|
-
|
|
275
|
-
expect(screen.getByTestId('toolbar-panels')).toBeInTheDocument();
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it('renders toolbar', () => {
|
|
279
|
-
const props = createMockProps();
|
|
280
|
-
render(<EntityTagsPage {...props} />);
|
|
281
|
-
|
|
282
|
-
expect(screen.getByTestId('toolbar')).toBeInTheDocument();
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it('passes theme to toolbar panels', () => {
|
|
286
|
-
const ToolbarPanels = vi.fn(() => <div data-testid="toolbar-panels" />);
|
|
287
|
-
const props = createMockProps({ theme: 'dark', ToolbarPanels });
|
|
288
|
-
render(<EntityTagsPage {...props} />);
|
|
289
|
-
|
|
290
|
-
expect(ToolbarPanels).toHaveBeenCalledWith(
|
|
291
|
-
expect.objectContaining({ theme: 'dark' }),
|
|
292
|
-
undefined,
|
|
293
|
-
);
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('passes activePanel to toolbar', () => {
|
|
297
|
-
const Toolbar = vi.fn(() => <div data-testid="toolbar" />);
|
|
298
|
-
const props = createMockProps({ activePanel: 'settings', Toolbar });
|
|
299
|
-
render(<EntityTagsPage {...props} />);
|
|
300
|
-
|
|
301
|
-
expect(Toolbar).toHaveBeenCalledWith(
|
|
302
|
-
expect.objectContaining({ activePanel: 'settings' }),
|
|
303
|
-
undefined,
|
|
304
|
-
);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
describe('Layout and Structure', () => {
|
|
309
|
-
it('renders with correct flex layout', () => {
|
|
310
|
-
const props = createMockProps();
|
|
311
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
312
|
-
|
|
313
|
-
const mainContainer = container.querySelector('.xynolog-page');
|
|
314
|
-
expect(mainContainer).toBeInTheDocument();
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it('renders content area with overflow', () => {
|
|
318
|
-
const props = createMockProps();
|
|
319
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
320
|
-
|
|
321
|
-
const scrollArea = container.querySelector('.xynolog-page__content');
|
|
322
|
-
expect(scrollArea).toBeInTheDocument();
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
it('applies correct padding to content', () => {
|
|
326
|
-
const props = createMockProps();
|
|
327
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
328
|
-
|
|
329
|
-
const contentArea = container.querySelector('.xynolog-page__content');
|
|
330
|
-
expect(contentArea).toBeInTheDocument();
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
describe('Dark Mode', () => {
|
|
335
|
-
it('renders with dark theme', () => {
|
|
336
|
-
const props = createMockProps({ theme: 'dark' });
|
|
337
|
-
render(<EntityTagsPage {...props} />);
|
|
338
|
-
|
|
339
|
-
expect(screen.getByText('Entity Tags')).toBeInTheDocument();
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it('applies dark mode classes to input', () => {
|
|
343
|
-
const props = createMockProps({ theme: 'dark' });
|
|
344
|
-
const { container } = render(<EntityTagsPage {...props} />);
|
|
345
|
-
|
|
346
|
-
const input = container.querySelector('input');
|
|
347
|
-
expect(input).toHaveClass('xynolog-entity-tags__input');
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
describe('Edge Cases', () => {
|
|
352
|
-
it('handles all props being defined', () => {
|
|
353
|
-
const props = createMockProps({
|
|
354
|
-
newTag: 'Test',
|
|
355
|
-
error: 'Error',
|
|
356
|
-
isAddingTag: true,
|
|
357
|
-
theme: 'dark',
|
|
358
|
-
activePanel: 'settings',
|
|
359
|
-
});
|
|
360
|
-
render(<EntityTagsPage {...props} />);
|
|
361
|
-
|
|
362
|
-
expect(screen.getByText('Entity Tags')).toBeInTheDocument();
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it('renders with custom translations', () => {
|
|
366
|
-
const props = createMockProps({
|
|
367
|
-
translations: {
|
|
368
|
-
pageTitle: 'Custom Title',
|
|
369
|
-
pageDescription: 'Custom Description',
|
|
370
|
-
sectionTitle: 'Custom Section',
|
|
371
|
-
sectionDescription: 'Custom Section Desc',
|
|
372
|
-
inputPlaceholder: 'Custom Placeholder',
|
|
373
|
-
addTag: 'Custom Add',
|
|
374
|
-
adding: 'Custom Adding',
|
|
375
|
-
},
|
|
376
|
-
});
|
|
377
|
-
render(<EntityTagsPage {...props} />);
|
|
378
|
-
|
|
379
|
-
expect(screen.getByText('Custom Title')).toBeInTheDocument();
|
|
380
|
-
expect(screen.getByText('Custom Description')).toBeInTheDocument();
|
|
381
|
-
expect(screen.getByText('Custom Section')).toBeInTheDocument();
|
|
382
|
-
expect(
|
|
383
|
-
screen.getByPlaceholderText('Custom Placeholder'),
|
|
384
|
-
).toBeInTheDocument();
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
});
|