cover base array sorting in alphabetical and custom order rules

This commit is contained in:
seongminn 2026-03-21 17:36:04 +09:00
parent 248e403a74
commit 0bd37dd744
2 changed files with 93 additions and 0 deletions

View file

@ -36,6 +36,18 @@ run({
}
});
`,
// Recipe with base as array (ComplexStyleRule)
`
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
alignItems: 'center',
display: 'flex'
}],
});
`,
],
invalid: [
// Recipe with incorrect ordering
@ -88,5 +100,28 @@ run({
});
`,
},
// Recipe with base array in incorrect order
{
code: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
display: 'flex',
alignItems: 'center'
}],
});
`,
errors: [{ messageId: 'alphabeticalOrder' }],
output: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
alignItems: 'center',
display: 'flex'
}],
});
`,
},
],
});

View file

@ -88,6 +88,29 @@ run({
},
],
},
// Recipe with base as array (ComplexStyleRule)
{
code: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
width: '100%',
margin: 0,
display: 'flex',
alignItems: 'center',
backgroundColor: 'white'
}],
});
`,
options: [
{
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
sortRemainingProperties: 'concentric',
},
],
},
],
invalid: [
// Recipe with incorrect ordering (concentric for remaining)
@ -207,5 +230,40 @@ run({
});
`,
},
// Recipe with base array in incorrect order
{
code: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
backgroundColor: 'white',
width: '100%',
display: 'flex',
alignItems: 'center',
margin: 0
}],
});
`,
options: [
{
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
sortRemainingProperties: 'concentric',
},
],
errors: [{ messageId: 'incorrectOrder' }],
output: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
width: '100%',
margin: 0,
display: 'flex',
alignItems: 'center',
backgroundColor: 'white'
}],
});
`,
},
],
});