File tree 3 files changed +43
-1
lines changed
3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ var chalk = require ( 'chalk' )
4
+
5
+ module . exports = {
6
+ pattern : / \b v - l i n k - a c t i v e \b / ,
7
+ warning : function ( match ) {
8
+ return {
9
+ reason : 'Active route classes are now handled through the <router-link> component' ,
10
+ fix : (
11
+ 'Replace ' + chalk . red ( match ) + ' with the new <router-link> component with a custom tag (see link below for details)'
12
+ ) ,
13
+ docsHash : 'v-link-active-deprecated'
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const check = createRuleChecker ( 'vue-router/v-link-active' )
4
+
5
+ describe ( 'Rule: v-link-active' , ( ) => {
6
+ it ( 'does not match an empty line' , ( ) => {
7
+ const warning = check ( '' )
8
+ expect ( warning ) . toBe ( null )
9
+ } )
10
+
11
+ it ( 'matches a simple v-link-active' , ( ) => {
12
+ const warning = check ( `
13
+ <li v-link-active>
14
+ ` )
15
+ expect ( warning ) . toBeTruthy ( )
16
+ expect ( warning . fix ) . toBe ( 'Replace v-link-active with the new <router-link> component with a custom tag (see link below for details)' )
17
+ } )
18
+
19
+ it ( 'matches a v-link-active with other attributes' , ( ) => {
20
+ const warning = check ( `
21
+ <li data-foo="bar" v-link-active class="baz">
22
+ ` )
23
+ expect ( warning ) . toBeTruthy ( )
24
+ expect ( warning . fix ) . toBe ( 'Replace v-link-active with the new <router-link> component with a custom tag (see link below for details)' )
25
+ } )
26
+ } )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module.exports = {
6
6
pattern : / \b v - l i n k = (?: ' [ ^ ' ] + ' | " [ ^ " ] + " ) / ,
7
7
warning : function ( match ) {
8
8
return {
9
- reason : 'The v-link attribute has been replaced with the new <router-link> component' ,
9
+ reason : 'The v-link directive has been replaced with the new <router-link> component' ,
10
10
fix : (
11
11
'Replace ' + chalk . red ( match ) + ' with the new <router-link> component (see link below for details)'
12
12
) ,
You can’t perform that action at this time.
0 commit comments