-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArcOverlay.test.tsx
More file actions
610 lines (557 loc) · 21.1 KB
/
Copy pathArcOverlay.test.tsx
File metadata and controls
610 lines (557 loc) · 21.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/** @file Unit tests for components/ArcOverlay.tsx. */
/// <reference types="jest" />
/// <reference types="@testing-library/jest-dom" />
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ArcOverlay } from '../../components/ArcOverlay';
import type { ArcPath } from '../../utils/phrase-arc';
import { makePhraseLink } from '../test-helpers';
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
/**
* Builds a minimal `ArcPath` fixture.
*
* @param phraseId - Phrase id for the arc.
* @param splitAfterTokenRef - Token ref marking the end of the earlier fragment.
* @returns An `ArcPath` with placeholder geometry.
*/
function makeArcPath(phraseId: string, splitAfterTokenRef = 'tok-a'): ArcPath {
// `d` is derived from splitAfterTokenRef so distinct split points yield distinct
// path data — matching real arcs, where the React key `${phraseId}-${d}` stays unique.
return {
phraseId,
d: `M0 0 L100 0 ${splitAfterTokenRef}`,
midX: 50,
midY: 10,
runLeft: 0,
runRight: 100,
splitAfterTokenRef,
};
}
/** Default no-op props for `ArcOverlay`. */
function requiredProps(): Parameters<typeof ArcOverlay>[0] {
return {
arcPaths: [],
phraseMode: { kind: 'view' },
hoveredPhraseId: undefined,
focusedPhraseId: undefined,
candidatePhraseIds: new Set(),
phraseLinkById: new Map(),
tokenDocOrder: new Map(),
onArcSplit: jest.fn(),
onSplitHoverChange: jest.fn(),
onHoverPhrase: jest.fn(),
};
}
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------
describe('ArcOverlay', () => {
it('returns undefined when arcPaths is empty', () => {
const { container } = render(<ArcOverlay {...requiredProps()} />);
expect(container.firstChild).toBeNull();
});
it('renders an SVG when arcPaths has entries', () => {
render(<ArcOverlay {...requiredProps()} arcPaths={[makeArcPath('p1')]} />);
expect(document.querySelector('svg')).toBeInTheDocument();
});
it('renders one SVG path element per arc', () => {
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a'), makeArcPath('p2', 'tok-b')]}
/>,
);
expect(document.querySelectorAll('path')).toHaveLength(2);
});
it('does not render split buttons in edit mode', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
phraseMode={{ kind: 'edit', phraseId: 'p1', originalTokens: phraseLink.tokens }}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
/>,
);
expect(screen.queryByTestId('split-arc-btn')).not.toBeInTheDocument();
});
it('renders a split button in view mode even when the arc phrase is neither hovered nor focused', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId={undefined}
focusedPhraseId={undefined}
phraseLinkById={new Map([['p1', phraseLink]])}
/>,
);
expect(screen.getByTestId('split-arc-btn')).toBeInTheDocument();
expect(screen.getByTestId('split-arc-btn').className).not.toContain('text-muted-foreground');
});
it('with simplifyPhrases on, hides the split button for a non-focused phrase but keeps its arc', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
focusedPhraseId="p2"
phraseLinkById={new Map([['p1', phraseLink]])}
simplifyPhrases
/>,
);
expect(screen.queryByTestId('split-arc-btn')).not.toBeInTheDocument();
// The arc itself is still drawn.
expect(document.querySelector('path')).toBeInTheDocument();
});
it('with simplifyPhrases on, keeps the split button for the focused phrase', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
focusedPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
simplifyPhrases
/>,
);
expect(screen.getByTestId('split-arc-btn')).toBeInTheDocument();
});
it('renders a split button in view mode when the arc phrase is hovered', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
/>,
);
expect(screen.getByTestId('split-arc-btn')).toBeInTheDocument();
});
it('renders a split button in view mode when the arc phrase is focused', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
focusedPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
/>,
);
expect(screen.getByTestId('split-arc-btn')).toBeInTheDocument();
expect(screen.getByTestId('split-arc-btn').className).toContain('phrase-focused');
});
it('calls onArcSplit and clears hover state when split button is clicked', async () => {
const onArcSplit = jest.fn();
const onSplitHoverChange = jest.fn();
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
])
}
onArcSplit={onArcSplit}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.click(screen.getByTestId('split-arc-btn'));
expect(onSplitHoverChange).toHaveBeenCalledWith(new Set());
expect(onArcSplit).toHaveBeenCalledWith('p1', 'tok-a');
});
it('calls onSplitHoverChange with free refs on mouse enter when split would free a token', async () => {
const onSplitHoverChange = jest.fn();
// Two-token phrase: splitting after tok-a frees both halves (each length 1).
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
expect(onSplitHoverChange).toHaveBeenCalledWith(new Set(['tok-a', 'tok-b']));
});
it('calls onSplitHoverChange with undefined on mouse leave', async () => {
const onSplitHoverChange = jest.fn();
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
await userEvent.unhover(screen.getByTestId('split-arc-btn'));
expect(onSplitHoverChange).toHaveBeenLastCalledWith(new Set());
});
it('does not call onSplitHoverChange with free refs on enter when no token would become free (both halves ≥ 2)', async () => {
const onSplitHoverChange = jest.fn();
// Four-token phrase: splitting after tok-b gives before=[tok-a,tok-b] and after=[tok-c,tok-d], both ≥ 2.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
// onSplitHoverChange should NOT be called (no tokens freed, reshape path taken instead)
expect(onSplitHoverChange).not.toHaveBeenCalled();
});
it('does not call onSplitHoverChange when splitAfterTokenRef is not found in the phrase', async () => {
const onSplitHoverChange = jest.fn();
// Arc refers to 'tok-stale' which is not in the phrase token list.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-stale')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
expect(onSplitHoverChange).not.toHaveBeenCalled();
});
it('renders the arc path when a phrase is highlighted only via candidatePhraseIds', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId={undefined}
focusedPhraseId={undefined}
candidatePhraseIds={new Set(['p1'])}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
/>,
);
expect(document.querySelector('path')).toBeInTheDocument();
});
it('renders a split button when a phrase is highlighted only via candidatePhraseIds', () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId={undefined}
focusedPhraseId={undefined}
candidatePhraseIds={new Set(['p1'])}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
/>,
);
expect(screen.getByTestId('split-arc-btn')).toBeInTheDocument();
});
it('assigns focused-phrase priority to an arc whose phraseId matches focusedPhraseId but not the hovered split point', async () => {
// Two arcs for p1 (split at tok-a and tok-b). When tok-a's split button is hovered,
// splitHoveredArc.phraseId === 'p1' but splitHoveredArc.splitAfterTokenRef !== 'tok-b', so
// tok-b's arc falls through to the focusedPhraseId branch (line 84) — covering the false branch
// of the splitAfterTokenRef && condition and the true branch of phraseId === focusedPhraseId.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a'), makeArcPath('p1', 'tok-b')]}
focusedPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
])
}
/>,
);
const btns = screen.getAllByTestId('split-arc-btn');
// Hover the first split button — tok-b's arc goes through focusedPhraseId branch.
await userEvent.hover(btns[0]);
// The free-split-hovered tok-a arc is promoted to the z-5 (hovered) layer.
const hoveredLayer = document.querySelector('svg.tw\\:z-5');
const hoveredPaths = hoveredLayer?.querySelectorAll('path') ?? [];
expect(hoveredPaths).toHaveLength(1);
expect(hoveredPaths[0].getAttribute('d')).toContain('tok-a');
// tok-b's arc is classified focused via the focusedPhraseId branch, so it sits in the z-3
// (focused) layer — not the z-1 unfocused layer it would fall to if that branch regressed.
const focusedLayer = document.querySelector('svg.tw\\:z-3');
const focusedPaths = focusedLayer?.querySelectorAll('path') ?? [];
expect(focusedPaths).toHaveLength(1);
expect(focusedPaths[0].getAttribute('d')).toContain('tok-b');
// Nothing falls through to the unfocused (z-1) layer.
expect(document.querySelector('svg.tw\\:z-1')?.querySelectorAll('path')).toHaveLength(0);
});
it('assigns candidate priority to an arc via candidatePhraseIds when split-hover misses its splitAfterTokenRef and focusedPhraseId does not match', async () => {
// Two arcs for p1 (split at tok-a and tok-b). No hoveredPhraseId, no focusedPhraseId, but
// candidatePhraseIds includes 'p1'. When tok-a's split button is hovered, tok-b's arc falls
// through: phraseId matches splitHoveredArc.phraseId but not splitAfterTokenRef → line 84
// (focusedPhraseId undefined → false) → line 85 candidatePhraseIds.has('p1') → true.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a'), makeArcPath('p1', 'tok-b')]}
candidatePhraseIds={new Set(['p1'])}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
])
}
/>,
);
const btns = screen.getAllByTestId('split-arc-btn');
await userEvent.hover(btns[0]);
// Both arcs land in the z-5 (hovered) layer: tok-a via the free-split promotion, and tok-b via
// the candidatePhraseIds.has('p1') branch. If that candidate clause regressed, tok-b would drop
// to the z-1 (unfocused) layer and would no longer appear here.
const hoveredLayer = document.querySelector('svg.tw\\:z-5');
const hoveredDs = Array.from(hoveredLayer?.querySelectorAll('path') ?? []).map((p) =>
p.getAttribute('d'),
);
expect(hoveredDs).toHaveLength(2);
expect(hoveredDs).toEqual(
expect.arrayContaining([expect.stringContaining('tok-a'), expect.stringContaining('tok-b')]),
);
// No arc is demoted to the unfocused (z-1) layer.
expect(document.querySelector('svg.tw\\:z-1')?.querySelectorAll('path')).toHaveLength(0);
});
it('highlights the phrase via onHoverPhrase on enter when the split would not free any token', async () => {
const onHoverPhrase = jest.fn();
const onSplitHoverChange = jest.fn();
// Four-token phrase: splitting after tok-b leaves both halves ≥ 2, so no token is freed.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
hoveredPhraseId={undefined}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
onHoverPhrase={onHoverPhrase}
onSplitHoverChange={onSplitHoverChange}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
expect(onHoverPhrase).toHaveBeenCalledWith('p1');
// No destructive preview is shown when nothing would be freed.
expect(onSplitHoverChange).not.toHaveBeenCalledWith(expect.objectContaining({ size: 1 }));
});
it('clears the phrase highlight via onHoverPhrase on leave for a non-freeing split', async () => {
const onHoverPhrase = jest.fn();
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
onHoverPhrase={onHoverPhrase}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
await userEvent.unhover(screen.getByTestId('split-arc-btn'));
expect(onHoverPhrase).toHaveBeenLastCalledWith(undefined);
});
it('clears the phrase highlight via onHoverPhrase when a non-freeing split button is clicked', async () => {
const onHoverPhrase = jest.fn();
const onArcSplit = jest.fn();
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
onHoverPhrase={onHoverPhrase}
onArcSplit={onArcSplit}
/>,
);
await userEvent.click(screen.getByTestId('split-arc-btn'));
expect(onHoverPhrase).toHaveBeenCalledWith(undefined);
expect(onArcSplit).toHaveBeenCalledWith('p1', 'tok-b');
});
it('does not call onHoverPhrase on enter when the split would free a token', async () => {
const onHoverPhrase = jest.fn();
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
onHoverPhrase={onHoverPhrase}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
expect(onHoverPhrase).not.toHaveBeenCalled();
});
it('renders destructive stroke style when the split button is hovered', async () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-a')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
])
}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
const pathEl = document.querySelector('path');
expect(pathEl?.getAttribute('style')).toContain('var(--destructive)');
});
it('dims the hovered segment (not destructive) when a non-freeing split button is hovered', async () => {
// Four-token phrase: splitting after tok-b leaves both halves ≥ 2, so it is a reshape, not a
// free. The hovered segment dims rather than turning destructive red.
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
hoveredPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
const pathEl = document.querySelector('path');
expect(pathEl?.getAttribute('style')).toContain('var(--border)');
expect(pathEl?.getAttribute('style')).not.toContain('var(--destructive)');
expect(pathEl?.getAttribute('stroke-opacity')).toBe('0.3');
});
it('restores the standard stroke after a non-freeing split hover leaves', async () => {
const phraseLink = makePhraseLink('p1', ['tok-a', 'tok-b', 'tok-c', 'tok-d']);
render(
<ArcOverlay
{...requiredProps()}
arcPaths={[makeArcPath('p1', 'tok-b')]}
focusedPhraseId="p1"
phraseLinkById={new Map([['p1', phraseLink]])}
tokenDocOrder={
new Map([
['tok-a', 0],
['tok-b', 1],
['tok-c', 2],
['tok-d', 3],
])
}
/>,
);
await userEvent.hover(screen.getByTestId('split-arc-btn'));
await userEvent.unhover(screen.getByTestId('split-arc-btn'));
const pathEl = document.querySelector('path');
// Focused phrase falls back to the highlighted foreground stroke once the dim is cleared.
expect(pathEl?.getAttribute('style')).toContain('var(--foreground)');
});
});