mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-01-02 09:33:33 +00:00
test ✅: add comprehensive test suite for CSS ordering rules
Add tests for all three CSS property ordering rules:
alphabetical-order,
concentric-order,
custom-order,
Tests cover all implemented vanilla-extract APIs, fontFace, globalFontFace, globalKeyframes, globalStyle, keyframes, style, and styleVariants.. Each test verifies both valid and invalid cases, along with proper auto-fixing functionality.
This commit is contained in:
parent
3e9bad1b02
commit
5f1e602dee
25 changed files with 3635 additions and 24 deletions
58
src/css-rules/concentric-order/__tests__/global.test.ts
Normal file
58
src/css-rules/concentric-order/__tests__/global.test.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import tsParser from '@typescript-eslint/parser';
|
||||
import { run } from 'eslint-vitest-rule-tester';
|
||||
import concentricOrderRule from '../rule-definition.js';
|
||||
|
||||
run({
|
||||
name: 'vanilla-extract/concentric-order/global',
|
||||
rule: concentricOrderRule,
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
parserOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
valid: [
|
||||
// globalStyle with concentric ordering
|
||||
`
|
||||
import { globalStyle } from '@vanilla-extract/css';
|
||||
|
||||
globalStyle('body', {
|
||||
position: 'relative',
|
||||
display: 'block',
|
||||
margin: 0,
|
||||
backgroundColor: 'white',
|
||||
padding: 0,
|
||||
color: 'black'
|
||||
});
|
||||
`,
|
||||
],
|
||||
invalid: [
|
||||
// globalStyle with incorrect ordering
|
||||
{
|
||||
code: `
|
||||
import { globalStyle } from '@vanilla-extract/css';
|
||||
globalStyle('body', {
|
||||
color: 'black',
|
||||
margin: 0,
|
||||
backgroundColor: 'white',
|
||||
padding: 0,
|
||||
display: 'block',
|
||||
position: 'relative'
|
||||
});
|
||||
`,
|
||||
errors: [{ messageId: 'incorrectOrder' }],
|
||||
output: `
|
||||
import { globalStyle } from '@vanilla-extract/css';
|
||||
globalStyle('body', {
|
||||
position: 'relative',
|
||||
display: 'block',
|
||||
margin: 0,
|
||||
backgroundColor: 'white',
|
||||
padding: 0,
|
||||
color: 'black'
|
||||
});
|
||||
`,
|
||||
},
|
||||
],
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue