File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ export default (history, done) => {
2323
2424 history . push ( '../other/path?another=query#another-hash' ) ;
2525
26- expect ( spy ) . toHaveBeenCalled ( ) ;
26+ expect ( spy ) . toHaveBeenCalledWith (
27+ expect . stringContaining ( 'relative pathnames are not supported' )
28+ ) ;
2729
2830 destroy ( ) ;
2931 } ,
Original file line number Diff line number Diff line change @@ -599,10 +599,6 @@ export function createHashHistory(
599599 return parsePath ( pathname . replace ( '/' , hashRoot ) ) ;
600600 }
601601
602- function validateLocation ( { pathname} ) {
603- return pathname === parsePathOutput ( pathname )
604- }
605-
606602 function getIndexAndLocation ( ) : [ number , Location ] {
607603 let {
608604 pathname = '/' ,
@@ -752,8 +748,8 @@ export function createHashHistory(
752748 }
753749
754750 warning (
755- validateLocation ( nextLocation ) ,
756- `Locations must start with " ${ hashRoot } " in hash history.push(${ JSON . stringify (
751+ nextLocation . pathname . charAt ( 0 ) === '/' ,
752+ `Relative pathnames are not supported in hash history.push(${ JSON . stringify (
757753 to
758754 ) } )`
759755 ) ;
@@ -783,8 +779,8 @@ export function createHashHistory(
783779 }
784780
785781 warning (
786- validateLocation ( nextLocation ) ,
787- `Locations must start with " ${ hashRoot } " in hash history.replace(${ JSON . stringify (
782+ nextLocation . pathname . charAt ( 0 ) === '/' ,
783+ `Relative pathnames are not supported in hash history.replace(${ JSON . stringify (
788784 to
789785 ) } )`
790786 ) ;
You can’t perform that action at this time.
0 commit comments