Skip to content

Commit e3271b8

Browse files
committed
catch transitionOnLoad
1 parent 81b3ecd commit e3271b8

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict'
2+
3+
var chalk = require('chalk')
4+
5+
module.exports = {
6+
pattern: /\btransitionOnLoad\b/,
7+
warning: function (match) {
8+
return {
9+
reason: 'This option is no longer necessary now that Vue\'s transition system has explicit appear transition control',
10+
fix: (
11+
'Remove the ' + chalk.red('transitionOnLoad') + ' option'
12+
),
13+
docsHash: 'transitionOnLoad-deprecated'
14+
}
15+
}
16+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict'
2+
3+
const check = createRuleChecker('vue-router/transition-on-load')
4+
5+
describe('Rule: transition-on-load', () => {
6+
it('does not match an empty line', () => {
7+
const warning = check('')
8+
expect(warning).toBe(null)
9+
})
10+
11+
it('does not match "transition"', () => {
12+
const warning = check('routes')
13+
expect(warning).toBe(null)
14+
})
15+
16+
it('does not match "transition on load"', () => {
17+
const warning = check('routes')
18+
expect(warning).toBe(null)
19+
})
20+
21+
it('matches "transitionOnLoad"', () => {
22+
const warning = check('transitionOnLoad')
23+
expect(warning).toBeTruthy()
24+
expect(warning.fix).toBe('arst')
25+
})
26+
27+
it('matches "transitionOnLoad:"', () => {
28+
const warning = check(`
29+
transitionOnLoad:
30+
`)
31+
expect(warning).toBeTruthy()
32+
expect(warning.fix).toBe('arst')
33+
})
34+
35+
it('matches "transitionOnLoad :"', () => {
36+
const warning = check(`
37+
transitionOnLoad :
38+
`)
39+
expect(warning).toBeTruthy()
40+
expect(warning.fix).toBe('arst')
41+
})
42+
})

0 commit comments

Comments
 (0)