Skip to content

test(no-duplicate-attributes): make tests more strict #2888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 54 additions & 6 deletions tests/lib/rules/no-duplicate-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,84 @@ tester.run('no-duplicate-attributes', rule, {
{
filename: 'test.vue',
code: '<template><div><div foo v-bind:foo></div></div></template>',
errors: ["Duplicate attribute 'foo'."]
errors: [
{
message: "Duplicate attribute 'foo'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 35
}
]
},
{
filename: 'test.vue',
code: '<template><div><div foo :foo></div></div></template>',
errors: ["Duplicate attribute 'foo'."]
errors: [
{
message: "Duplicate attribute 'foo'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 29
}
]
},
{
filename: 'test.vue',
code: '<template><div><div style :style></div></div></template>',
options: [{ allowCoexistStyle: false }],
errors: ["Duplicate attribute 'style'."]
errors: [
{
message: "Duplicate attribute 'style'.",
line: 1,
column: 27,
endLine: 1,
endColumn: 33
}
]
},
{
filename: 'test.vue',
code: '<template><div><div class :class></div></div></template>',
options: [{ allowCoexistClass: false }],
errors: ["Duplicate attribute 'class'."]
errors: [
{
message: "Duplicate attribute 'class'.",
line: 1,
column: 27,
endLine: 1,
endColumn: 33
}
]
},
{
filename: 'test.vue',
code: '<template><div><div :style style></div></div></template>',
options: [{ allowCoexistStyle: false }],
errors: ["Duplicate attribute 'style'."]
errors: [
{
message: "Duplicate attribute 'style'.",
line: 1,
column: 28,
endLine: 1,
endColumn: 33
}
]
},
{
filename: 'test.vue',
code: '<template><div><div :class class></div></div></template>',
options: [{ allowCoexistClass: false }],
errors: ["Duplicate attribute 'class'."]
errors: [
{
message: "Duplicate attribute 'class'.",
line: 1,
column: 28,
endLine: 1,
endColumn: 33
}
]
}
]
})