Skip to content

Commit

Permalink
Added tests for jsx-curly-spacing that deal with comments in children.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Opferkuch authored and ljharb committed Dec 20, 2017
1 parent a908eb3 commit 655bf07
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/lib/rules/jsx-curly-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,40 @@ ruleTester.run('jsx-curly-spacing', rule, {
}, {
message: 'A space is required before \'}\''
}]
}, {
code: [
'<App>',
'{ /* comment */ }',
'</App>;'
].join('\n'),
output: [
'<App>',
'{/* comment */}',
'</App>;'
].join('\n'),
options: [{when: 'never', children: true}],
errors: [{
message: 'There should be no space after \'{\''
}, {
message: 'There should be no space before \'}\''
}]
}, {
code: [
'<App>',
'{/* comment */}',
'</App>;'
].join('\n'),
output: [
'<App>',
'{ /* comment */ }',
'</App>;'
].join('\n'),
options: [{when: 'always', children: true}],
errors: [{
message: 'A space is required after \'{\''
}, {
message: 'A space is required before \'}\''
}]
}, {
code: [
'<App>',
Expand Down Expand Up @@ -2180,5 +2214,47 @@ ruleTester.run('jsx-curly-spacing', rule, {
errors: [{
message: 'There should be no newline after \'{\''
}]
}, {
code: [
'<App>{ /* comment */',
'bar',
'} {',
'baz',
'/* comment */ }</App>;'
].join('\n'),
output: [
'<App>{/* comment */',
'bar',
'} {',
'baz',
'/* comment */}</App>;'
].join('\n'),
options: [{when: 'never', children: true}],
errors: [{
message: 'There should be no space after \'{\''
}, {
message: 'There should be no space before \'}\''
}]
}, {
code: [
'<App>{/* comment */',
'bar',
'} {',
'baz',
'/* comment */}</App>;'
].join('\n'),
output: [
'<App>{ /* comment */',
'bar',
'} {',
'baz',
'/* comment */ }</App>;'
].join('\n'),
options: [{when: 'always', children: true}],
errors: [{
message: 'A space is required after \'{\''
}, {
message: 'A space is required before \'}\''
}]
}]
});

0 comments on commit 655bf07

Please sign in to comment.