Skip to content

Commit 16899b8

Browse files
author
Barzilay, Oshri (ob143h)
committed
fix tests
1 parent dae95cc commit 16899b8

File tree

3 files changed

+149
-96
lines changed

3 files changed

+149
-96
lines changed

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

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const tests = {
3737
export default class MyComponent extends Component {
3838
render() {
3939
const isDanger = true;
40-
return <View
40+
return <View
4141
style={[styles.style1, isDanger ? styles.style1 : styles.style2]}
4242
/>;
4343
}
@@ -57,11 +57,11 @@ const tests = {
5757
export default class MyComponent extends Component {
5858
render() {
5959
const trueColor = '#fff';
60-
const falseColor = '#000'
61-
return <View
62-
style={[style1,
63-
this.state.isDanger && {color: falseColor},
64-
{color: someBoolean ? trueColor : falseColor }]}
60+
const falseColor = '#000'
61+
return <View
62+
style={[style1,
63+
this.state.isDanger && {color: falseColor},
64+
{color: someBoolean ? trueColor : falseColor }]}
6565
/>;
6666
}
6767
}
@@ -79,9 +79,11 @@ const tests = {
7979
}
8080
});
8181
`,
82-
errors: [{
83-
message: 'Color literal: { backgroundColor: \'#FFFFFF\' }',
84-
}],
82+
errors: [
83+
{
84+
message: "Color literal: { backgroundColor: '#FFFFFF' }",
85+
},
86+
],
8587
},
8688
{
8789
code: `
@@ -93,9 +95,11 @@ const tests = {
9395
}
9496
});
9597
`,
96-
errors: [{
97-
message: 'Color literal: { backgroundColor: \'#FFFFFF\' }',
98-
}],
98+
errors: [
99+
{
100+
message: "Color literal: { backgroundColor: '#FFFFFF' }",
101+
},
102+
],
99103
},
100104
{
101105
code: `
@@ -110,9 +114,11 @@ const tests = {
110114
}
111115
});
112116
`,
113-
errors: [{
114-
message: 'Color literal: { fontColor: \'#000\' }',
115-
}],
117+
errors: [
118+
{
119+
message: "Color literal: { fontColor: '#000' }",
120+
},
121+
],
116122
},
117123
{
118124
code: `
@@ -124,24 +130,28 @@ const tests = {
124130
}
125131
});
126132
`,
127-
errors: [{
128-
message: 'Color literal: { backgroundColor: \'#FFFFFF\' }',
129-
}],
133+
errors: [
134+
{
135+
message: "Color literal: { backgroundColor: '#FFFFFF' }",
136+
},
137+
],
130138
},
131139
{
132140
code: `
133141
const Hello = React.createClass({
134142
render: function() {
135-
const someBoolean = false;
143+
const someBoolean = false;
136144
return <Text style={[styles.text, someBoolean && {backgroundColor: '#FFFFFF'}]}>
137145
Hello {this.props.name}
138146
</Text>;
139147
}
140148
});
141149
`,
142-
errors: [{
143-
message: 'Color literal: { backgroundColor: \'#FFFFFF\' }',
144-
}],
150+
errors: [
151+
{
152+
message: "Color literal: { backgroundColor: '#FFFFFF' }",
153+
},
154+
],
145155
},
146156
{
147157
code: `
@@ -156,23 +166,23 @@ const tests = {
156166
});
157167
export default class MyComponent extends Component {
158168
render() {
159-
return <View
160-
style={[style1,
161-
this.state.isDanger && styles.style1,
162-
{backgroundColor: someBoolean ? '#fff' : '#000'}]}
169+
return <View
170+
style={[style1,
171+
this.state.isDanger && styles.style1,
172+
{backgroundColor: someBoolean ? '#fff' : '#000'}]}
163173
/>;
164174
}
165175
}
166176
`,
167177
errors: [
168178
{
169-
message: 'Color literal: { color: \'red\' }',
179+
message: "Color literal: { color: 'red' }",
170180
},
171181
{
172-
message: 'Color literal: { borderBottomColor: \'blue\' }',
182+
message: "Color literal: { borderBottomColor: 'blue' }",
173183
},
174184
{
175-
message: 'Color literal: { backgroundColor: \'someBoolean ? \\\'#fff\\\' : \\\'#000\\\'\' }', //eslint-disable-line
185+
message: `Color literal: { backgroundColor: "someBoolean ? '#fff' : '#000'" }`, //eslint-disable-line
176186
},
177187
],
178188
},

tests/lib/rules/no-inline-styles.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ const tests = {
5656
});
5757
export default class MyComponent extends Component {
5858
render() {
59-
const trueColor = '#fff'; const falseColor = '#000'
60-
return <View
61-
style={[style1,
62-
this.state.isDanger && styles.style1,
63-
{color: someBoolean ? trueColor : falseColor }]}
59+
const trueColor = '#fff'; const falseColor = '#000'
60+
return <View
61+
style={[style1,
62+
this.state.isDanger && styles.style1,
63+
{color: someBoolean ? trueColor : falseColor }]}
6464
/>;
6565
}
6666
}
@@ -154,7 +154,7 @@ const tests = {
154154
code: `
155155
const Hello = React.createClass({
156156
render: function() {
157-
const someBoolean = false;
157+
const someBoolean = false;
158158
return <Text style={[styles.text, someBoolean && {backgroundColor: '#FFFFFF'}]}>
159159
Hello {this.props.name}
160160
</Text>;
@@ -177,16 +177,16 @@ const tests = {
177177
});
178178
export default class MyComponent extends Component {
179179
render() {
180-
return <View
181-
style={[style1,
182-
this.state.isDanger && styles.style1,
183-
{backgroundColor: someBoolean ? '#fff' : '#000'}]}
180+
return <View
181+
style={[style1,
182+
this.state.isDanger && styles.style1,
183+
{backgroundColor: someBoolean ? '#fff' : '#000'}]}
184184
/>;
185185
}
186186
}
187187
`,
188188
errors: [{
189-
message: 'Inline style: { backgroundColor: \'someBoolean ? \\\'#fff\\\' : \\\'#000\\\'\' }', //eslint-disable-line
189+
message: `Inline style: { backgroundColor: "someBoolean ? '#fff' : '#000'" }`, //eslint-disable-line
190190
}],
191191
},
192192
],

0 commit comments

Comments
 (0)