Skip to content

Commit

Permalink
csscomb#387: Fix space-after-opening-brace for empty media queries
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyganch committed May 23, 2015
1 parent 7940b30 commit d6d69a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/options/space-after-opening-brace.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ module.exports = {

var value = this.getValue('space-after-opening-brace');

if (node.first().is('space')) {
if (node.first() &&
node.first().is('space')) {
node.first().content = value;
} else if (value !== '') {
var space = gonzales.createNode({ type: 'space', content: value });
Expand Down
1 change: 1 addition & 0 deletions test/options/space-after-opening-brace/issue-387.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@media only screen (max-width:479px) {}
2 changes: 2 additions & 0 deletions test/options/space-after-opening-brace/issue-387.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@media only screen (max-width:479px) {
}
5 changes: 5 additions & 0 deletions test/options/space-after-opening-brace/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ describe('options/space-after-opening-brace:', function() {
this.shouldBeEqual('test.css', 'test-3.expected.css');
});

it('Issue 387', function() {
this.comb.configure({ 'space-after-opening-brace': '\n' });
this.shouldBeEqual('issue-387.css', 'issue-387.expected.css');
});

it('Should detect no whitespace', function() {
this.shouldDetect(
['space-after-opening-brace'],
Expand Down

0 comments on commit d6d69a9

Please sign in to comment.