Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions lib/__tests__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@ test(`Should throw an error if config has error`, () => {
order: 'Justice Rains From Above',
};

const pluginRun = postcss([plugin(opts)])
.process('', { from: undefined })
.then(() => {
expect('Plugin should throw an error').toBeFalst();
})
.catch((err) => {
throw err;
});

expect(pluginRun).rejects.toBeTruthy();
return expect(postcss([plugin(opts)]).process('', { from: undefined })).rejects.toThrow(
'postcss-sorting: order: Should be an array'
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a {
Border: red;
align-content: center;
font-family: sans-serif;
Display: block;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a {
align-content: center;
Border: red;
Display: block;
font-family: sans-serif;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
div {
position: fixed;
top: 0;
Top: 0;
}

div {
position: fixed;
Top: 0;
top: 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
div {
position: fixed;
top: 0;
Top: 0;
}

div {
position: fixed;
Top: 0;
top: 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.header {
Padding-bottom: 20px;
Justify-content: space-between;
display: -webkit-box;
Display: -ms-flexbox;
display: flex;
Align-items: center;
flex-wrap: wrap;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.header {
Align-items: center;
display: -webkit-box;
Display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
Justify-content: space-between;
Padding-bottom: 20px;
}
28 changes: 28 additions & 0 deletions lib/properties-order/__tests__/properties-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ test('Should preserve order if properties have same name', () =>
__dirname
));

test('Should preserve order if properties have same name (case insensitive)', () =>
runTest(
'properties-have-same-name-4',
{
'properties-order': ['position', 'z-index'],
},
__dirname
));

test('Should preserve order if properties have same name (case insensitive)', () =>
runTest(
'properties-have-same-name-5',
{
'properties-order': 'alphabetical',
},
__dirname
));

test(`Should not remove first comment in the rule if it's not on separate line (properties-order)`, () =>
runTest(
'first-comment-in-the-rule',
Expand Down Expand Up @@ -145,6 +163,16 @@ test('Should sort properties alphabetically', () =>
__dirname
));

test('Should sort properties alphabetically regardless of case', () => {
runTest(
'properties-alphabetical-case-insensitive',
{
'properties-order': 'alphabetical',
},
__dirname
);
});

test('Should sort shorthand properties before their longhand versions', () =>
runTest(
'properties-alphabetical-shorthand',
Expand Down
2 changes: 1 addition & 1 deletion lib/properties-order/sortNodeProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function sortNodeProperties(node, { order, unspecifiedPropertie
isStandardSyntaxProperty(childNode.prop) &&
!isCustomProperty(childNode.prop)
) {
let unprefixedPropName = vendor.unprefixed(childNode.prop);
let unprefixedPropName = vendor.unprefixed(childNode.prop).toLowerCase();

// Hack to allow -moz-osx-font-smoothing to be understood
// just like -webkit-font-smoothing
Expand Down
Loading