Skip to content

Commit 016f2be

Browse files
committed
Rewrite jsx-no-bind tests with template literals
1 parent 2ad18b0 commit 016f2be

File tree

1 file changed

+71
-71
lines changed

1 file changed

+71
-71
lines changed

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

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -71,49 +71,49 @@ ruleTester.run('jsx-no-bind', rule, {
7171

7272
// Redux connect
7373
{
74-
code: [
75-
'class Hello extends Component {',
76-
' render() {',
77-
' return <div>Hello</div>;',
78-
' }',
79-
'}',
80-
'export default connect()(Hello);'
81-
].join('\n'),
74+
code: `
75+
class Hello extends Component {
76+
render() {
77+
return <div>Hello</div>;
78+
}
79+
}
80+
export default connect()(Hello);
81+
`,
8282
options: [{allowBind: true}],
8383
parser: 'babel-eslint'
8484
},
8585
// Backbone view with a bind
8686
{
87-
code: [
88-
'var DocumentRow = Backbone.View.extend({',
89-
' tagName: "li",',
90-
' render: function() {',
91-
' this.onTap.bind(this);',
92-
' }',
93-
'});'
94-
].join('\n'),
87+
code: `
88+
var DocumentRow = Backbone.View.extend({
89+
tagName: "li",
90+
render: function() {
91+
this.onTap.bind(this);
92+
}
93+
});
94+
`,
9595
parser: 'babel-eslint'
9696
},
9797
{
98-
code: [
99-
'const foo = {',
100-
' render: function() {',
101-
' this.onTap.bind(this);',
102-
' return true;',
103-
' }',
104-
'};'
105-
].join('\n'),
98+
code: `
99+
const foo = {
100+
render: function() {
101+
this.onTap.bind(this);
102+
return true;
103+
}
104+
};
105+
`,
106106
parser: 'babel-eslint'
107107
},
108108
{
109-
code: [
110-
'const foo = {',
111-
' render() {',
112-
' this.onTap.bind(this);',
113-
' return true;',
114-
' }',
115-
'};'
116-
].join('\n'),
109+
code: `
110+
const foo = {
111+
render() {
112+
this.onTap.bind(this);
113+
return true;
114+
}
115+
};
116+
`,
117117
parser: 'babel-eslint'
118118
}
119119
],
@@ -141,61 +141,61 @@ ruleTester.run('jsx-no-bind', rule, {
141141
parser: 'babel-eslint'
142142
},
143143
{
144-
code: [
145-
'var Hello = createReactClass({',
146-
' render: function() {',
147-
' const click = this.someMethod.bind(this);',
148-
' return <div onClick={click}>Hello {this.state.name}</div>;',
149-
' }',
150-
'});'
151-
].join('\n'),
144+
code: `
145+
var Hello = createReactClass({
146+
render: function() {
147+
const click = this.someMethod.bind(this);
148+
return <div onClick={click}>Hello {this.state.name}</div>;
149+
}
150+
});
151+
`,
152152
errors: [{message: 'JSX props should not use .bind()'}],
153153
parser: 'babel-eslint'
154154
},
155155
{
156-
code: [
157-
'class Hello23 extends React.Component {',
158-
' render() {',
159-
' const click = this.someMethod.bind(this);',
160-
' return <div onClick={click}>Hello {this.state.name}</div>;',
161-
' }',
162-
'};'
163-
].join('\n'),
156+
code: `
157+
class Hello23 extends React.Component {
158+
render() {
159+
const click = this.someMethod.bind(this);
160+
return <div onClick={click}>Hello {this.state.name}</div>;
161+
}
162+
};
163+
`,
164164
errors: [{message: 'JSX props should not use .bind()'}],
165165
parser: 'babel-eslint'
166166
},
167167
{
168-
code: [
169-
'const foo = {',
170-
' render: function() {',
171-
' const click = this.onTap.bind(this);',
172-
' return <div onClick={onClick}>Hello</div>;',
173-
' }',
174-
'};'
175-
].join('\n'),
168+
code: `
169+
const foo = {
170+
render: function() {
171+
const click = this.onTap.bind(this);
172+
return <div onClick={onClick}>Hello</div>;
173+
}
174+
};
175+
`,
176176
errors: [{message: 'JSX props should not use .bind()'}],
177177
parser: 'babel-eslint'
178178
},
179179
{
180-
code: [
181-
'const foo = {',
182-
' render: ({onClick}) => (',
183-
' <div onClick={onClick.bind(this)}>Hello</div>',
184-
' )',
185-
'};'
186-
].join('\n'),
180+
code: `
181+
const foo = {
182+
render: ({onClick}) => (
183+
<div onClick={onClick.bind(this)}>Hello</div>
184+
)
185+
};
186+
`,
187187
errors: [{message: 'JSX props should not use .bind()'}],
188188
parser: 'babel-eslint'
189189
},
190190
{
191-
code: [
192-
'const foo = {',
193-
' render() {',
194-
' const click = this.onTap.bind(this);',
195-
' return <div onClick={onClick}>Hello</div>;',
196-
' }',
197-
'};'
198-
].join('\n'),
191+
code: `
192+
const foo = {
193+
render() {
194+
const click = this.onTap.bind(this);
195+
return <div onClick={onClick}>Hello</div>;
196+
}
197+
};
198+
`,
199199
errors: [{message: 'JSX props should not use .bind()'}],
200200
parser: 'babel-eslint'
201201
},

0 commit comments

Comments
 (0)