@@ -458,8 +458,17 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
458458 } ) ;
459459
460460 // Navigate to a matching path - determine URL format based on routing mode
461- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
462- location . url . href = shouldUseHash ? "http://example.com/#/user/123" : "http://example.com/user/123" ;
461+ const url = ( ( ) => {
462+ if ( hash === false ) return "http://example.com/user/123" ; // Path routing
463+ if ( hash === true ) return "http://example.com/#/user/123" ; // Single hash routing
464+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/user/123` ; // Multi-hash routing
465+ // Implicit routing
466+ if ( ru . defaultHash === false ) return "http://example.com/user/123" ; // Implicit path routing
467+ if ( ru . defaultHash === true ) return "http://example.com/#/user/123" ; // Implicit single hash routing
468+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/user/123` ; // Implicit multi-hash routing
469+ return "http://example.com/user/123" ; // Default to path routing
470+ } ) ( ) ;
471+ location . url . href = url ;
463472 await vi . waitFor ( ( ) => { } ) ;
464473
465474 // Assert.
@@ -494,8 +503,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
494503 } ) ;
495504
496505 // Navigate to a matching path - determine URL format based on routing mode
497- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
498- location . url . href = shouldUseHash ? "http://example.com/#/about" : "http://example.com/about" ;
506+ const url = ( ( ) => {
507+ if ( hash === false ) return "http://example.com/about" ;
508+ if ( hash === true ) return "http://example.com/#/about" ;
509+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/about` ;
510+ if ( ru . defaultHash === false ) return "http://example.com/about" ;
511+ if ( ru . defaultHash === true ) return "http://example.com/#/about" ;
512+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/about` ;
513+ return "http://example.com/about" ;
514+ } ) ( ) ;
515+ location . url . href = url ;
499516 await vi . waitFor ( ( ) => { } ) ;
500517
501518 // Assert.
@@ -524,8 +541,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
524541 } ) ;
525542
526543 // Navigate to a non-matching path - determine URL format based on routing mode
527- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
528- location . url . href = shouldUseHash ? "http://example.com/#/other" : "http://example.com/other" ;
544+ const url = ( ( ) => {
545+ if ( hash === false ) return "http://example.com/other" ;
546+ if ( hash === true ) return "http://example.com/#/other" ;
547+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/other` ;
548+ if ( ru . defaultHash === false ) return "http://example.com/other" ;
549+ if ( ru . defaultHash === true ) return "http://example.com/#/other" ;
550+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/other` ;
551+ return "http://example.com/other" ;
552+ } ) ( ) ;
553+ location . url . href = url ;
529554 await vi . waitFor ( ( ) => { } ) ;
530555
531556 // Assert.
@@ -552,8 +577,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
552577 } ) ;
553578
554579 // Navigate to first matching path - determine URL format based on routing mode
555- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
556- location . url . href = shouldUseHash ? "http://example.com/#/user/123" : "http://example.com/user/123" ;
580+ const url = ( ( ) => {
581+ if ( hash === false ) return "http://example.com/user/123" ;
582+ if ( hash === true ) return "http://example.com/#/user/123" ;
583+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/user/123` ;
584+ if ( ru . defaultHash === false ) return "http://example.com/user/123" ;
585+ if ( ru . defaultHash === true ) return "http://example.com/#/user/123" ;
586+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/user/123` ;
587+ return "http://example.com/user/123" ;
588+ } ) ( ) ;
589+ location . url . href = url ;
557590 await vi . waitFor ( ( ) => { } ) ;
558591
559592 const firstParams = capturedParams ;
@@ -567,7 +600,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
567600 expect ( firstParams ) . toEqual ( { id : 123 } ) ; // Number due to auto-conversion
568601
569602 // Act - Navigate to different matching path
570- location . url . href = shouldUseHash ? "http://example.com/#/user/456" : "http://example.com/user/456" ;
603+ const url2 = ( ( ) => {
604+ if ( hash === false ) return "http://example.com/user/456" ;
605+ if ( hash === true ) return "http://example.com/#/user/456" ;
606+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/user/456` ;
607+ if ( ru . defaultHash === false ) return "http://example.com/user/456" ;
608+ if ( ru . defaultHash === true ) return "http://example.com/#/user/456" ;
609+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/user/456` ;
610+ return "http://example.com/user/456" ;
611+ } ) ( ) ;
612+ location . url . href = url2 ;
571613 await vi . waitFor ( ( ) => { } ) ;
572614
573615 // Assert.
@@ -595,8 +637,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
595637 } ) ;
596638
597639 // Navigate to a matching path - determine URL format based on routing mode
598- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
599- location . url . href = shouldUseHash ? "http://example.com/#/user/123/post/456" : "http://example.com/user/123/post/456" ;
640+ const url = ( ( ) => {
641+ if ( hash === false ) return "http://example.com/user/123/post/456" ;
642+ if ( hash === true ) return "http://example.com/#/user/123/post/456" ;
643+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/user/123/post/456` ;
644+ if ( ru . defaultHash === false ) return "http://example.com/user/123/post/456" ;
645+ if ( ru . defaultHash === true ) return "http://example.com/#/user/123/post/456" ;
646+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/user/123/post/456` ;
647+ return "http://example.com/user/123/post/456" ;
648+ } ) ( ) ;
649+ location . url . href = url ;
600650 await vi . waitFor ( ( ) => { } ) ;
601651
602652 // Assert.
@@ -631,8 +681,16 @@ function routeBindingTestsForUniverse(setup: ReturnType<typeof createRouterTestS
631681 } ) ;
632682
633683 // Navigate to a matching path - determine URL format based on routing mode
634- const shouldUseHash = ( ru . defaultHash === true ) || ( hash === true ) || ( typeof hash === 'string' ) ;
635- location . url . href = shouldUseHash ? "http://example.com/#/files/documents/readme.txt" : "http://example.com/files/documents/readme.txt" ;
684+ const url = ( ( ) => {
685+ if ( hash === false ) return "http://example.com/files/documents/readme.txt" ;
686+ if ( hash === true ) return "http://example.com/#/files/documents/readme.txt" ;
687+ if ( typeof hash === 'string' ) return `http://example.com/#${ hash } =/files/documents/readme.txt` ;
688+ if ( ru . defaultHash === false ) return "http://example.com/files/documents/readme.txt" ;
689+ if ( ru . defaultHash === true ) return "http://example.com/#/files/documents/readme.txt" ;
690+ if ( typeof ru . defaultHash === 'string' ) return `http://example.com/#${ ru . defaultHash } =/files/documents/readme.txt` ;
691+ return "http://example.com/files/documents/readme.txt" ;
692+ } ) ( ) ;
693+ location . url . href = url ;
636694 await vi . waitFor ( ( ) => { } ) ;
637695
638696 // Assert.
0 commit comments