Skip to content

Commit f27ebc2

Browse files
committed
jsx-no-literals Add tests combining literals and strings
1 parent 2ae8d5e commit f27ebc2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/lib/rules/jsx-no-literals.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,35 @@ ruleTester.run('jsx-no-literals', rule, {
323323
code: '<Foo bar={`Test`} />',
324324
options: [{noStrings: true}],
325325
errors: [{message: 'Strings not allowed in JSX files'}]
326+
}, {
327+
code: '<Foo bar={`${baz}`} />',
328+
options: [{noStrings: true}],
329+
errors: [{message: 'Strings not allowed in JSX files'}]
330+
}, {
331+
code: '<Foo bar={`Test ${baz}`} />',
332+
options: [{noStrings: true}],
333+
errors: [{message: 'Strings not allowed in JSX files'}]
334+
}, {
335+
code: '<Foo bar={`foo` + \'bar\'} />',
336+
options: [{noStrings: true}],
337+
errors: [
338+
{message: 'Strings not allowed in JSX files'},
339+
{message: 'Strings not allowed in JSX files'}
340+
]
341+
}, {
342+
code: '<Foo bar={`foo` + `bar`} />',
343+
options: [{noStrings: true}],
344+
errors: [
345+
{message: 'Strings not allowed in JSX files'},
346+
{message: 'Strings not allowed in JSX files'}
347+
]
348+
}, {
349+
code: '<Foo bar={\'foo\' + `bar`} />',
350+
options: [{noStrings: true}],
351+
errors: [
352+
{message: 'Strings not allowed in JSX files'},
353+
{message: 'Strings not allowed in JSX files'}
354+
]
326355
}
327356
]
328357
});

0 commit comments

Comments
 (0)