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
See also:
#648 (comment)
  • Loading branch information
Andreas Opferkuch committed Sep 6, 2017
1 parent f1e86b5 commit 8715216
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/lib/rules/jsx-curly-spacing.js
Expand Up @@ -2118,5 +2118,81 @@ 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>{ /* 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 8715216

Please sign in to comment.