@semiont/react-ui 0.2.34-build.91 → 0.2.34-build.93
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/dist/{EventBusContext-BmzEcGHZ.d.mts → EventBusContext-DMI4uwYk.d.mts} +2 -2
- package/dist/{PdfAnnotationCanvas.client-VLNA5O5M.mjs → PdfAnnotationCanvas.client-HNYRKFDS.mjs} +10 -9
- package/dist/PdfAnnotationCanvas.client-HNYRKFDS.mjs.map +1 -0
- package/dist/{ar-4ZEORRW2.mjs → ar-MDB7HC5S.mjs} +45 -49
- package/dist/ar-MDB7HC5S.mjs.map +1 -0
- package/dist/{bn-SEDE5BQJ.mjs → bn-3SAV2ZEM.mjs} +45 -49
- package/dist/bn-3SAV2ZEM.mjs.map +1 -0
- package/dist/{chunk-C63BARI7.mjs → chunk-3FIQXKQF.mjs} +31 -31
- package/dist/{chunk-D7NBW4RV.mjs → chunk-JH7BXE2P.mjs} +45 -49
- package/dist/chunk-JH7BXE2P.mjs.map +1 -0
- package/dist/{chunk-M7SZRRIE.mjs → chunk-MWQ5CNKW.mjs} +13 -13
- package/dist/chunk-MWQ5CNKW.mjs.map +1 -0
- package/dist/{chunk-ULIET3MW.mjs → chunk-YI5IX5ZA.mjs} +1 -1
- package/dist/{chunk-ULIET3MW.mjs.map → chunk-YI5IX5ZA.mjs.map} +1 -1
- package/dist/{cs-7W4WF5WD.mjs → cs-AWCETEUV.mjs} +45 -49
- package/dist/cs-AWCETEUV.mjs.map +1 -0
- package/dist/{da-75XGBCBK.mjs → da-UZZHXYLC.mjs} +45 -49
- package/dist/da-UZZHXYLC.mjs.map +1 -0
- package/dist/{de-ODJVFLHM.mjs → de-LQFWN6S5.mjs} +45 -49
- package/dist/de-LQFWN6S5.mjs.map +1 -0
- package/dist/{el-C4PM4WB3.mjs → el-IWOETBJ7.mjs} +45 -49
- package/dist/el-IWOETBJ7.mjs.map +1 -0
- package/dist/{en-KJCJQ4OO.mjs → en-XWEPVTB4.mjs} +2 -6
- package/dist/{es-WD33R7QL.mjs → es-726NTS53.mjs} +45 -49
- package/dist/es-726NTS53.mjs.map +1 -0
- package/dist/{fa-2BP6V56P.mjs → fa-BVEJZT5S.mjs} +45 -49
- package/dist/fa-BVEJZT5S.mjs.map +1 -0
- package/dist/{fi-USRRW24J.mjs → fi-JBNCGGA6.mjs} +45 -49
- package/dist/fi-JBNCGGA6.mjs.map +1 -0
- package/dist/{fr-EC5S6WVF.mjs → fr-OLH7PNGI.mjs} +45 -49
- package/dist/fr-OLH7PNGI.mjs.map +1 -0
- package/dist/{he-7TBVIKAA.mjs → he-KOJQ4HMA.mjs} +45 -49
- package/dist/he-KOJQ4HMA.mjs.map +1 -0
- package/dist/{hi-FO4VIZLA.mjs → hi-BKJFZXAY.mjs} +45 -49
- package/dist/hi-BKJFZXAY.mjs.map +1 -0
- package/dist/{id-7U7GGVWY.mjs → id-DPLHJVNP.mjs} +45 -49
- package/dist/id-DPLHJVNP.mjs.map +1 -0
- package/dist/index.css +80 -80
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +215 -201
- package/dist/index.mjs +812 -752
- package/dist/index.mjs.map +1 -1
- package/dist/{it-Y4OPL6I2.mjs → it-JXHAM7NL.mjs} +45 -49
- package/dist/it-JXHAM7NL.mjs.map +1 -0
- package/dist/{ja-PK7SQL55.mjs → ja-DQRAO3PU.mjs} +45 -49
- package/dist/ja-DQRAO3PU.mjs.map +1 -0
- package/dist/{ko-L25PXMYD.mjs → ko-6IFCOP6F.mjs} +45 -49
- package/dist/ko-6IFCOP6F.mjs.map +1 -0
- package/dist/{ms-STH777QM.mjs → ms-KF5S2TLL.mjs} +45 -49
- package/dist/ms-KF5S2TLL.mjs.map +1 -0
- package/dist/{nl-Y7LECDDR.mjs → nl-2GUUZLQM.mjs} +45 -49
- package/dist/nl-2GUUZLQM.mjs.map +1 -0
- package/dist/{no-KEKCEWU6.mjs → no-2IBCZGEF.mjs} +45 -49
- package/dist/no-2IBCZGEF.mjs.map +1 -0
- package/dist/{pl-7A7OC75O.mjs → pl-ZEUBJ7YU.mjs} +45 -49
- package/dist/pl-ZEUBJ7YU.mjs.map +1 -0
- package/dist/{pt-35HTM7RA.mjs → pt-WLAFIZWQ.mjs} +45 -49
- package/dist/pt-WLAFIZWQ.mjs.map +1 -0
- package/dist/{ro-VAWL5KQA.mjs → ro-K56IXFGU.mjs} +45 -49
- package/dist/ro-K56IXFGU.mjs.map +1 -0
- package/dist/{sv-7ZK5EQEB.mjs → sv-VFJLMJRY.mjs} +45 -49
- package/dist/sv-VFJLMJRY.mjs.map +1 -0
- package/dist/test-utils.d.mts +2 -2
- package/dist/test-utils.mjs +3 -3
- package/dist/{th-UDWZ4X34.mjs → th-RICLQ2GW.mjs} +45 -49
- package/dist/th-RICLQ2GW.mjs.map +1 -0
- package/dist/{tr-4WMPK3UX.mjs → tr-SALXWE2M.mjs} +45 -49
- package/dist/tr-SALXWE2M.mjs.map +1 -0
- package/dist/{uk-SSLASQYJ.mjs → uk-3U3T3O2E.mjs} +45 -49
- package/dist/uk-3U3T3O2E.mjs.map +1 -0
- package/dist/{vi-IF42Z5PU.mjs → vi-LIVNZXOB.mjs} +45 -49
- package/dist/vi-LIVNZXOB.mjs.map +1 -0
- package/dist/{zh-HRQTNTAI.mjs → zh-KDUAZPX3.mjs} +45 -49
- package/dist/zh-KDUAZPX3.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/AnnotateReferencesProgressWidget.tsx +113 -0
- package/src/components/CodeMirrorRenderer.tsx +9 -27
- package/src/components/Toolbar.tsx +2 -2
- package/src/components/annotation/AnnotateToolbar.tsx +9 -9
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +17 -17
- package/src/components/image-annotation/AnnotationOverlay.tsx +13 -11
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +8 -4
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +11 -9
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1 -1
- package/src/components/resource/AnnotateView.tsx +17 -12
- package/src/components/resource/BrowseView.tsx +19 -50
- package/src/components/resource/ResourceViewer.tsx +28 -24
- package/src/components/resource/__tests__/BrowseView.test.tsx +27 -27
- package/src/components/resource/panels/AssessmentEntry.tsx +1 -1
- package/src/components/resource/panels/AssessmentPanel.tsx +16 -16
- package/src/components/resource/panels/{DetectSection.css → AssistSection.css} +79 -79
- package/src/components/resource/panels/{DetectSection.tsx → AssistSection.tsx} +46 -46
- package/src/components/resource/panels/CommentEntry.tsx +1 -1
- package/src/components/resource/panels/CommentsPanel.tsx +16 -16
- package/src/components/resource/panels/HighlightEntry.tsx +1 -1
- package/src/components/resource/panels/HighlightPanel.tsx +14 -14
- package/src/components/resource/panels/ReferenceEntry.tsx +5 -5
- package/src/components/resource/panels/ReferencesPanel.tsx +90 -103
- package/src/components/resource/panels/ResourceInfoPanel.tsx +2 -2
- package/src/components/resource/panels/TagEntry.tsx +1 -1
- package/src/components/resource/panels/TaggingPanel.tsx +53 -53
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +12 -20
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +12 -12
- package/src/components/resource/panels/__tests__/{DetectSection.test.tsx → AssistSection.test.tsx} +109 -108
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +8 -8
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/{HighlightPanel.detectionProgress.test.tsx → HighlightPanel.annotationProgress.test.tsx} +56 -56
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +98 -95
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +16 -16
- package/src/components/settings/SettingsPanel.tsx +29 -1
- package/src/features/resource-compose/components/ResourceComposePage.tsx +3 -0
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +36 -26
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +26 -16
- package/src/features/resource-viewer/__tests__/{DetectionProgressDismissal.test.tsx → AnnotationProgressDismissal.test.tsx} +48 -38
- package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +59 -49
- package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +55 -33
- package/src/features/resource-viewer/__tests__/GenerationFlowIntegration.test.tsx +24 -16
- package/src/features/resource-viewer/__tests__/ResolutionFlowIntegration.test.tsx +41 -31
- package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +10 -10
- package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +196 -0
- package/src/features/resource-viewer/__tests__/{detection-progress-flow.test.tsx → annotation-progress-flow.test.tsx} +51 -28
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +56 -45
- package/src/styles/core/buttons.css +3 -3
- package/src/styles/core/forms.css +2 -2
- package/src/styles/index.css +1 -1
- package/src/styles/motivations/motivation-assessment.css +9 -9
- package/src/styles/motivations/motivation-comment.css +9 -9
- package/src/styles/motivations/motivation-highlight.css +9 -9
- package/src/styles/motivations/motivation-reference.css +9 -9
- package/src/styles/motivations/motivation-tag.css +9 -9
- package/src/styles/utilities/focus-extended.css +6 -6
- package/translations/ar.json +44 -44
- package/translations/bn.json +44 -44
- package/translations/cs.json +44 -44
- package/translations/da.json +44 -44
- package/translations/de.json +44 -44
- package/translations/el.json +44 -44
- package/translations/en.json +44 -44
- package/translations/es.json +44 -44
- package/translations/fa.json +44 -44
- package/translations/fi.json +44 -44
- package/translations/fr.json +44 -44
- package/translations/he.json +44 -44
- package/translations/hi.json +44 -44
- package/translations/id.json +44 -44
- package/translations/it.json +44 -44
- package/translations/ja.json +44 -44
- package/translations/ko.json +44 -44
- package/translations/ms.json +44 -44
- package/translations/nl.json +44 -44
- package/translations/no.json +44 -44
- package/translations/pl.json +44 -44
- package/translations/pt.json +44 -44
- package/translations/ro.json +44 -44
- package/translations/sv.json +44 -44
- package/translations/th.json +44 -44
- package/translations/tr.json +44 -44
- package/translations/uk.json +44 -44
- package/translations/vi.json +44 -44
- package/translations/zh.json +44 -44
- package/dist/PdfAnnotationCanvas.client-VLNA5O5M.mjs.map +0 -1
- package/dist/ar-4ZEORRW2.mjs.map +0 -1
- package/dist/bn-SEDE5BQJ.mjs.map +0 -1
- package/dist/chunk-D7NBW4RV.mjs.map +0 -1
- package/dist/chunk-M7SZRRIE.mjs.map +0 -1
- package/dist/cs-7W4WF5WD.mjs.map +0 -1
- package/dist/da-75XGBCBK.mjs.map +0 -1
- package/dist/de-ODJVFLHM.mjs.map +0 -1
- package/dist/el-C4PM4WB3.mjs.map +0 -1
- package/dist/es-WD33R7QL.mjs.map +0 -1
- package/dist/fa-2BP6V56P.mjs.map +0 -1
- package/dist/fi-USRRW24J.mjs.map +0 -1
- package/dist/fr-EC5S6WVF.mjs.map +0 -1
- package/dist/he-7TBVIKAA.mjs.map +0 -1
- package/dist/hi-FO4VIZLA.mjs.map +0 -1
- package/dist/id-7U7GGVWY.mjs.map +0 -1
- package/dist/it-Y4OPL6I2.mjs.map +0 -1
- package/dist/ja-PK7SQL55.mjs.map +0 -1
- package/dist/ko-L25PXMYD.mjs.map +0 -1
- package/dist/ms-STH777QM.mjs.map +0 -1
- package/dist/nl-Y7LECDDR.mjs.map +0 -1
- package/dist/no-KEKCEWU6.mjs.map +0 -1
- package/dist/pl-7A7OC75O.mjs.map +0 -1
- package/dist/pt-35HTM7RA.mjs.map +0 -1
- package/dist/ro-VAWL5KQA.mjs.map +0 -1
- package/dist/sv-7ZK5EQEB.mjs.map +0 -1
- package/dist/th-UDWZ4X34.mjs.map +0 -1
- package/dist/tr-4WMPK3UX.mjs.map +0 -1
- package/dist/uk-SSLASQYJ.mjs.map +0 -1
- package/dist/vi-IF42Z5PU.mjs.map +0 -1
- package/dist/zh-HRQTNTAI.mjs.map +0 -1
- package/src/components/DetectionProgressWidget.tsx +0 -113
- /package/dist/{chunk-C63BARI7.mjs.map → chunk-3FIQXKQF.mjs.map} +0 -0
- /package/dist/{en-KJCJQ4OO.mjs.map → en-XWEPVTB4.mjs.map} +0 -0
package/src/components/resource/panels/__tests__/{DetectSection.test.tsx → AssistSection.test.tsx}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Layer 1 Unit Test:
|
|
2
|
+
* Layer 1 Unit Test: AssistSection Component
|
|
3
3
|
*
|
|
4
|
-
* Tests the
|
|
4
|
+
* Tests the AssistSection component in isolation with mocked dependencies.
|
|
5
5
|
*
|
|
6
6
|
* This test verifies:
|
|
7
|
-
* - Detection progress rendering when
|
|
7
|
+
* - Detection progress rendering when progress prop is provided
|
|
8
8
|
* - Progress message display
|
|
9
9
|
* - Request parameters display
|
|
10
10
|
* - Form visibility toggling based on progress state
|
|
@@ -16,16 +16,16 @@ import React from 'react';
|
|
|
16
16
|
import { screen } from '@testing-library/react';
|
|
17
17
|
import { renderWithProviders } from '../../../../test-utils';
|
|
18
18
|
import userEvent from '@testing-library/user-event';
|
|
19
|
-
import {
|
|
19
|
+
import { AssistSection } from '../AssistSection';
|
|
20
20
|
import { resetEventBusForTesting } from '../../../../contexts/EventBusContext';
|
|
21
21
|
import type { EventBus } from "@semiont/core"
|
|
22
22
|
|
|
23
23
|
// Mock translations
|
|
24
24
|
const mockT = vi.fn((key: string) => {
|
|
25
25
|
const translations: Record<string, string> = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
annotateHighlights: 'Annotate Highlights',
|
|
27
|
+
annotateAssessments: 'Annotate Assessments',
|
|
28
|
+
annotateComments: 'Annotate Comments',
|
|
29
29
|
instructions: 'Instructions',
|
|
30
30
|
optional: '(optional)',
|
|
31
31
|
instructionsPlaceholder: 'Enter custom instructions...',
|
|
@@ -42,7 +42,8 @@ const mockT = vi.fn((key: string) => {
|
|
|
42
42
|
densityLabel: 'Density',
|
|
43
43
|
densitySparse: 'Sparse',
|
|
44
44
|
densityDense: 'Dense',
|
|
45
|
-
|
|
45
|
+
annotate: 'Annotate',
|
|
46
|
+
annotating: 'Annotating...',
|
|
46
47
|
};
|
|
47
48
|
return translations[key] || key;
|
|
48
49
|
});
|
|
@@ -52,7 +53,7 @@ vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
|
52
53
|
TranslationProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
53
54
|
}));
|
|
54
55
|
|
|
55
|
-
describe('
|
|
56
|
+
describe('AssistSection', () => {
|
|
56
57
|
beforeEach(() => {
|
|
57
58
|
vi.clearAllMocks();
|
|
58
59
|
resetEventBusForTesting();
|
|
@@ -63,12 +64,12 @@ describe('DetectSection', () => {
|
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
describe('Progress Display', () => {
|
|
66
|
-
it('should render progress message when
|
|
67
|
+
it('should render progress message when progress prop provided', () => {
|
|
67
68
|
renderWithProviders(
|
|
68
|
-
<
|
|
69
|
+
<AssistSection
|
|
69
70
|
annotationType="highlight"
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
isAssisting={true}
|
|
72
|
+
progress={{
|
|
72
73
|
status: 'analyzing',
|
|
73
74
|
percentage: 30,
|
|
74
75
|
message: 'Analyzing text for highlights...',
|
|
@@ -81,10 +82,10 @@ describe('DetectSection', () => {
|
|
|
81
82
|
|
|
82
83
|
it('should render progress message with sparkle icon', () => {
|
|
83
84
|
renderWithProviders(
|
|
84
|
-
<
|
|
85
|
+
<AssistSection
|
|
85
86
|
annotationType="highlight"
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
isAssisting={true}
|
|
88
|
+
progress={{
|
|
88
89
|
status: 'analyzing',
|
|
89
90
|
message: 'Processing...',
|
|
90
91
|
}}
|
|
@@ -92,17 +93,17 @@ describe('DetectSection', () => {
|
|
|
92
93
|
);
|
|
93
94
|
|
|
94
95
|
// Check for icon and message
|
|
95
|
-
const progressDiv = screen.getByText('Processing...').closest('.semiont-
|
|
96
|
+
const progressDiv = screen.getByText('Processing...').closest('.semiont-annotation-progress__message');
|
|
96
97
|
expect(progressDiv).toBeInTheDocument();
|
|
97
|
-
expect(progressDiv?.querySelector('.semiont-
|
|
98
|
+
expect(progressDiv?.querySelector('.semiont-annotation-progress__icon')).toBeInTheDocument();
|
|
98
99
|
});
|
|
99
100
|
|
|
100
101
|
it('should render request parameters when provided', () => {
|
|
101
102
|
renderWithProviders(
|
|
102
|
-
<
|
|
103
|
+
<AssistSection
|
|
103
104
|
annotationType="highlight"
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
isAssisting={true}
|
|
106
|
+
progress={{
|
|
106
107
|
status: 'analyzing',
|
|
107
108
|
message: 'Analyzing...',
|
|
108
109
|
requestParams: [
|
|
@@ -120,12 +121,12 @@ describe('DetectSection', () => {
|
|
|
120
121
|
expect(screen.getByText(/Density:/)).toBeInTheDocument();
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
it('should hide form when
|
|
124
|
+
it('should hide form when progress is present', () => {
|
|
124
125
|
renderWithProviders(
|
|
125
|
-
<
|
|
126
|
+
<AssistSection
|
|
126
127
|
annotationType="highlight"
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
isAssisting={true}
|
|
129
|
+
progress={{
|
|
129
130
|
status: 'analyzing',
|
|
130
131
|
message: 'Analyzing...',
|
|
131
132
|
}}
|
|
@@ -134,43 +135,43 @@ describe('DetectSection', () => {
|
|
|
134
135
|
|
|
135
136
|
// Form should not be visible
|
|
136
137
|
expect(screen.queryByPlaceholderText('Enter custom instructions...')).not.toBeInTheDocument();
|
|
137
|
-
expect(screen.queryByRole('button', { name: /✨
|
|
138
|
+
expect(screen.queryByRole('button', { name: /✨ Annotate/ })).not.toBeInTheDocument();
|
|
138
139
|
});
|
|
139
140
|
|
|
140
|
-
it('should show form when
|
|
141
|
+
it('should show form when progress is null', () => {
|
|
141
142
|
renderWithProviders(
|
|
142
|
-
<
|
|
143
|
+
<AssistSection
|
|
143
144
|
annotationType="highlight"
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
isAssisting={false}
|
|
146
|
+
progress={null}
|
|
146
147
|
/>
|
|
147
148
|
);
|
|
148
149
|
|
|
149
150
|
// Form should be visible
|
|
150
151
|
expect(screen.getByPlaceholderText('Enter custom instructions...')).toBeInTheDocument();
|
|
151
|
-
expect(screen.getByRole('button', { name: /✨
|
|
152
|
+
expect(screen.getByRole('button', { name: /✨ Annotate/ })).toBeInTheDocument();
|
|
152
153
|
});
|
|
153
154
|
|
|
154
|
-
it('should show form when
|
|
155
|
+
it('should show form when progress is undefined', () => {
|
|
155
156
|
renderWithProviders(
|
|
156
|
-
<
|
|
157
|
+
<AssistSection
|
|
157
158
|
annotationType="highlight"
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
isAssisting={false}
|
|
160
|
+
progress={undefined}
|
|
160
161
|
/>
|
|
161
162
|
);
|
|
162
163
|
|
|
163
164
|
// Form should be visible
|
|
164
165
|
expect(screen.getByPlaceholderText('Enter custom instructions...')).toBeInTheDocument();
|
|
165
|
-
expect(screen.getByRole('button', { name: /✨
|
|
166
|
+
expect(screen.getByRole('button', { name: /✨ Annotate/ })).toBeInTheDocument();
|
|
166
167
|
});
|
|
167
168
|
|
|
168
|
-
it('should keep progress visible after detection completes (
|
|
169
|
+
it('should keep progress visible after detection completes (isAssisting=false but progress exists)', () => {
|
|
169
170
|
renderWithProviders(
|
|
170
|
-
<
|
|
171
|
+
<AssistSection
|
|
171
172
|
annotationType="highlight"
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
isAssisting={false}
|
|
174
|
+
progress={{
|
|
174
175
|
status: 'complete',
|
|
175
176
|
percentage: 100,
|
|
176
177
|
message: 'Complete! Created 14 highlights',
|
|
@@ -188,46 +189,46 @@ describe('DetectSection', () => {
|
|
|
188
189
|
describe('Annotation Type Variations', () => {
|
|
189
190
|
it('should render for highlight type', () => {
|
|
190
191
|
renderWithProviders(
|
|
191
|
-
<
|
|
192
|
+
<AssistSection
|
|
192
193
|
annotationType="highlight"
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
isAssisting={false}
|
|
195
|
+
progress={null}
|
|
195
196
|
/>
|
|
196
197
|
);
|
|
197
198
|
|
|
198
|
-
expect(screen.getByText('
|
|
199
|
+
expect(screen.getByText('Annotate Highlights')).toBeInTheDocument();
|
|
199
200
|
});
|
|
200
201
|
|
|
201
202
|
it('should render for assessment type', () => {
|
|
202
203
|
renderWithProviders(
|
|
203
|
-
<
|
|
204
|
+
<AssistSection
|
|
204
205
|
annotationType="assessment"
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
isAssisting={false}
|
|
207
|
+
progress={null}
|
|
207
208
|
/>
|
|
208
209
|
);
|
|
209
210
|
|
|
210
|
-
expect(screen.getByText('
|
|
211
|
+
expect(screen.getByText('Annotate Assessments')).toBeInTheDocument();
|
|
211
212
|
});
|
|
212
213
|
|
|
213
214
|
it('should render for comment type', () => {
|
|
214
215
|
renderWithProviders(
|
|
215
|
-
<
|
|
216
|
+
<AssistSection
|
|
216
217
|
annotationType="comment"
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
isAssisting={false}
|
|
219
|
+
progress={null}
|
|
219
220
|
/>
|
|
220
221
|
);
|
|
221
222
|
|
|
222
|
-
expect(screen.getByText('
|
|
223
|
+
expect(screen.getByText('Annotate Comments')).toBeInTheDocument();
|
|
223
224
|
});
|
|
224
225
|
|
|
225
226
|
it('should show tone selector for comments', () => {
|
|
226
227
|
renderWithProviders(
|
|
227
|
-
<
|
|
228
|
+
<AssistSection
|
|
228
229
|
annotationType="comment"
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
isAssisting={false}
|
|
231
|
+
progress={null}
|
|
231
232
|
/>
|
|
232
233
|
);
|
|
233
234
|
|
|
@@ -237,10 +238,10 @@ describe('DetectSection', () => {
|
|
|
237
238
|
|
|
238
239
|
it('should show tone selector for assessments', () => {
|
|
239
240
|
renderWithProviders(
|
|
240
|
-
<
|
|
241
|
+
<AssistSection
|
|
241
242
|
annotationType="assessment"
|
|
242
|
-
|
|
243
|
-
|
|
243
|
+
isAssisting={false}
|
|
244
|
+
progress={null}
|
|
244
245
|
/>
|
|
245
246
|
);
|
|
246
247
|
|
|
@@ -250,10 +251,10 @@ describe('DetectSection', () => {
|
|
|
250
251
|
|
|
251
252
|
it('should not show tone selector for highlights', () => {
|
|
252
253
|
renderWithProviders(
|
|
253
|
-
<
|
|
254
|
+
<AssistSection
|
|
254
255
|
annotationType="highlight"
|
|
255
|
-
|
|
256
|
-
|
|
256
|
+
isAssisting={false}
|
|
257
|
+
progress={null}
|
|
257
258
|
/>
|
|
258
259
|
);
|
|
259
260
|
|
|
@@ -263,23 +264,23 @@ describe('DetectSection', () => {
|
|
|
263
264
|
});
|
|
264
265
|
|
|
265
266
|
describe('Event Emission', () => {
|
|
266
|
-
it('should emit
|
|
267
|
+
it('should emit annotate:detect-request event when detect button clicked', async () => {
|
|
267
268
|
const user = userEvent.setup();
|
|
268
269
|
const detectionHandler = vi.fn();
|
|
269
270
|
|
|
270
271
|
const { eventBus } = renderWithProviders(
|
|
271
|
-
<
|
|
272
|
+
<AssistSection
|
|
272
273
|
annotationType="highlight"
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
isAssisting={false}
|
|
275
|
+
progress={null}
|
|
275
276
|
/>,
|
|
276
277
|
{ returnEventBus: true }
|
|
277
278
|
);
|
|
278
279
|
|
|
279
|
-
const subscription = eventBus!.get('
|
|
280
|
+
const subscription = eventBus!.get('annotate:assist-request').subscribe(detectionHandler);
|
|
280
281
|
|
|
281
|
-
const
|
|
282
|
-
await user.click(
|
|
282
|
+
const annotateButton = screen.getByRole('button', { name: /✨ Annotate/ });
|
|
283
|
+
await user.click(annotateButton);
|
|
283
284
|
|
|
284
285
|
expect(detectionHandler).toHaveBeenCalledWith({
|
|
285
286
|
motivation: 'highlighting',
|
|
@@ -294,18 +295,18 @@ describe('DetectSection', () => {
|
|
|
294
295
|
const detectionHandler = vi.fn();
|
|
295
296
|
|
|
296
297
|
const { eventBus } = renderWithProviders(
|
|
297
|
-
<
|
|
298
|
+
<AssistSection
|
|
298
299
|
annotationType="assessment"
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
isAssisting={false}
|
|
301
|
+
progress={null}
|
|
301
302
|
/>,
|
|
302
303
|
{ returnEventBus: true }
|
|
303
304
|
);
|
|
304
305
|
|
|
305
|
-
const subscription = eventBus!.get('
|
|
306
|
+
const subscription = eventBus!.get('annotate:assist-request').subscribe(detectionHandler);
|
|
306
307
|
|
|
307
|
-
const
|
|
308
|
-
await user.click(
|
|
308
|
+
const annotateButton = screen.getByRole('button', { name: /✨ Annotate/ });
|
|
309
|
+
await user.click(annotateButton);
|
|
309
310
|
|
|
310
311
|
expect(detectionHandler).toHaveBeenCalledWith({
|
|
311
312
|
motivation: 'assessing',
|
|
@@ -320,18 +321,18 @@ describe('DetectSection', () => {
|
|
|
320
321
|
const detectionHandler = vi.fn();
|
|
321
322
|
|
|
322
323
|
const { eventBus } = renderWithProviders(
|
|
323
|
-
<
|
|
324
|
+
<AssistSection
|
|
324
325
|
annotationType="comment"
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
isAssisting={false}
|
|
327
|
+
progress={null}
|
|
327
328
|
/>,
|
|
328
329
|
{ returnEventBus: true }
|
|
329
330
|
);
|
|
330
331
|
|
|
331
|
-
const subscription = eventBus!.get('
|
|
332
|
+
const subscription = eventBus!.get('annotate:assist-request').subscribe(detectionHandler);
|
|
332
333
|
|
|
333
|
-
const
|
|
334
|
-
await user.click(
|
|
334
|
+
const annotateButton = screen.getByRole('button', { name: /✨ Annotate/ });
|
|
335
|
+
await user.click(annotateButton);
|
|
335
336
|
|
|
336
337
|
expect(detectionHandler).toHaveBeenCalledWith({
|
|
337
338
|
motivation: 'commenting',
|
|
@@ -346,21 +347,21 @@ describe('DetectSection', () => {
|
|
|
346
347
|
const detectionHandler = vi.fn();
|
|
347
348
|
|
|
348
349
|
const { eventBus } = renderWithProviders(
|
|
349
|
-
<
|
|
350
|
+
<AssistSection
|
|
350
351
|
annotationType="highlight"
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
isAssisting={false}
|
|
353
|
+
progress={null}
|
|
353
354
|
/>,
|
|
354
355
|
{ returnEventBus: true }
|
|
355
356
|
);
|
|
356
357
|
|
|
357
|
-
const subscription = eventBus!.get('
|
|
358
|
+
const subscription = eventBus!.get('annotate:assist-request').subscribe(detectionHandler);
|
|
358
359
|
|
|
359
360
|
const textarea = screen.getByPlaceholderText('Enter custom instructions...');
|
|
360
361
|
await user.type(textarea, 'Find key concepts');
|
|
361
362
|
|
|
362
|
-
const
|
|
363
|
-
await user.click(
|
|
363
|
+
const annotateButton = screen.getByRole('button', { name: /✨ Annotate/ });
|
|
364
|
+
await user.click(annotateButton);
|
|
364
365
|
|
|
365
366
|
expect(detectionHandler).toHaveBeenCalledWith({
|
|
366
367
|
motivation: 'highlighting',
|
|
@@ -377,14 +378,14 @@ describe('DetectSection', () => {
|
|
|
377
378
|
describe('Collapsible Behavior', () => {
|
|
378
379
|
it('should be expanded by default', () => {
|
|
379
380
|
renderWithProviders(
|
|
380
|
-
<
|
|
381
|
+
<AssistSection
|
|
381
382
|
annotationType="highlight"
|
|
382
|
-
|
|
383
|
-
|
|
383
|
+
isAssisting={false}
|
|
384
|
+
progress={null}
|
|
384
385
|
/>
|
|
385
386
|
);
|
|
386
387
|
|
|
387
|
-
const collapseButton = screen.getByRole('button', { name: /
|
|
388
|
+
const collapseButton = screen.getByRole('button', { name: /Annotate Highlights/ });
|
|
388
389
|
expect(collapseButton).toHaveAttribute('aria-expanded', 'true');
|
|
389
390
|
expect(screen.getByPlaceholderText('Enter custom instructions...')).toBeInTheDocument();
|
|
390
391
|
});
|
|
@@ -393,14 +394,14 @@ describe('DetectSection', () => {
|
|
|
393
394
|
const user = userEvent.setup();
|
|
394
395
|
|
|
395
396
|
renderWithProviders(
|
|
396
|
-
<
|
|
397
|
+
<AssistSection
|
|
397
398
|
annotationType="highlight"
|
|
398
|
-
|
|
399
|
-
|
|
399
|
+
isAssisting={false}
|
|
400
|
+
progress={null}
|
|
400
401
|
/>
|
|
401
402
|
);
|
|
402
403
|
|
|
403
|
-
const collapseButton = screen.getByRole('button', { name: /
|
|
404
|
+
const collapseButton = screen.getByRole('button', { name: /Annotate Highlights/ });
|
|
404
405
|
await user.click(collapseButton);
|
|
405
406
|
|
|
406
407
|
expect(collapseButton).toHaveAttribute('aria-expanded', 'false');
|
|
@@ -411,14 +412,14 @@ describe('DetectSection', () => {
|
|
|
411
412
|
const user = userEvent.setup();
|
|
412
413
|
|
|
413
414
|
renderWithProviders(
|
|
414
|
-
<
|
|
415
|
+
<AssistSection
|
|
415
416
|
annotationType="highlight"
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
isAssisting={false}
|
|
418
|
+
progress={null}
|
|
418
419
|
/>
|
|
419
420
|
);
|
|
420
421
|
|
|
421
|
-
const collapseButton = screen.getByRole('button', { name: /
|
|
422
|
+
const collapseButton = screen.getByRole('button', { name: /Annotate Highlights/ });
|
|
422
423
|
await user.click(collapseButton); // Collapse
|
|
423
424
|
await user.click(collapseButton); // Expand
|
|
424
425
|
|
|
@@ -430,10 +431,10 @@ describe('DetectSection', () => {
|
|
|
430
431
|
describe('Edge Cases', () => {
|
|
431
432
|
it('should handle empty progress message', () => {
|
|
432
433
|
renderWithProviders(
|
|
433
|
-
<
|
|
434
|
+
<AssistSection
|
|
434
435
|
annotationType="highlight"
|
|
435
|
-
|
|
436
|
-
|
|
436
|
+
isAssisting={true}
|
|
437
|
+
progress={{
|
|
437
438
|
status: 'analyzing',
|
|
438
439
|
message: '',
|
|
439
440
|
}}
|
|
@@ -441,16 +442,16 @@ describe('DetectSection', () => {
|
|
|
441
442
|
);
|
|
442
443
|
|
|
443
444
|
// Should render progress section even with empty message
|
|
444
|
-
const progressDiv = document.querySelector('.semiont-
|
|
445
|
+
const progressDiv = document.querySelector('.semiont-annotation-progress');
|
|
445
446
|
expect(progressDiv).toBeInTheDocument();
|
|
446
447
|
});
|
|
447
448
|
|
|
448
449
|
it('should handle progress without percentage', () => {
|
|
449
450
|
renderWithProviders(
|
|
450
|
-
<
|
|
451
|
+
<AssistSection
|
|
451
452
|
annotationType="highlight"
|
|
452
|
-
|
|
453
|
-
|
|
453
|
+
isAssisting={true}
|
|
454
|
+
progress={{
|
|
454
455
|
status: 'analyzing',
|
|
455
456
|
message: 'Processing...',
|
|
456
457
|
// no percentage
|
|
@@ -463,10 +464,10 @@ describe('DetectSection', () => {
|
|
|
463
464
|
|
|
464
465
|
it('should handle progress with empty requestParams array', () => {
|
|
465
466
|
renderWithProviders(
|
|
466
|
-
<
|
|
467
|
+
<AssistSection
|
|
467
468
|
annotationType="highlight"
|
|
468
|
-
|
|
469
|
-
|
|
469
|
+
isAssisting={true}
|
|
470
|
+
progress={{
|
|
470
471
|
status: 'analyzing',
|
|
471
472
|
message: 'Processing...',
|
|
472
473
|
requestParams: [],
|
|
@@ -241,7 +241,7 @@ describe('CommentEntry Component', () => {
|
|
|
241
241
|
});
|
|
242
242
|
|
|
243
243
|
describe('Click Interactions', () => {
|
|
244
|
-
it('should emit
|
|
244
|
+
it('should emit attend:click event when comment is clicked', async () => {
|
|
245
245
|
const clickHandler = vi.fn();
|
|
246
246
|
|
|
247
247
|
const { container, eventBus } = renderWithProviders(
|
|
@@ -250,7 +250,7 @@ describe('CommentEntry Component', () => {
|
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
// Subscribe to actual event on real event bus
|
|
253
|
-
const subscription = eventBus!.get('
|
|
253
|
+
const subscription = eventBus!.get('attend:click').subscribe(clickHandler);
|
|
254
254
|
|
|
255
255
|
const commentDiv = container.firstChild as HTMLElement;
|
|
256
256
|
await userEvent.click(commentDiv);
|
|
@@ -273,7 +273,7 @@ describe('CommentEntry Component', () => {
|
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
describe('Hover Interactions', () => {
|
|
276
|
-
it('should emit
|
|
276
|
+
it('should emit attend:hover event with annotation id after dwell delay', () => {
|
|
277
277
|
vi.useFakeTimers();
|
|
278
278
|
const hoverHandler = vi.fn();
|
|
279
279
|
|
|
@@ -283,7 +283,7 @@ describe('CommentEntry Component', () => {
|
|
|
283
283
|
);
|
|
284
284
|
|
|
285
285
|
// Subscribe to actual event
|
|
286
|
-
const subscription = eventBus!.get('
|
|
286
|
+
const subscription = eventBus!.get('attend:hover').subscribe(hoverHandler);
|
|
287
287
|
|
|
288
288
|
const commentDiv = container.firstChild as HTMLElement;
|
|
289
289
|
fireEvent.mouseEnter(commentDiv);
|
|
@@ -301,7 +301,7 @@ describe('CommentEntry Component', () => {
|
|
|
301
301
|
vi.useRealTimers();
|
|
302
302
|
});
|
|
303
303
|
|
|
304
|
-
it('should NOT emit
|
|
304
|
+
it('should NOT emit attend:hover when mouse leaves before dwell delay', () => {
|
|
305
305
|
vi.useFakeTimers();
|
|
306
306
|
const hoverHandler = vi.fn();
|
|
307
307
|
|
|
@@ -311,7 +311,7 @@ describe('CommentEntry Component', () => {
|
|
|
311
311
|
);
|
|
312
312
|
|
|
313
313
|
// Subscribe to actual event
|
|
314
|
-
const subscription = eventBus!.get('
|
|
314
|
+
const subscription = eventBus!.get('attend:hover').subscribe(hoverHandler);
|
|
315
315
|
|
|
316
316
|
const commentDiv = container.firstChild as HTMLElement;
|
|
317
317
|
fireEvent.mouseEnter(commentDiv);
|
|
@@ -327,7 +327,7 @@ describe('CommentEntry Component', () => {
|
|
|
327
327
|
vi.useRealTimers();
|
|
328
328
|
});
|
|
329
329
|
|
|
330
|
-
it('should emit
|
|
330
|
+
it('should emit attend:hover null after dwell then leave', () => {
|
|
331
331
|
vi.useFakeTimers();
|
|
332
332
|
const hoverHandler = vi.fn();
|
|
333
333
|
|
|
@@ -336,7 +336,7 @@ describe('CommentEntry Component', () => {
|
|
|
336
336
|
{ returnEventBus: true }
|
|
337
337
|
);
|
|
338
338
|
|
|
339
|
-
const subscription = eventBus!.get('
|
|
339
|
+
const subscription = eventBus!.get('attend:hover').subscribe(hoverHandler);
|
|
340
340
|
|
|
341
341
|
const commentDiv = container.firstChild as HTMLElement;
|
|
342
342
|
fireEvent.mouseEnter(commentDiv);
|
|
@@ -29,7 +29,7 @@ function createEventTracker() {
|
|
|
29
29
|
events.push({ event: eventName, payload });
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const panelEvents = ['
|
|
32
|
+
const panelEvents = ['annotate:create'] as const;
|
|
33
33
|
|
|
34
34
|
panelEvents.forEach(eventName => {
|
|
35
35
|
const handler = trackEvent(eventName);
|
|
@@ -396,7 +396,7 @@ describe('CommentsPanel Component', () => {
|
|
|
396
396
|
expect(textarea).toHaveFocus();
|
|
397
397
|
});
|
|
398
398
|
|
|
399
|
-
it('should emit
|
|
399
|
+
it('should emit annotate:createevent when save is clicked', async () => {
|
|
400
400
|
const tracker = createEventTracker();
|
|
401
401
|
const pendingAnnotation = createPendingAnnotation('Selected text');
|
|
402
402
|
|
|
@@ -416,7 +416,7 @@ describe('CommentsPanel Component', () => {
|
|
|
416
416
|
|
|
417
417
|
await waitFor(() => {
|
|
418
418
|
expect(tracker.events.some(e =>
|
|
419
|
-
e.event === '
|
|
419
|
+
e.event === 'annotate:create' &&
|
|
420
420
|
e.payload?.motivation === 'commenting' &&
|
|
421
421
|
e.payload?.body?.[0]?.value === 'My new comment'
|
|
422
422
|
)).toBe(true);
|