Skip to content

Commit 9e13485

Browse files
committed
test(rules/sort-styles): Add some tests
1 parent 2ce8369 commit 9e13485

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/lib/rules/sort-styles.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,41 @@ const tests = {
154154
message: 'Expected class names to be in ascending order. \'a\' should be before \'b\'.',
155155
}],
156156
},
157+
{
158+
code: `
159+
const styles = StyleSheet.create({
160+
'b': {},
161+
'a': {},
162+
})
163+
`,
164+
errors: [{
165+
message: 'Expected class names to be in ascending order. \'a\' should be before \'b\'.',
166+
}],
167+
},
168+
{
169+
code: `
170+
const styles = StyleSheet.create({
171+
['b']: {},
172+
[\`a\`]: {},
173+
})
174+
`,
175+
errors: [{
176+
message: 'Expected class names to be in ascending order. \'a\' should be before \'b\'.',
177+
}],
178+
},
179+
{
180+
code: `
181+
const a = 'a';
182+
const b = 'b';
183+
const styles = StyleSheet.create({
184+
[\`\${a}-\${b}-b\`]: {},
185+
[\`a-\${b}-a\`]: {},
186+
})
187+
`,
188+
errors: [{
189+
message: 'Expected class names to be in ascending order. \'a-b-a\' should be before \'a-b-b\'.',
190+
}],
191+
},
157192
],
158193
};
159194

0 commit comments

Comments
 (0)