@semiont/react-ui 0.5.11 → 0.5.12
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/{PdfAnnotationCanvas.client-KWQ7XDWT.js → PdfAnnotationCanvas.client-75GY2EDR.js} +12 -6
- package/dist/PdfAnnotationCanvas.client-75GY2EDR.js.map +1 -0
- package/dist/{chunk-O2MD7TGE.js → chunk-VXASXU4K.js} +10 -2
- package/dist/chunk-VXASXU4K.js.map +1 -0
- package/dist/index.d.ts +54 -16
- package/dist/index.js +395 -343
- package/dist/index.js.map +1 -1
- package/dist/test-utils.d.ts +5 -1
- package/dist/test-utils.js +3 -2
- package/dist/test-utils.js.map +1 -1
- package/package.json +5 -5
- package/src/components/image-annotation/AnnotationOverlay.tsx +6 -6
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +12 -4
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +137 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +108 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +12 -4
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +137 -1
- package/src/components/resource/BrowseView.tsx +14 -6
- package/src/components/resource/ResourceViewer.tsx +6 -4
- package/src/components/resource/__tests__/BrowseView.test.tsx +98 -31
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +40 -1
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +113 -0
- package/src/components/resource/browse-renderers.tsx +26 -4
- package/src/components/resource/panels/AssessmentEntry.tsx +5 -4
- package/src/components/resource/panels/AssessmentPanel.tsx +8 -5
- package/src/components/resource/panels/AssistSection.tsx +4 -3
- package/src/components/resource/panels/CommentEntry.tsx +5 -4
- package/src/components/resource/panels/CommentsPanel.tsx +8 -5
- package/src/components/resource/panels/HighlightEntry.tsx +5 -4
- package/src/components/resource/panels/HighlightPanel.tsx +8 -5
- package/src/components/resource/panels/ReferenceEntry.tsx +9 -10
- package/src/components/resource/panels/ReferencesPanel.tsx +11 -6
- package/src/components/resource/panels/ResourceInfoPanel.tsx +4 -3
- package/src/components/resource/panels/TagEntry.tsx +5 -3
- package/src/components/resource/panels/TaggingPanel.tsx +7 -4
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +10 -0
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +28 -20
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +38 -28
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +46 -17
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +65 -57
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +53 -24
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +27 -17
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +23 -17
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +48 -77
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +87 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +15 -9
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +77 -59
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +11 -4
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +33 -19
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +15 -7
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +3 -0
- package/dist/PdfAnnotationCanvas.client-KWQ7XDWT.js.map +0 -1
- package/dist/chunk-O2MD7TGE.js.map +0 -1
|
@@ -6,6 +6,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
6
6
|
import '@testing-library/jest-dom';
|
|
7
7
|
import { AssessmentPanel } from '../AssessmentPanel';
|
|
8
8
|
import type { EventBus } from '@semiont/core';
|
|
9
|
+
import type { SemiontSession } from '@semiont/sdk';
|
|
9
10
|
import { createTestSemiontWrapper } from '../../../../test-utils';
|
|
10
11
|
|
|
11
12
|
import type { Annotation, AnnotationId } from '@semiont/core';
|
|
@@ -32,8 +33,15 @@ function createEventTracker() {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
// Per-test session/bus/wrapper — created in beforeEach (a module-scope
|
|
37
|
+
// factory call would hand tests a client that test-utils disposes after
|
|
38
|
+
// the first test). The `session` passed as a prop below and the `eventBus`
|
|
39
|
+
// the tracker subscribes come from the SAME factory call.
|
|
40
|
+
let session: SemiontSession;
|
|
41
|
+
let eventBus: EventBus;
|
|
42
|
+
let SemiontWrapper: React.ComponentType<{ children: React.ReactNode }>;
|
|
43
|
+
|
|
35
44
|
const renderWithEventBus = (component: React.ReactElement, tracker?: ReturnType<typeof createEventTracker>) => {
|
|
36
|
-
const { SemiontWrapper, eventBus } = createTestSemiontWrapper();
|
|
37
45
|
if (tracker) tracker._attach(eventBus);
|
|
38
46
|
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
39
47
|
<SemiontWrapper>{children}</SemiontWrapper>
|
|
@@ -148,6 +156,8 @@ describe('AssessmentPanel Component', () => {
|
|
|
148
156
|
beforeEach(() => {
|
|
149
157
|
vi.clearAllMocks();
|
|
150
158
|
|
|
159
|
+
({ session, eventBus, SemiontWrapper } = createTestSemiontWrapper());
|
|
160
|
+
|
|
151
161
|
// Mock scrollIntoView for jsdom
|
|
152
162
|
Element.prototype.scrollIntoView = vi.fn();
|
|
153
163
|
|
|
@@ -167,20 +177,20 @@ describe('AssessmentPanel Component', () => {
|
|
|
167
177
|
|
|
168
178
|
describe('Rendering', () => {
|
|
169
179
|
it('should render panel header with title and count', () => {
|
|
170
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} annotations={mockAssessments.multiple} />);
|
|
180
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} annotations={mockAssessments.multiple} />);
|
|
171
181
|
|
|
172
182
|
expect(screen.getByText(/Assessments/)).toBeInTheDocument();
|
|
173
183
|
expect(screen.getByText(/\(3\)/)).toBeInTheDocument();
|
|
174
184
|
});
|
|
175
185
|
|
|
176
186
|
it('should show empty state when no assessments', () => {
|
|
177
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} />);
|
|
187
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} />);
|
|
178
188
|
|
|
179
189
|
expect(screen.getByText(/No assessments yet/)).toBeInTheDocument();
|
|
180
190
|
});
|
|
181
191
|
|
|
182
192
|
it('should render all assessments', () => {
|
|
183
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} annotations={mockAssessments.multiple} />);
|
|
193
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} annotations={mockAssessments.multiple} />);
|
|
184
194
|
|
|
185
195
|
expect(screen.getByTestId('assessment-1')).toBeInTheDocument();
|
|
186
196
|
expect(screen.getByTestId('assessment-2')).toBeInTheDocument();
|
|
@@ -188,7 +198,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
188
198
|
});
|
|
189
199
|
|
|
190
200
|
it('should have proper panel structure', () => {
|
|
191
|
-
const { container } = renderWithEventBus(<AssessmentPanel {...defaultProps} />);
|
|
201
|
+
const { container } = renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} />);
|
|
192
202
|
|
|
193
203
|
const panel = container.firstChild as HTMLElement;
|
|
194
204
|
expect(panel).toHaveClass('semiont-panel');
|
|
@@ -197,7 +207,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
197
207
|
|
|
198
208
|
describe('Assessment Sorting', () => {
|
|
199
209
|
it('should sort assessments by position in resource', () => {
|
|
200
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} annotations={mockAssessments.multiple} />);
|
|
210
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} annotations={mockAssessments.multiple} />);
|
|
201
211
|
|
|
202
212
|
const assessments = screen.getAllByTestId(/assessment-/);
|
|
203
213
|
|
|
@@ -211,14 +221,14 @@ describe('AssessmentPanel Component', () => {
|
|
|
211
221
|
mockGetTextPositionSelector.mockReturnValue(null);
|
|
212
222
|
|
|
213
223
|
expect(() => {
|
|
214
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} annotations={mockAssessments.multiple} />);
|
|
224
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} annotations={mockAssessments.multiple} />);
|
|
215
225
|
}).not.toThrow();
|
|
216
226
|
});
|
|
217
227
|
});
|
|
218
228
|
|
|
219
229
|
describe('New Assessment Creation', () => {
|
|
220
230
|
it('should not show new assessment input by default', () => {
|
|
221
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} />);
|
|
231
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} />);
|
|
222
232
|
|
|
223
233
|
expect(screen.queryByPlaceholderText(/Type your assessment here/)).not.toBeInTheDocument();
|
|
224
234
|
});
|
|
@@ -228,7 +238,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
228
238
|
|
|
229
239
|
renderWithEventBus(
|
|
230
240
|
<AssessmentPanel
|
|
231
|
-
{...defaultProps}
|
|
241
|
+
{...defaultProps} session={session}
|
|
232
242
|
pendingAnnotation={pendingAnnotation}
|
|
233
243
|
/>
|
|
234
244
|
);
|
|
@@ -241,7 +251,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
241
251
|
|
|
242
252
|
renderWithEventBus(
|
|
243
253
|
<AssessmentPanel
|
|
244
|
-
{...defaultProps}
|
|
254
|
+
{...defaultProps} session={session}
|
|
245
255
|
pendingAnnotation={pendingAnnotation}
|
|
246
256
|
/>
|
|
247
257
|
);
|
|
@@ -255,7 +265,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
255
265
|
|
|
256
266
|
renderWithEventBus(
|
|
257
267
|
<AssessmentPanel
|
|
258
|
-
{...defaultProps}
|
|
268
|
+
{...defaultProps} session={session}
|
|
259
269
|
pendingAnnotation={pendingAnnotation}
|
|
260
270
|
/>
|
|
261
271
|
);
|
|
@@ -269,7 +279,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
269
279
|
|
|
270
280
|
renderWithEventBus(
|
|
271
281
|
<AssessmentPanel
|
|
272
|
-
{...defaultProps}
|
|
282
|
+
{...defaultProps} session={session}
|
|
273
283
|
pendingAnnotation={pendingAnnotation}
|
|
274
284
|
/>
|
|
275
285
|
);
|
|
@@ -285,7 +295,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
285
295
|
|
|
286
296
|
renderWithEventBus(
|
|
287
297
|
<AssessmentPanel
|
|
288
|
-
{...defaultProps}
|
|
298
|
+
{...defaultProps} session={session}
|
|
289
299
|
pendingAnnotation={pendingAnnotation}
|
|
290
300
|
/>
|
|
291
301
|
);
|
|
@@ -303,7 +313,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
303
313
|
|
|
304
314
|
renderWithEventBus(
|
|
305
315
|
<AssessmentPanel
|
|
306
|
-
{...defaultProps}
|
|
316
|
+
{...defaultProps} session={session}
|
|
307
317
|
pendingAnnotation={pendingAnnotation}
|
|
308
318
|
/>
|
|
309
319
|
);
|
|
@@ -317,7 +327,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
317
327
|
|
|
318
328
|
renderWithEventBus(
|
|
319
329
|
<AssessmentPanel
|
|
320
|
-
{...defaultProps}
|
|
330
|
+
{...defaultProps} session={session}
|
|
321
331
|
pendingAnnotation={pendingAnnotation}
|
|
322
332
|
/>
|
|
323
333
|
);
|
|
@@ -332,7 +342,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
332
342
|
|
|
333
343
|
renderWithEventBus(
|
|
334
344
|
<AssessmentPanel
|
|
335
|
-
{...defaultProps}
|
|
345
|
+
{...defaultProps} session={session}
|
|
336
346
|
pendingAnnotation={pendingAnnotation}
|
|
337
347
|
/>,
|
|
338
348
|
tracker
|
|
@@ -358,7 +368,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
358
368
|
|
|
359
369
|
renderWithEventBus(
|
|
360
370
|
<AssessmentPanel
|
|
361
|
-
{...defaultProps}
|
|
371
|
+
{...defaultProps} session={session}
|
|
362
372
|
pendingAnnotation={pendingAnnotation}
|
|
363
373
|
/>
|
|
364
374
|
);
|
|
@@ -376,7 +386,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
376
386
|
|
|
377
387
|
renderWithEventBus(
|
|
378
388
|
<AssessmentPanel
|
|
379
|
-
{...defaultProps}
|
|
389
|
+
{...defaultProps} session={session}
|
|
380
390
|
pendingAnnotation={pendingAnnotation}
|
|
381
391
|
/>,
|
|
382
392
|
tracker
|
|
@@ -399,7 +409,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
399
409
|
|
|
400
410
|
const { container } = renderWithEventBus(
|
|
401
411
|
<AssessmentPanel
|
|
402
|
-
{...defaultProps}
|
|
412
|
+
{...defaultProps} session={session}
|
|
403
413
|
pendingAnnotation={pendingAnnotation}
|
|
404
414
|
/>
|
|
405
415
|
);
|
|
@@ -414,7 +424,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
414
424
|
it('should render assessment entries', () => {
|
|
415
425
|
renderWithEventBus(
|
|
416
426
|
<AssessmentPanel
|
|
417
|
-
{...defaultProps}
|
|
427
|
+
{...defaultProps} session={session}
|
|
418
428
|
annotations={mockAssessments.single}
|
|
419
429
|
/>
|
|
420
430
|
);
|
|
@@ -429,7 +439,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
429
439
|
expect(() => {
|
|
430
440
|
renderWithEventBus(
|
|
431
441
|
<AssessmentPanel
|
|
432
|
-
{...defaultProps}
|
|
442
|
+
{...defaultProps} session={session}
|
|
433
443
|
annotations={mockAssessments.single}
|
|
434
444
|
/>
|
|
435
445
|
);
|
|
@@ -441,7 +451,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
441
451
|
it('should render AssistSection when annotateMode is true', () => {
|
|
442
452
|
renderWithEventBus(
|
|
443
453
|
<AssessmentPanel
|
|
444
|
-
{...defaultProps}
|
|
454
|
+
{...defaultProps} session={session}
|
|
445
455
|
annotateMode={true}
|
|
446
456
|
/>
|
|
447
457
|
);
|
|
@@ -452,7 +462,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
452
462
|
it('should not render AssistSection when annotateMode is false', () => {
|
|
453
463
|
renderWithEventBus(
|
|
454
464
|
<AssessmentPanel
|
|
455
|
-
{...defaultProps}
|
|
465
|
+
{...defaultProps} session={session}
|
|
456
466
|
annotateMode={false}
|
|
457
467
|
/>
|
|
458
468
|
);
|
|
@@ -463,7 +473,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
463
473
|
it('should render AssistSection with correct annotationType', () => {
|
|
464
474
|
renderWithEventBus(
|
|
465
475
|
<AssessmentPanel
|
|
466
|
-
{...defaultProps}
|
|
476
|
+
{...defaultProps} session={session}
|
|
467
477
|
annotateMode={true}
|
|
468
478
|
/>
|
|
469
479
|
);
|
|
@@ -479,7 +489,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
479
489
|
|
|
480
490
|
renderWithEventBus(
|
|
481
491
|
<AssessmentPanel
|
|
482
|
-
{...defaultProps}
|
|
492
|
+
{...defaultProps} session={session}
|
|
483
493
|
pendingAnnotation={pendingAnnotation}
|
|
484
494
|
/>
|
|
485
495
|
);
|
|
@@ -492,7 +502,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
492
502
|
|
|
493
503
|
renderWithEventBus(
|
|
494
504
|
<AssessmentPanel
|
|
495
|
-
{...defaultProps}
|
|
505
|
+
{...defaultProps} session={session}
|
|
496
506
|
pendingAnnotation={pendingAnnotation}
|
|
497
507
|
/>
|
|
498
508
|
);
|
|
@@ -509,7 +519,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
509
519
|
|
|
510
520
|
describe('Accessibility', () => {
|
|
511
521
|
it('should have proper heading structure', () => {
|
|
512
|
-
renderWithEventBus(<AssessmentPanel {...defaultProps} />);
|
|
522
|
+
renderWithEventBus(<AssessmentPanel {...defaultProps} session={session} />);
|
|
513
523
|
|
|
514
524
|
const heading = screen.getByText(/Assessments/);
|
|
515
525
|
expect(heading).toHaveClass('semiont-panel-header__text');
|
|
@@ -520,7 +530,7 @@ describe('AssessmentPanel Component', () => {
|
|
|
520
530
|
|
|
521
531
|
renderWithEventBus(
|
|
522
532
|
<AssessmentPanel
|
|
523
|
-
{...defaultProps}
|
|
533
|
+
{...defaultProps} session={session}
|
|
524
534
|
pendingAnnotation={pendingAnnotation}
|
|
525
535
|
/>
|
|
526
536
|
);
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { screen } from '@testing-library/react';
|
|
17
|
-
import { renderWithProviders } from '../../../../test-utils';
|
|
17
|
+
import { renderWithProviders, createTestSemiontWrapper } from '../../../../test-utils';
|
|
18
18
|
import userEvent from '@testing-library/user-event';
|
|
19
|
+
import type { EventBus } from '@semiont/core';
|
|
20
|
+
import type { SemiontSession } from '@semiont/sdk';
|
|
19
21
|
import { AssistSection } from '../AssistSection';
|
|
20
22
|
|
|
21
23
|
// Mock translations
|
|
@@ -52,8 +54,16 @@ vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
|
52
54
|
}));
|
|
53
55
|
|
|
54
56
|
describe('AssistSection', () => {
|
|
57
|
+
// Per-test session/bus — created in beforeEach (a module-scope factory
|
|
58
|
+
// call would hand tests a client that test-utils disposes after the
|
|
59
|
+
// first test). The `session` prop and the `eventBus` the emission
|
|
60
|
+
// tests subscribe come from the SAME factory call.
|
|
61
|
+
let session: SemiontSession;
|
|
62
|
+
let eventBus: EventBus;
|
|
63
|
+
|
|
55
64
|
beforeEach(() => {
|
|
56
65
|
vi.clearAllMocks();
|
|
66
|
+
({ session, eventBus } = createTestSemiontWrapper());
|
|
57
67
|
// Clear localStorage
|
|
58
68
|
if (typeof window !== 'undefined') {
|
|
59
69
|
localStorage.clear();
|
|
@@ -64,6 +74,7 @@ describe('AssistSection', () => {
|
|
|
64
74
|
it('should render progress message when progress prop provided', () => {
|
|
65
75
|
renderWithProviders(
|
|
66
76
|
<AssistSection
|
|
77
|
+
session={session}
|
|
67
78
|
annotationType="highlight"
|
|
68
79
|
isAssisting={true}
|
|
69
80
|
progress={{
|
|
@@ -80,6 +91,7 @@ describe('AssistSection', () => {
|
|
|
80
91
|
it('should render progress message with sparkle icon', () => {
|
|
81
92
|
renderWithProviders(
|
|
82
93
|
<AssistSection
|
|
94
|
+
session={session}
|
|
83
95
|
annotationType="highlight"
|
|
84
96
|
isAssisting={true}
|
|
85
97
|
progress={{
|
|
@@ -99,6 +111,7 @@ describe('AssistSection', () => {
|
|
|
99
111
|
it('should render request parameters when provided', () => {
|
|
100
112
|
renderWithProviders(
|
|
101
113
|
<AssistSection
|
|
114
|
+
session={session}
|
|
102
115
|
annotationType="highlight"
|
|
103
116
|
isAssisting={true}
|
|
104
117
|
progress={{
|
|
@@ -123,6 +136,7 @@ describe('AssistSection', () => {
|
|
|
123
136
|
it('should hide form when progress is present', () => {
|
|
124
137
|
renderWithProviders(
|
|
125
138
|
<AssistSection
|
|
139
|
+
session={session}
|
|
126
140
|
annotationType="highlight"
|
|
127
141
|
isAssisting={true}
|
|
128
142
|
progress={{
|
|
@@ -141,6 +155,7 @@ describe('AssistSection', () => {
|
|
|
141
155
|
it('should show form when progress is null', () => {
|
|
142
156
|
renderWithProviders(
|
|
143
157
|
<AssistSection
|
|
158
|
+
session={session}
|
|
144
159
|
annotationType="highlight"
|
|
145
160
|
isAssisting={false}
|
|
146
161
|
progress={null}
|
|
@@ -155,6 +170,7 @@ describe('AssistSection', () => {
|
|
|
155
170
|
it('should show form when progress is undefined', () => {
|
|
156
171
|
renderWithProviders(
|
|
157
172
|
<AssistSection
|
|
173
|
+
session={session}
|
|
158
174
|
annotationType="highlight"
|
|
159
175
|
isAssisting={false}
|
|
160
176
|
progress={undefined}
|
|
@@ -169,6 +185,7 @@ describe('AssistSection', () => {
|
|
|
169
185
|
it('should keep progress visible after detection completes (isAssisting=false but progress exists)', () => {
|
|
170
186
|
renderWithProviders(
|
|
171
187
|
<AssistSection
|
|
188
|
+
session={session}
|
|
172
189
|
annotationType="highlight"
|
|
173
190
|
isAssisting={false}
|
|
174
191
|
progress={{
|
|
@@ -190,6 +207,7 @@ describe('AssistSection', () => {
|
|
|
190
207
|
it('should render for highlight type', () => {
|
|
191
208
|
renderWithProviders(
|
|
192
209
|
<AssistSection
|
|
210
|
+
session={session}
|
|
193
211
|
annotationType="highlight"
|
|
194
212
|
isAssisting={false}
|
|
195
213
|
progress={null}
|
|
@@ -202,6 +220,7 @@ describe('AssistSection', () => {
|
|
|
202
220
|
it('should render for assessment type', () => {
|
|
203
221
|
renderWithProviders(
|
|
204
222
|
<AssistSection
|
|
223
|
+
session={session}
|
|
205
224
|
annotationType="assessment"
|
|
206
225
|
isAssisting={false}
|
|
207
226
|
progress={null}
|
|
@@ -214,6 +233,7 @@ describe('AssistSection', () => {
|
|
|
214
233
|
it('should render for comment type', () => {
|
|
215
234
|
renderWithProviders(
|
|
216
235
|
<AssistSection
|
|
236
|
+
session={session}
|
|
217
237
|
annotationType="comment"
|
|
218
238
|
isAssisting={false}
|
|
219
239
|
progress={null}
|
|
@@ -226,6 +246,7 @@ describe('AssistSection', () => {
|
|
|
226
246
|
it('should show tone selector for comments', () => {
|
|
227
247
|
renderWithProviders(
|
|
228
248
|
<AssistSection
|
|
249
|
+
session={session}
|
|
229
250
|
annotationType="comment"
|
|
230
251
|
isAssisting={false}
|
|
231
252
|
progress={null}
|
|
@@ -239,6 +260,7 @@ describe('AssistSection', () => {
|
|
|
239
260
|
it('should show tone selector for assessments', () => {
|
|
240
261
|
renderWithProviders(
|
|
241
262
|
<AssistSection
|
|
263
|
+
session={session}
|
|
242
264
|
annotationType="assessment"
|
|
243
265
|
isAssisting={false}
|
|
244
266
|
progress={null}
|
|
@@ -252,6 +274,7 @@ describe('AssistSection', () => {
|
|
|
252
274
|
it('should not show tone selector for highlights', () => {
|
|
253
275
|
renderWithProviders(
|
|
254
276
|
<AssistSection
|
|
277
|
+
session={session}
|
|
255
278
|
annotationType="highlight"
|
|
256
279
|
isAssisting={false}
|
|
257
280
|
progress={null}
|
|
@@ -268,16 +291,16 @@ describe('AssistSection', () => {
|
|
|
268
291
|
const user = userEvent.setup();
|
|
269
292
|
const detectionHandler = vi.fn();
|
|
270
293
|
|
|
271
|
-
|
|
294
|
+
renderWithProviders(
|
|
272
295
|
<AssistSection
|
|
296
|
+
session={session}
|
|
273
297
|
annotationType="highlight"
|
|
274
298
|
isAssisting={false}
|
|
275
299
|
progress={null}
|
|
276
|
-
|
|
277
|
-
{ returnEventBus: true }
|
|
300
|
+
/>
|
|
278
301
|
);
|
|
279
302
|
|
|
280
|
-
const subscription = eventBus
|
|
303
|
+
const subscription = eventBus.get('mark:assist-request').subscribe(detectionHandler);
|
|
281
304
|
|
|
282
305
|
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
283
306
|
await user.click(annotateButton);
|
|
@@ -294,16 +317,16 @@ describe('AssistSection', () => {
|
|
|
294
317
|
const user = userEvent.setup();
|
|
295
318
|
const detectionHandler = vi.fn();
|
|
296
319
|
|
|
297
|
-
|
|
320
|
+
renderWithProviders(
|
|
298
321
|
<AssistSection
|
|
322
|
+
session={session}
|
|
299
323
|
annotationType="assessment"
|
|
300
324
|
isAssisting={false}
|
|
301
325
|
progress={null}
|
|
302
|
-
|
|
303
|
-
{ returnEventBus: true }
|
|
326
|
+
/>
|
|
304
327
|
);
|
|
305
328
|
|
|
306
|
-
const subscription = eventBus
|
|
329
|
+
const subscription = eventBus.get('mark:assist-request').subscribe(detectionHandler);
|
|
307
330
|
|
|
308
331
|
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
309
332
|
await user.click(annotateButton);
|
|
@@ -320,16 +343,16 @@ describe('AssistSection', () => {
|
|
|
320
343
|
const user = userEvent.setup();
|
|
321
344
|
const detectionHandler = vi.fn();
|
|
322
345
|
|
|
323
|
-
|
|
346
|
+
renderWithProviders(
|
|
324
347
|
<AssistSection
|
|
348
|
+
session={session}
|
|
325
349
|
annotationType="comment"
|
|
326
350
|
isAssisting={false}
|
|
327
351
|
progress={null}
|
|
328
|
-
|
|
329
|
-
{ returnEventBus: true }
|
|
352
|
+
/>
|
|
330
353
|
);
|
|
331
354
|
|
|
332
|
-
const subscription = eventBus
|
|
355
|
+
const subscription = eventBus.get('mark:assist-request').subscribe(detectionHandler);
|
|
333
356
|
|
|
334
357
|
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
335
358
|
await user.click(annotateButton);
|
|
@@ -346,16 +369,16 @@ describe('AssistSection', () => {
|
|
|
346
369
|
const user = userEvent.setup();
|
|
347
370
|
const detectionHandler = vi.fn();
|
|
348
371
|
|
|
349
|
-
|
|
372
|
+
renderWithProviders(
|
|
350
373
|
<AssistSection
|
|
374
|
+
session={session}
|
|
351
375
|
annotationType="highlight"
|
|
352
376
|
isAssisting={false}
|
|
353
377
|
progress={null}
|
|
354
|
-
|
|
355
|
-
{ returnEventBus: true }
|
|
378
|
+
/>
|
|
356
379
|
);
|
|
357
380
|
|
|
358
|
-
const subscription = eventBus
|
|
381
|
+
const subscription = eventBus.get('mark:assist-request').subscribe(detectionHandler);
|
|
359
382
|
|
|
360
383
|
const textarea = screen.getByPlaceholderText('Enter custom instructions...');
|
|
361
384
|
await user.type(textarea, 'Find key concepts');
|
|
@@ -379,6 +402,7 @@ describe('AssistSection', () => {
|
|
|
379
402
|
it('should be expanded by default', () => {
|
|
380
403
|
renderWithProviders(
|
|
381
404
|
<AssistSection
|
|
405
|
+
session={session}
|
|
382
406
|
annotationType="highlight"
|
|
383
407
|
isAssisting={false}
|
|
384
408
|
progress={null}
|
|
@@ -395,6 +419,7 @@ describe('AssistSection', () => {
|
|
|
395
419
|
|
|
396
420
|
renderWithProviders(
|
|
397
421
|
<AssistSection
|
|
422
|
+
session={session}
|
|
398
423
|
annotationType="highlight"
|
|
399
424
|
isAssisting={false}
|
|
400
425
|
progress={null}
|
|
@@ -413,6 +438,7 @@ describe('AssistSection', () => {
|
|
|
413
438
|
|
|
414
439
|
renderWithProviders(
|
|
415
440
|
<AssistSection
|
|
441
|
+
session={session}
|
|
416
442
|
annotationType="highlight"
|
|
417
443
|
isAssisting={false}
|
|
418
444
|
progress={null}
|
|
@@ -432,6 +458,7 @@ describe('AssistSection', () => {
|
|
|
432
458
|
it('should handle empty progress message', () => {
|
|
433
459
|
renderWithProviders(
|
|
434
460
|
<AssistSection
|
|
461
|
+
session={session}
|
|
435
462
|
annotationType="highlight"
|
|
436
463
|
isAssisting={true}
|
|
437
464
|
progress={{
|
|
@@ -450,6 +477,7 @@ describe('AssistSection', () => {
|
|
|
450
477
|
it('should handle progress without percentage', () => {
|
|
451
478
|
renderWithProviders(
|
|
452
479
|
<AssistSection
|
|
480
|
+
session={session}
|
|
453
481
|
annotationType="highlight"
|
|
454
482
|
isAssisting={true}
|
|
455
483
|
progress={{
|
|
@@ -466,6 +494,7 @@ describe('AssistSection', () => {
|
|
|
466
494
|
it('should handle progress with empty requestParams array', () => {
|
|
467
495
|
renderWithProviders(
|
|
468
496
|
<AssistSection
|
|
497
|
+
session={session}
|
|
469
498
|
annotationType="highlight"
|
|
470
499
|
isAssisting={true}
|
|
471
500
|
progress={{
|