@@ -309,6 +309,74 @@ describe('Notification.Basic', () => {
309
309
expect ( document . querySelector ( '.test' ) ) . toBeFalsy ( ) ;
310
310
} ) ;
311
311
312
+ describe ( 'pauseOnHover is false' , ( ) => {
313
+ it ( 'does not freeze when pauseOnHover is false' , ( ) => {
314
+ const { instance } = renderDemo ( ) ;
315
+
316
+ act ( ( ) => {
317
+ instance . open ( {
318
+ content : (
319
+ < p id = "not-freeze" className = "not-freeze" >
320
+ not freeze
321
+ </ p >
322
+ ) ,
323
+ duration : 0.3 ,
324
+ pauseOnHover : false ,
325
+ } ) ;
326
+ } ) ;
327
+
328
+ expect ( document . querySelectorAll ( '.not-freeze' ) ) . toHaveLength ( 1 ) ;
329
+
330
+ // Mouse in should remove
331
+ fireEvent . mouseEnter ( document . querySelector ( '.rc-notification-notice' ) ) ;
332
+ act ( ( ) => {
333
+ vi . runAllTimers ( ) ;
334
+ } ) ;
335
+ expect ( document . querySelectorAll ( '.not-freeze' ) ) . toHaveLength ( 0 ) ;
336
+ } ) ;
337
+
338
+ it ( 'continue timing after hover' , ( ) => {
339
+ const { instance } = renderDemo ( {
340
+ duration : 1 ,
341
+ pauseOnHover : false ,
342
+ } ) ;
343
+
344
+ act ( ( ) => {
345
+ instance . open ( {
346
+ content : < p className = "test" > 1</ p > ,
347
+ } ) ;
348
+ } ) ;
349
+
350
+ expect ( document . querySelector ( '.test' ) ) . toBeTruthy ( ) ;
351
+
352
+ // Wait for 500ms
353
+ act ( ( ) => {
354
+ vi . advanceTimersByTime ( 500 ) ;
355
+ } ) ;
356
+ expect ( document . querySelector ( '.test' ) ) . toBeTruthy ( ) ;
357
+
358
+ // Mouse in should not remove
359
+ fireEvent . mouseEnter ( document . querySelector ( '.rc-notification-notice' ) ) ;
360
+ act ( ( ) => {
361
+ vi . advanceTimersByTime ( 200 ) ;
362
+ } ) ;
363
+ expect ( document . querySelector ( '.test' ) ) . toBeTruthy ( ) ;
364
+
365
+ // Mouse out should not remove until 500ms later
366
+ fireEvent . mouseLeave ( document . querySelector ( '.rc-notification-notice' ) ) ;
367
+ act ( ( ) => {
368
+ vi . advanceTimersByTime ( 200 ) ;
369
+ } ) ;
370
+ expect ( document . querySelector ( '.test' ) ) . toBeTruthy ( ) ;
371
+
372
+ //
373
+ act ( ( ) => {
374
+ vi . advanceTimersByTime ( 100 ) ;
375
+ } ) ;
376
+ expect ( document . querySelector ( '.test' ) ) . toBeFalsy ( ) ;
377
+ } ) ;
378
+ } ) ;
379
+
312
380
describe ( 'maxCount' , ( ) => {
313
381
it ( 'remove work when maxCount set' , ( ) => {
314
382
const { instance } = renderDemo ( {
0 commit comments