Skip to content
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
124 changes: 110 additions & 14 deletions tests/lib/rules/array-bracket-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,70 +39,166 @@ tester.run('array-bracket-spacing', rule, {
{
code: '<template><div :attr="[ a]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: ["There should be no space after '['."]
errors: [
{
message: "There should be no space after '['.",
line: 1,
column: 24,
endLine: 1,
endColumn: 25
}
]
},
{
code: '<template><div :attr="[a ]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: ["There should be no space before ']'."]
errors: [
{
message: "There should be no space before ']'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 26
}
]
},
{
code: '<template><div :attr="[ a ]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: [
"There should be no space after '['.",
"There should be no space before ']'."
{
message: "There should be no space after '['.",
line: 1,
column: 24,
endLine: 1,
endColumn: 25
},
{
message: "There should be no space before ']'.",
line: 1,
column: 26,
endLine: 1,
endColumn: 27
}
]
},
{
code: '<template><div :attr="[ a]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: ["There should be no space after '['."]
errors: [
{
message: "There should be no space after '['.",
line: 1,
column: 24,
endLine: 1,
endColumn: 25
}
]
},
{
code: '<template><div :attr="[a ]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: ["There should be no space before ']'."]
errors: [
{
message: "There should be no space before ']'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 26
}
]
},
{
code: '<template><div :attr="[ a ]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: [
"There should be no space after '['.",
"There should be no space before ']'."
{
message: "There should be no space after '['.",
line: 1,
column: 24,
endLine: 1,
endColumn: 25
},
{
message: "There should be no space before ']'.",
line: 1,
column: 26,
endLine: 1,
endColumn: 27
}
]
},
{
code: '<template><div :attr="[ a]" /></template>',
output: '<template><div :attr="[ a ]" /></template>',
options: ['always'],
errors: ["A space is required before ']'."]
errors: [
{
message: "A space is required before ']'.",
line: 1,
column: 26,
endLine: 1,
endColumn: 27
}
]
},
{
code: '<template><div :attr="[a ]" /></template>',
output: '<template><div :attr="[ a ]" /></template>',
options: ['always'],
errors: ["A space is required after '['."]
errors: [
{
message: "A space is required after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
}
]
},
{
code: '<template><div :attr="[a]" /></template>',
output: '<template><div :attr="[ a ]" /></template>',
options: ['always'],
errors: [
"A space is required after '['.",
"A space is required before ']'."
{
message: "A space is required after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
},
{
message: "A space is required before ']'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 26
}
]
},
{
code: '<template><div :[[attr]]="[a]" /></template>',
output: '<template><div :[[attr]]="[ a ]" /></template>',
options: ['always'],
errors: [
"A space is required after '['.",
"A space is required before ']'."
{
message: "A space is required after '['.",
line: 1,
column: 27,
endLine: 1,
endColumn: 28
},
{
message: "A space is required before ']'.",
line: 1,
column: 29,
endLine: 1,
endColumn: 30
}
]
}
]
Expand Down