File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,17 @@ export default function (Vue) {
1414 removeClass
1515 } = Vue . util
1616
17+ const onPriority = Vue . directive ( 'on' ) . priority
18+
1719 Vue . directive ( 'link-active' , {
18- priority : 1001 ,
20+ priority : onPriority - 1 ,
1921 bind ( ) {
2022 this . el . __v_link_active = true
2123 }
2224 } )
2325
2426 Vue . directive ( 'link' , {
25- priority : 1000 ,
27+ priority : onPriority - 2 ,
2628
2729 bind ( ) {
2830 const vm = this . vm
Original file line number Diff line number Diff line change @@ -597,6 +597,36 @@ describe('Core', function () {
597597 } )
598598 } )
599599
600+ it ( 'v-link with v-on' , function ( done ) {
601+ router = new Router ( { abstract : true } )
602+ router . map ( {
603+ '/a' : {
604+ component : {
605+ template : '<div>foo</div>'
606+ }
607+ }
608+ } )
609+ var spy = jasmine . createSpy ( 'v-on:click' )
610+ var App = Vue . extend ( {
611+ replace : false ,
612+ template :
613+ '<a id="link-a" v-link="{ path: \'/a\' }" v-on:click="onClick"></a>' +
614+ '<router-view></router-view>' ,
615+ methods : {
616+ onClick : spy
617+ }
618+ } )
619+ router . start ( App , el )
620+ el = router . app . $el
621+ expect ( el . textContent ) . toBe ( '' )
622+ click ( el . querySelector ( '#link-a' ) )
623+ nextTick ( function ( ) {
624+ expect ( spy ) . toHaveBeenCalled ( )
625+ expect ( el . textContent ) . toBe ( 'foo' )
626+ done ( )
627+ } )
628+ } )
629+
600630 it ( 'alias' , function ( done ) {
601631 router = new Router ( { abstract : true } )
602632 router . map ( {
You can’t perform that action at this time.
0 commit comments