File tree 2 files changed +34
-2
lines changed
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) {
14
14
removeClass
15
15
} = Vue . util
16
16
17
+ const onPriority = Vue . directive ( 'on' ) . priority
18
+
17
19
Vue . directive ( 'link-active' , {
18
- priority : 1001 ,
20
+ priority : onPriority - 1 ,
19
21
bind ( ) {
20
22
this . el . __v_link_active = true
21
23
}
22
24
} )
23
25
24
26
Vue . directive ( 'link' , {
25
- priority : 1000 ,
27
+ priority : onPriority - 2 ,
26
28
27
29
bind ( ) {
28
30
const vm = this . vm
Original file line number Diff line number Diff line change @@ -597,6 +597,36 @@ describe('Core', function () {
597
597
} )
598
598
} )
599
599
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
+
600
630
it ( 'alias' , function ( done ) {
601
631
router = new Router ( { abstract : true } )
602
632
router . map ( {
You can’t perform that action at this time.
0 commit comments