Skip to content

Commit 21075b4

Browse files
committed
Updated multiline example and added a few more
1 parent 18a3597 commit 21075b4

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

tests/lib/rules/no-literals.js

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,35 @@ eslintTester.addRuleTest('lib/rules/no-literals', {
6565
].join('\n'),
6666
args: [1],
6767
parser: 'babel-eslint'
68+
}, {
69+
code: [
70+
'class Comp1 extends Component {',
71+
' render() {',
72+
' return (',
73+
' <div>',
74+
' {\'asdjfl\'}',
75+
' {\'test\'}',
76+
' {\'foo\'}',
77+
' </div>',
78+
' );',
79+
' }',
80+
'}'
81+
].join('\n'),
82+
args: [1],
83+
parser: 'babel-eslint'
84+
}, {
85+
code: [
86+
'class Comp1 extends Component {',
87+
' render() {',
88+
' return (',
89+
' <div>',
90+
' </div>',
91+
' );',
92+
' }',
93+
'}'
94+
].join('\n'),
95+
args: [1],
96+
parser: 'babel-eslint'
6897
}
6998
],
7099

@@ -147,11 +176,24 @@ eslintTester.addRuleTest('lib/rules/no-literals', {
147176
].join('\n'),
148177
args: [1],
149178
parser: 'babel-eslint',
150-
errors: [
151-
{message: 'Missing JSX expression container around literal string'},
152-
{message: 'Missing JSX expression container around literal string'},
153-
{message: 'Missing JSX expression container around literal string'}
154-
]
179+
errors: [{message: 'Missing JSX expression container around literal string'}]
180+
}, {
181+
code: [
182+
'class Comp1 extends Component {',
183+
' render() {',
184+
' return (',
185+
' <div>',
186+
' {\'asdjfl\'}',
187+
' test',
188+
' {\'foo\'}',
189+
' </div>',
190+
' );',
191+
' }',
192+
'}'
193+
].join('\n'),
194+
args: [1],
195+
parser: 'babel-eslint',
196+
errors: [{message: 'Missing JSX expression container around literal string'}]
155197
}
156198
]
157199
});

0 commit comments

Comments
 (0)