Skip to content

Commit cc503b3

Browse files
committed
add tests using the default parser
1 parent 1c6ac4e commit cc503b3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ ruleTester.run('jsx-no-literals', rule, {
126126
`,
127127
parser: 'babel-eslint',
128128
options: ['no-strings']
129+
}, {
130+
code: `
131+
<Foo bar="test">
132+
{intl.formatText(message)}
133+
</Foo>
134+
`,
135+
options: ['no-strings']
136+
}, {
137+
code: `
138+
<Foo bar="test">
139+
{translate('my.translate.key')}
140+
</Foo>
141+
`,
142+
options: ['no-strings']
129143
}
130144
],
131145

@@ -228,6 +242,14 @@ ruleTester.run('jsx-no-literals', rule, {
228242
parser: 'babel-eslint',
229243
options: ['no-strings'],
230244
errors: [{message: 'Strings not allowed in JSX files'}]
245+
}, {
246+
code: `
247+
<Foo bar="test">
248+
{'Test'}
249+
</Foo>
250+
`,
251+
options: ['no-strings'],
252+
errors: [{message: 'Strings not allowed in JSX files'}]
231253
}, {
232254
code: `
233255
<Foo bar="test">
@@ -237,6 +259,14 @@ ruleTester.run('jsx-no-literals', rule, {
237259
parser: 'babel-eslint',
238260
options: ['no-strings'],
239261
errors: [{message: 'Strings not allowed in JSX files'}]
262+
}, {
263+
code: `
264+
<Foo bar="test">
265+
Test
266+
</Foo>
267+
`,
268+
options: ['no-strings'],
269+
errors: [{message: 'Strings not allowed in JSX files'}]
240270
}
241271
]
242272
});

0 commit comments

Comments
 (0)