ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / hover / test / browser / hoverService.test.ts 990 строк · изменён 14 нояб., 04:52
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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
import * as assert from 'assert' ;
import { Event } from '../../../../base/common/event.js' ;
import { toDisposable } from '../../../../base/common/lifecycle.js' ;
import { timeout } from '../../../../base/common/async.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { runWithFakedTimers } from '../../../../base/test/common/timeTravelScheduler.js' ;
import { TestInstantiationService } from '../../../instantiation/test/common/instantiationServiceMock.js' ;
import { IConfigurationService
TestConfigurationService
HoverService
IHoverService WorkbenchHoverDelegate
HoverWidget
IContextMenuService
IKeybindingService
ILayoutService
IAccessibilityService
TestAccessibilityService
mainWindow
NoMatchingKb
IMarkdownRendererService
IHoverWidget
HoverPosition
AnchorAlignment
store
hoverService HoverService
fixture HTMLElement
instantiationService TestInstantiationService
fixture document
mainWindow document body fixture
store fixture
instantiationService store
configurationService
configurationService
configurationService
instantiationService IConfigurationService configurationService
instantiationService IContextMenuService
onDidShowContextMenu Event None
instantiationService IKeybindingService
NoMatchingKb
instantiationService ILayoutService
activeContainer fixture
mainContainer fixture
fixture
onDidLayoutContainer Event None
instantiationService IAccessibilityService
instantiationService IMarkdownRendererService
element document
hoverService store instantiationService HoverService
instantiationService IHoverService hoverService
HTMLElement
target document
target style width
target style height
fixture target
target
content target HTMLElement options Partial Parameters hoverService showInstantHover IHoverWidget
hover hoverService
content
target target
options
assert hover
hover
hover IHoverWidget HoverWidget
hover HoverWidget
hover IHoverWidget
mainWindow document body hover domNode
hover IHoverWidget message
assert hover message
hover IHoverWidget message
assert hover message
parentHover IHoverWidget content IHoverWidget
nestedTarget document
parentHover domNode nestedTarget
content nestedTarget
depth HoverWidget
hovers HoverWidget
currentTarget HTMLElement
i i depth i
hover hoverService
content
target currentTarget
hover
hovers hover
currentTarget document
hover domNode currentTarget
hovers
hovers HoverWidget
h hovers
h
target
hover hoverService
content
target
assert hover
target
target
hover target
position
hoverPosition HoverPosition
anchorAlignment AnchorAlignment
appearance showPointer
hoverWidget hover
Object hoverWidget domNode configurable value
hoverWidget
assert hoverWidget x
hover
target
targetLeft
target targetLeft
hover target
position
hoverPosition HoverPosition
anchorAlignment AnchorAlignment
appearance showPointer
hoverWidget hover
Object hoverWidget domNode
configurable
Math Number hoverWidget domNode style maxWidth
hoverWidget
constrainedMaxWidth hoverWidget domNode style maxWidth
targetLeft
hoverWidget
assert
constrainedMaxWidth
restoredMaxWidth hoverWidget domNode style maxWidth
constrainedMaxWidth
restoredMaxWidth
hover
hover
appearance maxHeightRatio
actions
commandId
label
hoverWidget hover
contentsDomNode hoverWidget domNode
assert contentsDomNode
statusBarDomNode hoverWidget domNode
assert statusBarDomNode
overflowingContent document
overflowingContent style height
contentsDomNode overflowingContent
hoverWidget
expectedMaxHeight
hoverBounds hoverWidget domNode
statusBarBounds statusBarDomNode
heightOutsideContents hoverWidget domNode offsetHeight contentsDomNode offsetHeight
assert
hoverMaxHeight hoverWidget domNode style maxHeight
contentsMaxHeight contentsDomNode style maxHeight
contentOverflows contentsDomNode scrollHeight contentsDomNode clientHeight
statusBarIsVisible statusBarBounds top hoverBounds top statusBarBounds bottom hoverBounds bottom
hoverMaxHeight expectedMaxHeight
contentsMaxHeight
contentOverflows
statusBarIsVisible
hover
hover
appearance maxHeightRatio
actions
commandId
label
contentsDomNode hover domNode
assert contentsDomNode
assert
contentOverflows contentsDomNode scrollHeight contentsDomNode clientHeight
scrollbarPadding contentsDomNode style paddingRight
contentOverflows
scrollbarPadding
hover
target
didShowCalled
hover hoverService
content
target
didShowCalled
assert didShowCalled
assert hover
hover
hover
hover
target
didHideCount
hover hoverService
content
target
didHideCount
assert hover
hover
hover
assert didHideCount
target
calls
hoverService
content
target
calls
hoverService
calls
assert calls
target
hover1 hoverService
content
target
id
hover2 hoverService
content
target
id
assert hover1
hover1
assert hover2
hover3 hoverService
content
target
id
assert hover3
hover3
hover1
hover3
hover
additionalClasses
domNode hover domNode
hover
assert domNode classList
assert domNode classList
hover
hover
hover
hover
hoverService
assert hover isDisposed
hover
hover
persistence sticky
hover
hoverService
assert hover isDisposed
hover
hoverService
assert hover isDisposed
hover
useFakeTimers
instantiationService IConfigurationService TestConfigurationService
hover hoverService content target
assert hover
hover
hoverService
hover
parentHover
parentHover
nestedHover parentHover
nestedHover
parentHover
assert parentHover isDisposed
assert nestedHover isDisposed
nestedHover
nestedHover
parentHover
parentHover
parentHover
parentHover
nestedHover parentHover
parentHover
nestedHover
parentHover
assert nestedHover isDisposed
parentHover
nestedHover
hovers
assert hovers length
i i hovers length i
assert mainWindow document body hovers i domNode
hovers
i i hovers length i
assert hovers i isDisposed
assert mainWindow document body hovers i domNode
hovers
assert hovers length
h hovers
assert mainWindow document body h domNode
hovers
assert hovers isDisposed
assert mainWindow document body hovers domNode
assert hovers isDisposed
assert mainWindow document body hovers domNode
assert hovers isDisposed
assert mainWindow document body hovers domNode
hovers
hovers
assert hovers length
h hovers
assert mainWindow document body h domNode
nestedTarget document
hovers domNode nestedTarget
fourthHover hoverService
content
target nestedTarget
assert fourthHover
hovers
firstChain
h firstChain
assert mainWindow document body h domNode
firstChain
h firstChain
assert mainWindow document body h domNode
secondChain
assert secondChain length
h secondChain
assert mainWindow document body h domNode
secondChain
hovers
assert mainWindow document body hovers domNode
assert mainWindow document body hovers domNode
hoverService
assert hovers isDisposed
assert mainWindow document body hovers domNode
assert hovers isDisposed
assert mainWindow document body hovers domNode
hoverService
assert hovers isDisposed
assert mainWindow document body hovers domNode
useFakeTimers
target
callCount
disposable hoverService target
callCount
content
target bubbles
assert callCount
hoverService
target bubbles
assert callCount
disposable
hoverService
target
didHideCount
disposable hoverService target
content
didHideCount
disposable
assert didHideCount
useFakeTimers
target
instantiationService IConfigurationService TestConfigurationService
disposable hoverService target content reducedDelay
target bubbles
hoversBefore mainWindow document
assert hoversBefore length
hoversAfter mainWindow document
assert hoversAfter length
disposable
hoverService
useFakeTimers
target
instantiationService IConfigurationService TestConfigurationService
disposable hoverService target content
target bubbles
target bubbles
assert mainWindow document length
disposable
target
hover hoverService
delay showNativeHover
target
assert target
hover
assert target
target
hover hoverService
delay showNativeHover
target
assert target
hover
assert target
hover
assert target
hover
useFakeTimers
target
delegate store instantiationService WorkbenchHoverDelegate
hover store hoverService delegate target
actions commandId label
hover
actions commandId label
target bubbles relatedTarget document body
assert
fixture e e textContent
useFakeTimers
target
delegate store instantiationService WorkbenchHoverDelegate
store hoverService delegate target
target bubbles relatedTarget document body
hoversBefore fixture
assert hoversBefore length
hoverService
hoverElement document
hoverElement classList
target bubbles relatedTarget hoverElement
hoversAfter fixture
assert hoversAfter length
useFakeTimers
target
delegate store instantiationService WorkbenchHoverDelegate
store hoverService delegate target
target bubbles relatedTarget document body
hoverService
target bubbles relatedTarget
hovers fixture
assert hovers length
lockedHover
persistence sticky
lockedHover
otherTarget
rejectedHover hoverService
content
target otherTarget
assert rejectedHover
lockedHover
lockedHover
lockedHover
useFakeTimers
target
reducedDelay
instantiationService IConfigurationService TestConfigurationService reducedDelay
hover hoverService
content
target
reducedDelay
assert hover
hover
reducedDelay
hover
reducedDelay
hover
hover
useFakeTimers
target
hover hoverService
content
target
assert hover
hover
hover
hover
widget hover
hover
assert widget isLocked
widget isLocked
assert widget isLocked
hover
widget isLocked
assert widget isLocked
hover
hover
hover
persistence sticky
hover
assert hover isLocked
hover
hover
target
hover hoverService
content
target
assert hover
hover
hover
hover
hoverService
hoverElements mainWindow document
assert hoverElements length
hoverService
remainingHovers mainWindow document
assert remainingHovers length
useFakeTimers
target
content document
content textContent
hover hoverService
content
target
assert hover
hover
widget hover
widget domNode bubbles
widget
hover
hover
hover
test useFakeTimers
target
content document
content textContent
hover hoverService
content
target
assert hover
hover
widget hover
widget domNode bubbles
hover
test useFakeTimers
target
content document
content textContent
hover hoverService
content
target
assert hover
hover
widget hover
widget domNode bubbles
widget
hover
widget domNode bubbles
widget domNode bubbles
hover
useFakeTimers
target
content document
content textContent
hover hoverService
content
target
assert hover
hover
document bubbles
hover
}
from
'../../../configuration/common/configuration.js'
;
import
{
}
from
'../../../configuration/test/common/testConfigurationService.js'
;
import
{
}
from
'../../browser/hoverService.js'
;
import
{
,
}
from
'../../browser/hover.js'
;
import
{
}
from
'../../browser/hoverWidget.js'
;
import
{
}
from
'../../../contextview/browser/contextView.js'
;
import
{
}
from
'../../../keybinding/common/keybinding.js'
;
import
{
}
from
'../../../layout/browser/layoutService.js'
;
import
{
}
from
'../../../accessibility/common/accessibility.js'
;
import
{
}
from
'../../../accessibility/test/common/testAccessibilityService.js'
;
import
{
}
from
'../../../../base/browser/window.js'
;
import
{
}
from
'../../../keybinding/common/keybindingResolver.js'
;
import
{
}
from
'../../../markdown/browser/markdownRenderer.js'
;
import
type
{
}
from
'../../../../base/browser/ui/hover/hover.js'
;
import
{
}
from
'../../../../base/browser/ui/hover/hoverWidget.js'
;
import
{
}
from
'../../../../base/common/layout.js'
;
suite
(
'HoverService'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
let
:
;
let
:
;
let
:
;
setup
(
(
)
=>
{
=
.
createElement
(
'div'
)
;
.
.
.
appendChild
(
)
;
.
add
(
toDisposable
(
(
)
=>
.
remove
(
)
)
)
;
=
.
add
(
new
TestInstantiationService
(
)
)
;
const
=
new
TestConfigurationService
(
)
;
.
setUserConfiguration
(
'workbench.hover.delay'
,
0
)
;
.
setUserConfiguration
(
'workbench.hover.reducedDelay'
,
0
)
;
.
stub
(
,
)
;
.
stub
(
,
{
:
.
}
)
;
.
stub
(
,
{
mightProducePrintableCharacter
(
)
{
return
false
;
}
,
softDispatch
(
)
{
return
;
}
,
lookupKeybinding
(
)
{
return
undefined
;
}
,
resolveKeyboardEvent
(
)
{
return
{
getLabel
(
)
{
return
''
;
}
,
getAriaLabel
(
)
{
return
''
;
}
,
getElectronAccelerator
(
)
{
return
null
;
}
,
getUserSettingsLabel
(
)
{
return
null
;
}
,
isWYSIWYG
(
)
{
return
false
;
}
,
hasMultipleChords
(
)
{
return
false
;
}
,
getDispatchChords
(
)
{
return
[
null
]
;
}
,
getSingleModifierDispatchChords
(
)
{
return
[
]
;
}
,
getChords
(
)
{
return
[
]
;
}
}
;
}
}
)
;
.
stub
(
,
{
:
,
:
,
getContainer
(
)
{
return
;
}
,
:
.
}
)
;
.
stub
(
,
new
TestAccessibilityService
(
)
)
;
.
stub
(
,
{
render
(
)
{
return
{
:
.
createElement
(
'div'
)
,
dispose
(
)
{
}
}
;
}
,
setDefaultCodeBlockRenderer
(
)
{
}
}
)
;
=
.
add
(
.
createInstance
(
)
)
;
.
stub
(
,
)
;
}
)
;
function
createTarget
(
)
:
{
const
=
.
createElement
(
'div'
)
;
.
.
=
'100px'
;
.
.
=
'100px'
;
.
appendChild
(
)
;
return
;
}
function
showHover
(
:
string
,
?
:
,
?
:
<
<
typeof
.
>
[
0
]
>
)
:
{
const
=
.
showInstantHover
(
{
,
:
??
createTarget
(
)
,
...
}
)
;
.
ok
(
,
` Hover with content " ${ content} " should be created `
)
;
return
;
}
function
asHoverWidget
(
:
)
:
{
return
as
;
}
function
isInDOM
(
:
)
:
boolean
{
return
.
.
.
contains
(
asHoverWidget
(
)
.
)
;
}
function
assertInDOM
(
:
,
?
:
string
)
:
void
{
.
ok
(
isInDOM
(
)
,
??
'Hover should be in the DOM'
)
;
}
function
assertNotInDOM
(
:
,
?
:
string
)
:
void
{
.
ok
(
!
isInDOM
(
)
,
??
'Hover should not be in the DOM'
)
;
}
function
createNestedHover
(
:
,
:
string
)
:
{
const
=
.
createElement
(
'div'
)
;
asHoverWidget
(
)
.
.
appendChild
(
)
;
return
showHover
(
,
)
;
}
function
createHoverChain
(
:
number
)
:
[
]
{
const
:
[
]
=
[
]
;
let
:
=
createTarget
(
)
;
for
(
let
=
0
;
<
;
++
)
{
const
=
.
showInstantHover
(
{
:
` Hover ${ i + 1 } `
,
:
}
)
;
if
(
!
)
{
break
;
}
.
push
(
asHoverWidget
(
)
)
;
=
.
createElement
(
'div'
)
;
asHoverWidget
(
)
.
.
appendChild
(
)
;
}
return
;
}
function
disposeHovers
(
:
[
]
)
:
void
{
for
(
const
of
[
...
]
.
reverse
(
)
)
{
?.
dispose
(
)
;
}
}
suite
(
'showInstantHover'
,
(
)
=>
{
test
(
'should not show hover with empty content'
,
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
showInstantHover
(
{
:
''
,
}
)
;
.
strictEqual
(
,
undefined
,
'Hover should not be created for empty content'
)
;
}
)
;
test
(
'should align the right edge of a hover with its target'
,
(
)
=>
{
const
=
createTarget
(
)
;
.
getBoundingClientRect
=
(
)
=>
new
DOMRect
(
300
,
100
,
100
,
20
)
;
const
=
showHover
(
'Right aligned hover'
,
,
{
:
{
:
.
BELOW
,
:
.
RIGHT
,
}
,
:
{
:
true
}
}
)
;
const
=
asHoverWidget
(
)
;
.
defineProperty
(
.
,
'clientWidth'
,
{
:
true
,
:
200
}
)
;
.
layout
(
)
;
.
strictEqual
(
.
,
198
)
;
.
dispose
(
)
;
}
)
;
test
(
'should constrain a right-aligned hover to the available width'
,
(
)
=>
{
const
=
createTarget
(
)
;
let
=
100
;
.
getBoundingClientRect
=
(
)
=>
new
DOMRect
(
,
100
,
50
,
20
)
;
const
=
showHover
(
'Constrained right aligned hover'
,
,
{
:
{
:
.
BELOW
,
:
.
RIGHT
,
}
,
:
{
:
true
}
}
)
;
const
=
asHoverWidget
(
)
;
.
defineProperty
(
.
,
'clientWidth'
,
{
:
true
,
get
:
(
)
=>
.
min
(
200
,
.
parseFloat
(
.
.
.
)
||
200
)
}
)
;
.
layout
(
)
;
const
=
.
.
.
;
=
300
;
.
layout
(
)
;
.
deepStrictEqual
(
{
,
:
.
.
.
}
,
{
:
'146px'
,
:
''
}
)
;
.
dispose
(
)
;
}
)
;
test
(
'should constrain scrollable content without clipping hover actions'
,
(
)
=>
{
const
=
showHover
(
'Scrollable hover'
,
undefined
,
{
:
{
:
0.25
}
,
:
[
{
:
'test.action'
,
:
'Test Action'
,
run
:
(
)
=>
{
}
}
]
}
)
;
const
=
asHoverWidget
(
)
;
const
=
.
.
querySelector < HTMLElement>
(
'.monaco-hover-content'
)
;
.
ok
(
)
;
const
=
.
.
querySelector < HTMLElement>
(
'.hover-row.status-bar'
)
;
.
ok
(
)
;
const
=
.
createElement
(
'div'
)
;
.
.
=
` ${ mainWindow. innerHeight} px `
;
.
appendChild
(
)
;
.
layout
(
)
;
const
=
` ${ mainWindow. innerHeight * 0.25 } px `
;
const
=
.
.
getBoundingClientRect
(
)
;
const
=
.
getBoundingClientRect
(
)
;
const
=
.
.
-
.
;
.
deepStrictEqual
(
{
:
.
.
.
,
:
.
.
,
:
.
>
.
,
:
.
>=
.
&&
.
<=
.
}
,
{
:
,
:
` ${ Math. max ( 0 , mainWindow. innerHeight * 0.25 - heightOutsideContents) } px `
,
:
true
,
:
true
}
)
;
.
dispose
(
)
;
}
)
;
test
(
'should not make short hover content scrollable'
,
(
)
=>
{
const
=
showHover
(
'Short hover'
,
undefined
,
{
:
{
:
0.25
}
,
:
[
{
:
'test.action'
,
:
'Test Action'
,
run
:
(
)
=>
{
}
}
]
}
)
;
const
=
asHoverWidget
(
)
.
.
querySelector < HTMLElement>
(
'.monaco-hover-content'
)
;
.
ok
(
)
;
.
deepStrictEqual
(
{
:
.
>
.
,
:
.
.
}
,
{
:
false
,
:
''
}
)
;
.
dispose
(
)
;
}
)
;
test
(
'should call onDidShow callback when hover is shown'
,
(
)
=>
{
const
=
createTarget
(
)
;
let
=
false
;
const
=
.
showInstantHover
(
{
:
'Test'
,
,
onDidShow
:
(
)
=>
{
=
true
;
}
}
)
;
.
ok
(
,
'onDidShow should be called'
)
;
.
ok
(
)
;
assertInDOM
(
,
'Hover should be in DOM after showing'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after dispose'
)
;
}
)
;
test
(
'should call onDidHide exactly once when hover is disposed'
,
(
)
=>
{
const
=
createTarget
(
)
;
let
=
0
;
const
=
.
showInstantHover
(
{
:
'Test'
,
,
onDidHide
:
(
)
=>
{
++
;
}
}
)
;
.
ok
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
.
strictEqual
(
,
1
)
;
}
)
;
test
(
'should call onDidHide when hover is hidden during onDidShow'
,
(
)
=>
{
const
=
createTarget
(
)
;
const
:
string
[
]
=
[
]
;
.
showInstantHover
(
{
:
'Test'
,
,
onDidShow
:
(
)
=>
{
.
push
(
'show'
)
;
.
hideHover
(
true
)
;
}
,
onDidHide
:
(
)
=>
{
.
push
(
'hide'
)
;
}
}
)
;
.
deepStrictEqual
(
,
[
'show'
,
'hide'
]
)
;
}
)
;
test
(
'should deduplicate hovers by id'
,
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
showInstantHover
(
{
:
'Same content'
,
,
:
'same-id'
}
)
;
const
=
.
showInstantHover
(
{
:
'Same content'
,
,
:
'same-id'
}
)
;
.
ok
(
,
'First hover should be created'
)
;
assertInDOM
(
,
'First hover should be in DOM'
)
;
.
strictEqual
(
,
undefined
,
'Second hover with same id should not be created'
)
;
const
=
.
showInstantHover
(
{
:
'Content 3'
,
,
:
'different-id'
}
)
;
.
ok
(
,
'Hover with different id should be created'
)
;
assertInDOM
(
,
'Third hover should be in DOM'
)
;
?.
dispose
(
)
;
?.
dispose
(
)
;
}
)
;
test
(
'should apply additional classes to hover DOM'
,
(
)
=>
{
const
=
showHover
(
'Test'
,
undefined
,
{
:
[
'custom-class-1'
,
'custom-class-2'
]
}
)
;
const
=
asHoverWidget
(
)
.
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
.
ok
(
.
.
contains
(
'custom-class-1'
)
,
'Should have custom-class-1'
)
;
.
ok
(
.
.
contains
(
'custom-class-2'
)
,
'Should have custom-class-2'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after dispose'
)
;
}
)
;
}
)
;
suite
(
'hideHover'
,
(
)
=>
{
test
(
'should hide non-locked hover'
,
(
)
=>
{
const
=
showHover
(
'Test'
)
;
assertInDOM
(
,
'Hover should be in DOM initially'
)
;
.
hideHover
(
)
;
.
strictEqual
(
.
,
true
,
'Hover should be disposed after hideHover'
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after hideHover'
)
;
}
)
;
test
(
'should not hide locked hover without force flag'
,
(
)
=>
{
const
=
showHover
(
'Test'
,
undefined
,
{
:
{
:
true
}
}
)
;
assertInDOM
(
,
'Locked hover should be in DOM'
)
;
.
hideHover
(
)
;
.
strictEqual
(
.
,
false
,
'Locked hover should not be disposed without force'
)
;
assertInDOM
(
,
'Locked hover should remain in DOM'
)
;
.
hideHover
(
true
)
;
.
strictEqual
(
.
,
true
,
'Locked hover should be disposed with force=true'
)
;
assertNotInDOM
(
,
'Locked hover should be removed from DOM with force'
)
;
}
)
;
test
(
'should cancel a delayed hover that has not been shown yet'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
(
.
get
(
)
as
)
.
setUserConfiguration
(
'workbench.hover.delay'
,
500
)
;
const
=
.
showDelayedHover
(
{
:
'Manage'
,
:
createTarget
(
)
}
,
{
}
)
;
.
ok
(
,
'Hover should be created'
)
;
assertNotInDOM
(
,
'Hover should not be visible before the delay elapses'
)
;
.
hideHover
(
)
;
await
timeout
(
500
)
;
assertNotInDOM
(
,
'Cancelled delayed hover should never be shown'
)
;
}
)
)
;
}
)
;
suite
(
'nested hovers'
,
(
)
=>
{
test
(
'should keep parent hover visible when nested hover is created'
,
(
)
=>
{
const
=
showHover
(
'Parent'
)
;
assertInDOM
(
,
'Parent hover should be in DOM'
)
;
const
=
createNestedHover
(
,
'Nested'
)
;
assertInDOM
(
,
'Nested hover should be in DOM'
)
;
assertInDOM
(
,
'Parent hover should still be in DOM after nested hover created'
)
;
.
strictEqual
(
.
,
false
,
'Parent hover should remain visible'
)
;
.
strictEqual
(
.
,
false
,
'Nested hover should be visible'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Nested hover should be removed from DOM after dispose'
)
;
assertInDOM
(
,
'Parent hover should remain in DOM after nested is disposed'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Parent hover should be removed from DOM after dispose'
)
;
}
)
;
test
(
'should dispose nested hover when parent is disposed'
,
(
)
=>
{
const
=
showHover
(
'Parent'
)
;
const
=
createNestedHover
(
,
'Nested'
)
;
assertInDOM
(
,
'Parent hover should be in DOM'
)
;
assertInDOM
(
,
'Nested hover should be in DOM'
)
;
.
dispose
(
)
;
.
strictEqual
(
.
,
true
,
'Nested hover should be disposed when parent is disposed'
)
;
assertNotInDOM
(
,
'Parent hover should be removed from DOM'
)
;
assertNotInDOM
(
,
'Nested hover should be removed from DOM when parent is disposed'
)
;
}
)
;
test
(
'should dispose entire hover chain when root is disposed'
,
(
)
=>
{
const
=
createHoverChain
(
3
)
;
.
strictEqual
(
.
,
3
,
'Should create 3 hovers'
)
;
for
(
let
=
0
;
<
.
;
++
)
{
.
ok
(
.
.
.
contains
(
[
]
.
)
,
` Hover ${ i + 1 } should be in DOM `
)
;
}
[
0
]
.
dispose
(
)
;
for
(
let
=
0
;
<
.
;
++
)
{
.
strictEqual
(
[
]
.
,
true
,
` Hover ${ i + 1 } should be disposed `
)
;
.
ok
(
!
.
.
.
contains
(
[
]
.
)
,
` Hover ${ i + 1 } should be removed from DOM `
)
;
}
}
)
;
test
(
'should dispose only nested hovers when middle hover is disposed'
,
(
)
=>
{
const
=
createHoverChain
(
3
)
;
.
strictEqual
(
.
,
3
,
'Should create 3 hovers'
)
;
for
(
const
of
)
{
.
ok
(
.
.
.
contains
(
.
)
,
'All hovers should be in DOM initially'
)
;
}
[
1
]
.
dispose
(
)
;
.
strictEqual
(
[
0
]
.
,
false
,
'Root hover should remain'
)
;
.
ok
(
.
.
.
contains
(
[
0
]
.
)
,
'Root hover should remain in DOM'
)
;
.
strictEqual
(
[
1
]
.
,
true
,
'Middle hover should be disposed'
)
;
.
ok
(
!
.
.
.
contains
(
[
1
]
.
)
,
'Middle hover should be removed from DOM'
)
;
.
strictEqual
(
[
2
]
.
,
true
,
'Innermost hover should be disposed'
)
;
.
ok
(
!
.
.
.
contains
(
[
2
]
.
)
,
'Innermost hover should be removed from DOM'
)
;
[
0
]
.
dispose
(
)
;
}
)
;
test
(
'should enforce maximum nesting depth'
,
(
)
=>
{
const
=
createHoverChain
(
3
)
;
.
strictEqual
(
.
,
3
,
'Should create exactly 3 hovers (max depth)'
)
;
for
(
const
of
)
{
.
ok
(
.
.
.
contains
(
.
)
,
'Hover should be in DOM'
)
;
}
const
=
.
createElement
(
'div'
)
;
[
2
]
.
.
appendChild
(
)
;
const
=
.
showInstantHover
(
{
:
'Hover 4'
,
:
}
)
;
.
strictEqual
(
,
undefined
,
'Fourth hover should not be created due to max nesting depth'
)
;
disposeHovers
(
)
;
}
)
;
test
(
'should allow new hover chain after disposing previous chain'
,
(
)
=>
{
const
=
createHoverChain
(
3
)
;
for
(
const
of
)
{
.
ok
(
.
.
.
contains
(
.
)
,
'First chain hover should be in DOM'
)
;
}
disposeHovers
(
)
;
for
(
const
of
)
{
.
ok
(
!
.
.
.
contains
(
.
)
,
'First chain hover should be removed from DOM'
)
;
}
const
=
createHoverChain
(
3
)
;
.
strictEqual
(
.
,
3
,
'Should create new chain after disposing previous'
)
;
for
(
const
of
)
{
.
ok
(
.
.
.
contains
(
.
)
,
'Second chain hover should be in DOM'
)
;
}
disposeHovers
(
)
;
}
)
;
test
(
'hideHover should close innermost hover first'
,
(
)
=>
{
const
=
createHoverChain
(
2
)
;
.
ok
(
.
.
.
contains
(
[
0
]
.
)
,
'Outer hover should be in DOM'
)
;
.
ok
(
.
.
.
contains
(
[
1
]
.
)
,
'Inner hover should be in DOM'
)
;
.
hideHover
(
)
;
.
strictEqual
(
[
1
]
.
,
true
,
'Innermost hover should be disposed'
)
;
.
ok
(
!
.
.
.
contains
(
[
1
]
.
)
,
'Innermost hover should be removed from DOM'
)
;
.
strictEqual
(
[
0
]
.
,
false
,
'Outer hover should remain'
)
;
.
ok
(
.
.
.
contains
(
[
0
]
.
)
,
'Outer hover should remain in DOM'
)
;
.
hideHover
(
)
;
.
strictEqual
(
[
0
]
.
,
true
,
'Outer hover should be disposed on second call'
)
;
.
ok
(
!
.
.
.
contains
(
[
0
]
.
)
,
'Outer hover should be removed from DOM'
)
;
}
)
;
}
)
;
suite
(
'setupDelayedHover'
,
(
)
=>
{
test
(
'should evaluate function options on mouseover'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
let
=
0
;
const
=
.
setupDelayedHover
(
,
(
)
=>
{
++
;
return
{
:
` Call ${ callCount} `
}
;
}
)
;
.
dispatchEvent
(
new
MouseEvent
(
'mouseover'
,
{
:
true
}
)
)
;
.
strictEqual
(
,
1
,
'Options function should be called on first mouseover'
)
;
await
timeout
(
0
)
;
.
hideHover
(
true
)
;
.
dispatchEvent
(
new
MouseEvent
(
'mouseover'
,
{
:
true
}
)
)
;
.
strictEqual
(
,
2
,
'Options function should be called on second mouseover'
)
;
await
timeout
(
0
)
;
.
dispose
(
)
;
.
hideHover
(
true
)
;
}
)
)
;
test
(
'should not call onDidHide when delayed hover is never shown'
,
(
)
=>
{
const
=
createTarget
(
)
;
let
=
0
;
const
=
.
setupDelayedHover
(
,
{
:
'Test'
,
onDidHide
:
(
)
=>
{
++
;
}
}
)
;
.
dispose
(
)
;
.
strictEqual
(
,
0
)
;
}
)
;
test
(
'should use reduced delay when reducedDelay is true'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
(
.
get
(
)
as
)
.
setUserConfiguration
(
'workbench.hover.reducedDelay'
,
150
)
;
const
=
.
setupDelayedHover
(
,
{
:
'Reduced delay'
}
,
{
:
true
}
)
;
.
dispatchEvent
(
new
MouseEvent
(
'mouseover'
,
{
:
true
}
)
)
;
await
timeout
(
75
)
;
const
=
.
.
querySelectorAll
(
'.monaco-hover'
)
;
.
strictEqual
(
.
,
0
,
'Hover should not be visible before delay completes'
)
;
await
timeout
(
150
)
;
const
=
.
.
querySelectorAll
(
'.monaco-hover'
)
;
.
strictEqual
(
.
,
1
,
'Hover should be visible after reduced delay'
)
;
.
dispose
(
)
;
.
hideHover
(
true
)
;
}
)
)
;
test
(
'should not show a pending hover after the target was clicked'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
(
.
get
(
)
as
)
.
setUserConfiguration
(
'workbench.hover.delay'
,
500
)
;
const
=
.
setupDelayedHover
(
,
{
:
'Manage'
}
)
;
.
dispatchEvent
(
new
MouseEvent
(
'mouseover'
,
{
:
true
}
)
)
;
.
dispatchEvent
(
new
MouseEvent
(
'click'
,
{
:
true
}
)
)
;
await
timeout
(
500
)
;
.
strictEqual
(
.
.
querySelectorAll
(
'.monaco-hover'
)
.
,
0
,
'Pending hover should be cancelled by the click'
)
;
.
dispose
(
)
;
}
)
)
;
}
)
;
suite
(
'setupManagedHover'
,
(
)
=>
{
test
(
'should use native title attribute when showNativeHover is true'
,
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
setupManagedHover
(
{
showHover
:
(
)
=>
undefined
,
:
0
,
:
true
}
,
,
'Native hover content'
)
;
.
strictEqual
(
.
getAttribute
(
'title'
)
,
'Native hover content'
)
;
.
dispose
(
)
;
.
strictEqual
(
.
getAttribute
(
'title'
)
,
null
,
'Title should be removed on dispose'
)
;
}
)
;
test
(
'should update content dynamically'
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
setupManagedHover
(
{
showHover
:
(
)
=>
undefined
,
:
0
,
:
true
}
,
,
'Initial'
)
;
.
strictEqual
(
.
getAttribute
(
'title'
)
,
'Initial'
)
;
await
.
update
(
'Updated'
)
;
.
strictEqual
(
.
getAttribute
(
'title'
)
,
'Updated'
)
;
await
.
update
(
'Final'
)
;
.
strictEqual
(
.
getAttribute
(
'title'
)
,
'Final'
)
;
.
dispose
(
)
;
}
)
;
test
(
'should update options dynamically'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
add
(
.
createInstance
(
,
'element'
,
undefined
,
{
}
)
)
;
const
=
.
add
(
.
setupManagedHover
(
,
,
'Test'
,
{
:
[
{
:
'test.first'
,
:
'First'
,
run
:
(
)
=>
{
}
}
]
}
)
)
;
await
.
update
(
'Test'
,
{
:
[
{
:
'test.second'
,
:
'Second'
,
run
:
(
)
=>
{
}
}
]
}
)
;
.
dispatchEvent
(
new
FocusEvent
(
'focus'
,
{
:
true
,
:
.
}
)
)
;
await
timeout
(
500
)
;
.
deepStrictEqual
(
[
...
.
querySelectorAll
(
'.monaco-hover .hover-row.status-bar .action-container'
)
]
.
map
(
=>
.
)
,
[
'Second'
]
)
;
}
)
)
;
test
(
'should not re-show hover on focus when relatedTarget is from a dismissed hover'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
add
(
.
createInstance
(
,
'element'
,
undefined
,
{
}
)
)
;
.
add
(
.
setupManagedHover
(
,
,
'Test'
)
)
;
.
dispatchEvent
(
new
FocusEvent
(
'focus'
,
{
:
true
,
:
.
}
)
)
;
await
timeout
(
500
)
;
const
=
.
querySelectorAll
(
'.monaco-hover'
)
;
.
ok
(
.
>
0
,
'Hover should be visible after focus'
)
;
.
hideHover
(
true
)
;
await
timeout
(
0
)
;
const
=
.
createElement
(
'div'
)
;
.
.
add
(
'monaco-hover'
)
;
.
dispatchEvent
(
new
FocusEvent
(
'focus'
,
{
:
true
,
:
}
)
)
;
await
timeout
(
500
)
;
const
=
.
querySelectorAll
(
'.monaco-hover'
)
;
.
strictEqual
(
.
,
0
,
'Hover should not re-show when focus comes from dismissed hover'
)
;
}
)
)
;
test
(
'should not re-show hover on focus when relatedTarget is null (window reactivation)'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
add
(
.
createInstance
(
,
'element'
,
undefined
,
{
}
)
)
;
.
add
(
.
setupManagedHover
(
,
,
'Test'
)
)
;
.
dispatchEvent
(
new
FocusEvent
(
'focus'
,
{
:
true
,
:
.
}
)
)
;
await
timeout
(
500
)
;
.
hideHover
(
true
)
;
await
timeout
(
0
)
;
.
dispatchEvent
(
new
FocusEvent
(
'focus'
,
{
:
true
,
:
null
}
)
)
;
await
timeout
(
500
)
;
const
=
.
querySelectorAll
(
'.monaco-hover'
)
;
.
strictEqual
(
.
,
0
,
'Hover should not re-show on window reactivation'
)
;
}
)
)
;
}
)
;
suite
(
'showDelayedHover'
,
(
)
=>
{
test
(
'should reject hover when current hover is locked and target is outside'
,
(
)
=>
{
const
=
showHover
(
'Locked'
,
undefined
,
{
:
{
:
true
}
}
)
;
assertInDOM
(
,
'Locked hover should be in DOM'
)
;
const
=
createTarget
(
)
;
const
=
.
showDelayedHover
(
{
:
'Should not show'
,
:
}
,
{
}
)
;
.
strictEqual
(
,
undefined
,
'Should reject hover when locked hover exists'
)
;
assertInDOM
(
,
'Locked hover should remain in DOM after rejection'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Locked hover should be removed from DOM after dispose'
)
;
}
)
;
test
(
'should use reduced delay when reducedDelay is true'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
100
;
(
.
get
(
)
as
)
.
setUserConfiguration
(
'workbench.hover.reducedDelay'
,
)
;
const
=
.
showDelayedHover
(
{
:
'Reduced delay hover'
,
}
,
{
:
true
}
)
;
.
ok
(
,
'Hover should be created'
)
;
assertNotInDOM
(
,
'Hover should not be visible immediately'
)
;
await
timeout
(
/
2
)
;
assertNotInDOM
(
,
'Hover should not be visible before delay completes'
)
;
await
timeout
(
)
;
assertInDOM
(
,
'Hover should be visible after reduced delay'
)
;
.
dispose
(
)
;
}
)
)
;
test
(
'should use default delay when custom delay is undefined'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
showDelayedHover
(
{
:
'Default delay hover'
,
}
,
{
}
)
;
.
ok
(
,
'Hover should be created'
)
;
await
timeout
(
0
)
;
assertInDOM
(
,
'Hover should be visible with default delay'
)
;
.
dispose
(
)
;
}
)
)
;
}
)
;
suite
(
'hover locking'
,
(
)
=>
{
test
(
'isLocked should be settable on hover widget'
,
(
)
=>
{
const
=
showHover
(
'Test'
)
;
const
=
asHoverWidget
(
)
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
.
strictEqual
(
.
,
false
,
'Should not be locked initially'
)
;
.
=
true
;
.
strictEqual
(
.
,
true
,
'Should be locked after setting'
)
;
assertInDOM
(
,
'Hover should remain in DOM after locking'
)
;
.
=
false
;
.
strictEqual
(
.
,
false
,
'Should be unlocked after unsetting'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after dispose'
)
;
}
)
;
test
(
'sticky option should set isLocked to true'
,
(
)
=>
{
const
=
showHover
(
'Test'
,
undefined
,
{
:
{
:
true
}
}
)
;
assertInDOM
(
,
'Sticky hover should be in DOM'
)
;
.
strictEqual
(
asHoverWidget
(
)
.
,
true
,
'Should be locked when sticky'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Sticky hover should be removed from DOM after dispose'
)
;
}
)
;
}
)
;
suite
(
'showAndFocusLastHover'
,
(
)
=>
{
test
(
'should recreate last disposed hover'
,
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
showInstantHover
(
{
:
'Remember me'
,
}
)
;
.
ok
(
)
;
assertInDOM
(
,
'Initial hover should be in DOM'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after dispose'
)
;
.
showAndFocusLastHover
(
)
;
const
=
.
.
querySelectorAll
(
'.monaco-hover'
)
;
.
ok
(
.
>
0
,
'A hover should be recreated and in the DOM'
)
;
.
hideHover
(
true
)
;
const
=
.
.
querySelectorAll
(
'.monaco-hover'
)
;
.
strictEqual
(
.
,
0
,
'No hovers should remain in DOM after cleanup'
)
;
}
)
;
}
)
;
suite
(
'layout and resize'
,
(
)
=>
{
test
(
'layout should suppress pending mouseout so content resize does not dismiss hover'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
createElement
(
'div'
)
;
.
=
'Resizable content'
;
const
=
.
showInstantHover
(
{
,
}
)
;
.
ok
(
)
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
const
=
asHoverWidget
(
)
;
.
.
dispatchEvent
(
new
MouseEvent
(
'mouseleave'
,
{
:
true
}
)
)
;
.
layout
(
)
;
await
timeout
(
300
)
;
assertInDOM
(
,
'Hover should remain in DOM after layout suppresses mouseout'
)
;
.
dispose
(
)
;
assertNotInDOM
(
,
'Hover should be removed from DOM after dispose'
)
;
}
)
)
;
.
skip
(
'hover should still dismiss on mouseout when no layout occurs'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
createElement
(
'div'
)
;
.
=
'Content'
;
const
=
.
showInstantHover
(
{
,
}
)
;
.
ok
(
)
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
const
=
asHoverWidget
(
)
;
.
.
dispatchEvent
(
new
MouseEvent
(
'mouseleave'
,
{
:
true
}
)
)
;
await
timeout
(
300
)
;
assertNotInDOM
(
,
'Hover should be dismissed after mouseout without layout'
)
;
}
)
)
;
.
skip
(
'suppression clears after mouse re-enters and a new mouseleave dismisses normally'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
createElement
(
'div'
)
;
.
=
'Resizable content'
;
const
=
.
showInstantHover
(
{
,
}
)
;
.
ok
(
)
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
const
=
asHoverWidget
(
)
;
.
.
dispatchEvent
(
new
MouseEvent
(
'mouseleave'
,
{
:
true
}
)
)
;
.
layout
(
)
;
await
timeout
(
300
)
;
assertInDOM
(
,
'Hover should remain after suppressed mouseout'
)
;
.
.
dispatchEvent
(
new
MouseEvent
(
'mouseover'
,
{
:
true
}
)
)
;
.
.
dispatchEvent
(
new
MouseEvent
(
'mouseleave'
,
{
:
true
}
)
)
;
await
timeout
(
300
)
;
assertNotInDOM
(
,
'Hover should dismiss on normal mouseout after suppression was cleared'
)
;
}
)
)
;
test
(
'clicking outside should dismiss non-sticky hover'
,
(
)
=>
runWithFakedTimers
(
{
:
true
}
,
async
(
)
=>
{
const
=
createTarget
(
)
;
const
=
.
createElement
(
'div'
)
;
.
=
'Content'
;
const
=
.
showInstantHover
(
{
,
}
)
;
.
ok
(
)
;
assertInDOM
(
,
'Hover should be in DOM'
)
;
.
dispatchEvent
(
new
MouseEvent
(
'mousedown'
,
{
:
true
}
)
)
;
assertNotInDOM
(
,
'Non-sticky hover should be dismissed after clicking outside'
)
;
}
)
)
;
}
)
;
}
)
;