diff --git a/rules/properties-order/tests/empty-line-before-unspecified.js b/rules/properties-order/tests/empty-line-before-unspecified.js index eb7a77e..c991e9b 100644 --- a/rules/properties-order/tests/empty-line-before-unspecified.js +++ b/rules/properties-order/tests/empty-line-before-unspecified.js @@ -61,11 +61,57 @@ testRule(rule, { } `, }, + { + description: '6', + code: ` + a { + height: 20px; + /* other props */ + font-style: italic; + } + `, + }, + { + description: '7', + code: ` + a { + height: 20px; + + /* other props */ + font-style: italic; + } + `, + }, + { + description: '8', + code: ` + a { + height: 20px; + width: 20px; + + b { + font-style: italic; + } + } + `, + }, + { + description: '9', + code: ` + a { + height: 20px; + width: 20px; + b { + font-style: italic; + } + } + `, + }, ], reject: [ { - description: '6', + description: '10', code: ` a { height: 20px; @@ -86,7 +132,7 @@ testRule(rule, { message: messages.expectedEmptyLineBefore('font-style'), }, { - description: '7', + description: '11', code: ` a { height: 20px; @@ -105,7 +151,7 @@ testRule(rule, { message: messages.expectedEmptyLineBefore('font-style'), }, { - description: '8', + description: '12', code: ` a { height: 20px; @@ -121,8 +167,68 @@ testRule(rule, { `, message: messages.expectedEmptyLineBefore('font-style'), }, + ], +}); + +testRule(rule, { + ruleName, + config: [ + ['height', 'width'], { - description: '9', + unspecified: 'bottom', + emptyLineBeforeUnspecified: 'never', + }, + ], + fix: true, + + accept: [ + { + description: '13', + code: ` + a { + height: 20px; + + width: 20px; + font-style: italic; + } + `, + }, + { + description: '14', + code: ` + a { + height: 20px; + width: 20px; + font-style: italic; + } + `, + }, + { + description: '15', + code: ` + a { + height: 20px; + font-style: italic; + } + `, + }, + { + description: '16', + code: ` + a { + font-style: italic; + } + `, + }, + { + description: '17', + code: ` + a { + } + `, + }, + { + description: '18', code: ` a { height: 20px; @@ -130,7 +236,10 @@ testRule(rule, { font-style: italic; } `, - fixed: ` + }, + { + description: '19', + code: ` a { height: 20px; @@ -138,7 +247,91 @@ testRule(rule, { font-style: italic; } `, - message: messages.expectedEmptyLineBefore('undefined'), + }, + { + description: '20', + code: ` + a { + height: 20px; + width: 20px; + + b { + font-style: italic; + } + } + `, + }, + { + description: '21', + code: ` + a { + height: 20px; + width: 20px; + b { + font-style: italic; + } + } + `, + }, + ], + + reject: [ + { + description: '22', + code: ` + a { + height: 20px; + + width: 20px; + + font-style: italic; + } + `, + fixed: ` + a { + height: 20px; + + width: 20px; + font-style: italic; + } + `, + message: messages.rejectedEmptyLineBefore('font-style'), + }, + { + description: '23', + code: ` + a { + height: 20px; + width: 20px; + + font-style: italic; + } + `, + fixed: ` + a { + height: 20px; + width: 20px; + font-style: italic; + } + `, + message: messages.rejectedEmptyLineBefore('font-style'), + }, + { + description: '24', + code: ` + a { + height: 20px; + + font-style: italic; + } + `, + fixed: ` + a { + height: 20px; + font-style: italic; + } + `, + message: messages.rejectedEmptyLineBefore('font-style'), }, ], });