@@ -261,6 +261,37 @@ describe('d2l-tooltip', () => {
261
261
await oneEvent ( tooltipFixture , 'd2l-tooltip-show' ) ;
262
262
expect ( tooltip . showing ) . to . be . true ;
263
263
} ) ;
264
+
265
+ it ( 'should show second tooltip without delay after hovering over first tooltip for greater than delay' , async ( ) => {
266
+ const doubleTooltipFixture = html `
267
+ < div >
268
+ < button id ="explicit-target1 "> Hover me for tips</ button >
269
+ < d2l-tooltip for ="explicit-target1 " for-type ="descriptor "> If I got a problem then a problem's got a problem.</ d2l-tooltip >
270
+ < button id ="explicit-target2 "> Hover me for tips</ button >
271
+ < d2l-tooltip for ="explicit-target2 " for-type ="descriptor "> There might be another problem.</ d2l-tooltip >
272
+ </ div >
273
+ ` ;
274
+
275
+ const testFixture = await fixture ( doubleTooltipFixture ) ;
276
+
277
+ const target1 = testFixture . querySelector ( '#explicit-target1' ) ;
278
+ const target2 = testFixture . querySelector ( '#explicit-target2' ) ;
279
+
280
+ const tooltips = testFixture . querySelectorAll ( 'd2l-tooltip' ) ;
281
+ const tooltip1 = tooltips [ 0 ] ;
282
+ const tooltip2 = tooltips [ 1 ] ;
283
+
284
+ // display tooltip 1 then leave
285
+ target1 . dispatchEvent ( new Event ( 'mouseenter' ) ) ;
286
+ await oneEvent ( testFixture , 'd2l-tooltip-show' ) ;
287
+ expect ( tooltip1 . showing ) . to . be . true ;
288
+ target1 . dispatchEvent ( new Event ( 'mouseleave' ) ) ;
289
+
290
+ // don't wait delay, enter target2, tooltip 2 should show without having to wait for delay
291
+ target2 . dispatchEvent ( new Event ( 'mouseenter' ) ) ;
292
+ await aTimeout ( tooltip . delay / 2 ) ;
293
+ expect ( tooltip2 . showing ) . to . be . true ;
294
+ } ) ;
264
295
} ) ;
265
296
266
297
describe ( 'force-show' , ( ) => {
0 commit comments