Skip to content

Commit 37c7542

Browse files
Make tests more strict
Based on vuejs#2878.
1 parent 79b608c commit 37c7542

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

tests/lib/rules/no-v-html.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,55 @@ ruleTester.run('no-v-html', rule, {
3939
{
4040
filename: 'test.vue',
4141
code: '<template><div v-html="foo"></div></template>',
42-
errors: ["'v-html' directive can lead to XSS attack."]
42+
errors: [
43+
{
44+
message: "'v-html' directive can lead to XSS attack.",
45+
line: 1,
46+
column: 16,
47+
endLine: 1,
48+
endColumn: 28
49+
}
50+
]
4351
},
4452
{
4553
filename: 'test.vue',
4654
code: '<template><ul v-html:aaa="userHTML"></ul></template>',
47-
errors: ["'v-html' directive can lead to XSS attack."]
55+
errors: [
56+
{
57+
message: "'v-html' directive can lead to XSS attack.",
58+
line: 1,
59+
column: 15,
60+
endLine: 1,
61+
endColumn: 36
62+
}
63+
]
4864
},
4965
{
5066
filename: 'test.vue',
5167
code: '<template><section v-html/></template>',
52-
errors: ["'v-html' directive can lead to XSS attack."]
68+
errors: [
69+
{
70+
message: "'v-html' directive can lead to XSS attack.",
71+
line: 1,
72+
column: 20,
73+
endLine: 1,
74+
endColumn: 26
75+
}
76+
]
5377
},
5478
{
5579
filename: 'test.vue',
5680
code: '<template><div v-html="unsafeString"></div></template>',
5781
options: [{ ignorePattern: '.Html$' }],
58-
errors: ["'v-html' directive can lead to XSS attack."]
82+
errors: [
83+
{
84+
message: "'v-html' directive can lead to XSS attack.",
85+
line: 1,
86+
column: 16,
87+
endLine: 1,
88+
endColumn: 37
89+
}
90+
]
5991
}
6092
]
6193
})

0 commit comments

Comments
 (0)