File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,7 @@ async function factory(
369
369
options : { } as Partial < RouterOptions > ,
370
370
resolve : jest . fn ( ) ,
371
371
push : jest . fn ( ) . mockResolvedValue ( resolvedLocation ) ,
372
+ replace : jest . fn ( ) . mockResolvedValue ( resolvedLocation ) ,
372
373
}
373
374
router . resolve . mockReturnValueOnce ( resolvedLocation )
374
375
@@ -799,6 +800,16 @@ describe('RouterLink', () => {
799
800
expect ( router . push ) . toHaveBeenCalledTimes ( 1 )
800
801
} )
801
802
803
+ it ( 'calls router.replace when clicked with replace prop' , async ( ) => {
804
+ const { router, wrapper } = await factory (
805
+ START_LOCATION_NORMALIZED ,
806
+ { to : locations . basic . string , replace : true } ,
807
+ locations . basic . normalized
808
+ )
809
+ wrapper . find ( 'a' ) ! . trigger ( 'click' )
810
+ expect ( router . replace ) . toHaveBeenCalledTimes ( 1 )
811
+ } )
812
+
802
813
it ( 'calls router.push with the correct ___location for aliases' , async ( ) => {
803
814
const { router, wrapper } = await factory (
804
815
START_LOCATION_NORMALIZED ,
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
132
132
type : [ String , Object ] as PropType < RouteLocationRaw > ,
133
133
required : true ,
134
134
} ,
135
+ replace : Boolean ,
135
136
activeClass : String ,
136
137
// inactiveClass: String,
137
138
exactActiveClass : String ,
You can’t perform that action at this time.
0 commit comments