Skip to content

Commit f8cb3a2

Browse files
committed
chore: fix lint
1 parent dccd182 commit f8cb3a2

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

test/unit/modules/compiler/compiler-options.spec.js

+43-43
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,58 @@ describe('compile options', () => {
99
<input type="text" v-model="msg" required max="8" v-validate:field1.group1.group2>
1010
</div>
1111
`, {
12-
directives: {
13-
validate (el, dir) {
14-
if (dir.name === 'validate' && dir.arg) {
15-
el.validate = {
16-
field: dir.arg,
17-
groups: dir.modifiers ? Object.keys(dir.modifiers) : []
12+
directives: {
13+
validate (el, dir) {
14+
if (dir.name === 'validate' && dir.arg) {
15+
el.validate = {
16+
field: dir.arg,
17+
groups: dir.modifiers ? Object.keys(dir.modifiers) : []
18+
}
1819
}
1920
}
20-
}
21-
},
22-
modules: [{
23-
transformNode (el) {
24-
el.validators = el.validators || []
25-
const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
26-
validators.forEach(name => {
27-
const rule = getAndRemoveAttr(el, name)
28-
if (rule !== undefined) {
29-
el.validators.push({ name, rule })
30-
}
31-
})
3221
},
33-
genData (el) {
34-
let data = ''
35-
if (el.validate) {
36-
data += `validate:${JSON.stringify(el.validate)},`
37-
}
38-
if (el.validators) {
39-
data += `validators:${JSON.stringify(el.validators)},`
40-
}
41-
return data
42-
},
43-
transformCode (el, code) {
44-
// check
45-
if (!el.validate || !el.validators) {
46-
return code
47-
}
48-
// setup validation result props
49-
const result = { dirty: false } // define something other prop
50-
el.validators.forEach(validator => {
51-
result[validator.name] = null
52-
})
53-
// generate code
54-
return `_c('validate',{props:{
22+
modules: [{
23+
transformNode (el) {
24+
el.validators = el.validators || []
25+
const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
26+
validators.forEach(name => {
27+
const rule = getAndRemoveAttr(el, name)
28+
if (rule !== undefined) {
29+
el.validators.push({ name, rule })
30+
}
31+
})
32+
},
33+
genData (el) {
34+
let data = ''
35+
if (el.validate) {
36+
data += `validate:${JSON.stringify(el.validate)},`
37+
}
38+
if (el.validators) {
39+
data += `validators:${JSON.stringify(el.validators)},`
40+
}
41+
return data
42+
},
43+
transformCode (el, code) {
44+
// check
45+
if (!el.validate || !el.validators) {
46+
return code
47+
}
48+
// setup validation result props
49+
const result = { dirty: false } // define something other prop
50+
el.validators.forEach(validator => {
51+
result[validator.name] = null
52+
})
53+
// generate code
54+
return `_c('validate',{props:{
5555
field:${JSON.stringify(el.validate.field)},
5656
groups:${JSON.stringify(el.validate.groups)},
5757
validators:${JSON.stringify(el.validators)},
5858
result:${JSON.stringify(result)},
5959
child:${code}}
6060
})`
61-
}
62-
}]
63-
})
61+
}
62+
}]
63+
})
6464
expect(render).not.toBeUndefined()
6565
expect(staticRenderFns).toEqual([])
6666
expect(errors).toEqual([])

0 commit comments

Comments
 (0)