Skip to content

Commit fcf8e1c

Browse files
committed
add test case for comment order
1 parent 2006336 commit fcf8e1c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/lib/rules/sort-styles.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,48 @@ const tests = {
324324
},
325325
],
326326
},
327+
{
328+
code: `
329+
const styles = StyleSheet.create({
330+
a: {
331+
d: 4,
332+
// comments
333+
c: 3,
334+
a: 1,
335+
b: 2,
336+
},
337+
d: {},
338+
c: {},
339+
// comments
340+
b: {
341+
a: 1,
342+
b: 2,
343+
},
344+
})
345+
`,
346+
output: `
347+
const styles = StyleSheet.create({
348+
a: {
349+
a: 1,
350+
b: 2,
351+
// comments
352+
c: 3,
353+
d: 4,
354+
},
355+
// comments
356+
b: {
357+
a: 1,
358+
b: 2,
359+
},
360+
c: {},
361+
d: {},
362+
})
363+
`,
364+
errors: [
365+
{ message: "Expected style properties to be in ascending order. 'c' should be before 'd'." },
366+
{ message: "Expected class names to be in ascending order. 'c' should be before 'd'." },
367+
],
368+
},
327369
],
328370
};
329371

0 commit comments

Comments
 (0)