Skip to content

Commit e419479

Browse files
committed
fix tests to match style guide recommendations
1 parent 8b90b4a commit e419479

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

tests/lib/rules/html-self-closing.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const anyWith = (opts) => Object.assign(
5454
tester.run('html-self-closing', rule, {
5555
valid: [
5656
// default
57-
'<template><div></div></template>',
57+
'<template><div/></template>',
5858
'<template><img></template>',
5959
'<template><x-test/></template>',
6060
'<template><svg><path/></svg></template>',
@@ -72,9 +72,9 @@ tester.run('html-self-closing', rule, {
7272
invalid: [
7373
// default
7474
{
75-
code: '<template><div/></template>',
76-
output: '<template><div></div></template>',
77-
errors: ['Disallow self-closing on HTML elements (<div/>).']
75+
code: '<template><div></div></template>',
76+
output: '<template><div/></template>',
77+
errors: ['Require self-closing on HTML elements (<div>).']
7878
},
7979
{
8080
code: '<template><img/></template>',

tests/lib/rules/max-attributes-per-line.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,32 @@ ruleTester.run('max-attributes-per-line', rule, {
2626
code: `<template><component></component></template>`
2727
},
2828
{
29-
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`
29+
code: `<template><component
30+
name="John Doe"
31+
age="30"
32+
job="Vet"
33+
></component></template>`
3034
},
3135
{
32-
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
36+
code: `<template><component
37+
name="John Doe"
38+
age="30"
39+
job="Vet"
40+
></component></template>`,
3341
options: [{ multiline: { allowFirstLine: true }}]
3442
},
3543
{
3644
code: `<template><component
3745
name="John Doe"
38-
age="30">
39-
</component>
40-
</template>`
46+
age="30"
47+
>
48+
</component></template>`
4149
},
4250
{
4351
code: `<template><component
4452
name="John Doe"
4553
age="30">
46-
</component>
54+
</component>
4755
</template>`,
4856
options: [{ singleline: 1 }]
4957
},
@@ -82,8 +90,8 @@ ruleTester.run('max-attributes-per-line', rule, {
8290

8391
invalid: [
8492
{
85-
code: `<template><component name="John Doe" age="30" job="Vet" petname="Snoopy"></component></template>`,
86-
errors: ['Attribute "petname" should be on a new line.']
93+
code: `<template><component name="John Doe" age="30"></component></template>`,
94+
errors: ['Attribute "age" should be on a new line.']
8795
},
8896
{
8997
code: `<template><component job="Vet"
@@ -98,10 +106,10 @@ ruleTester.run('max-attributes-per-line', rule, {
98106
}]
99107
},
100108
{
101-
code: `<template><component name="John Doe" age="30"></component></template>`,
102-
options: [{ singleline: { max: 1 }}],
109+
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
110+
options: [{ singleline: { max: 2 }}],
103111
errors: [{
104-
message: 'Attribute "age" should be on a new line.',
112+
message: 'Attribute "job" should be on a new line.',
105113
type: 'VAttribute',
106114
line: 1
107115
}]

tests/lib/rules/order-in-components.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ ruleTester.run('order-in-components', rule, {
106106
filename: 'test.js',
107107
code: `
108108
new Vue({
109+
el: '#app',
109110
name: 'app',
110111
components: {},
111-
el: '#app',
112112
data () {
113113
return {
114114
msg: 'Welcome to Your Vue.js App'
@@ -199,9 +199,6 @@ ruleTester.run('order-in-components', rule, {
199199
errors: [{
200200
message: 'The "components" property should be above the "data" property on line 4.',
201201
line: 9
202-
}, {
203-
message: 'The "template" property should be above the "data" property on line 4.',
204-
line: 10
205202
}]
206203
},
207204
{
@@ -223,17 +220,14 @@ ruleTester.run('order-in-components', rule, {
223220
errors: [{
224221
message: 'The "components" property should be above the "data" property on line 5.',
225222
line: 10
226-
}, {
227-
message: 'The "template" property should be above the "data" property on line 5.',
228-
line: 11
229223
}]
230224
},
231225
{
232226
filename: 'test.js',
233227
code: `
234228
new Vue({
235-
el: '#app',
236229
name: 'app',
230+
el: '#app',
237231
data () {
238232
return {
239233
msg: 'Welcome to Your Vue.js App'
@@ -245,14 +239,11 @@ ruleTester.run('order-in-components', rule, {
245239
`,
246240
parserOptions: { ecmaVersion: 6 },
247241
errors: [{
248-
message: 'The "name" property should be above the "el" property on line 3.',
242+
message: 'The "el" property should be above the "name" property on line 3.',
249243
line: 4
250244
}, {
251-
message: 'The "components" property should be above the "el" property on line 3.',
245+
message: 'The "components" property should be above the "data" property on line 5.',
252246
line: 10
253-
}, {
254-
message: 'The "template" property should be above the "data" property on line 5.',
255-
line: 11
256247
}]
257248
},
258249
{

0 commit comments

Comments
 (0)