Skip to content

Commit 1c2cbbe

Browse files
author
Adam Simpson
committed
fix: account for one line atrules
- properly return Promises in specs
1 parent 84b34c4 commit 1c2cbbe

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scss-splinter",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
@@ -11,7 +11,7 @@
1111
"chai": "^3.5.0",
1212
"mocha": "^3.2.0",
1313
"postcss": "^5.2.6",
14-
"postcss-nested": "^1.0.0",
14+
"postcss-nested": "git+https://github.com/sparkbox/postcss-nested/",
1515
"postcss-scss": "^0.4.0"
1616
},
1717
"repository": {

parseSCSS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const postcss = require('postcss');
44
const syntax = require('postcss-scss');
5-
const nest = require("postcss-nested");
5+
const nest = require('postcss-nested');
66

77
const parser = (css) => {
88
const splits = [];

specs/index.js

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('scss split creation', function () {
1313
`;
1414
const parsed = parse(sassString);
1515

16-
parsed.then(x => {
16+
return parsed.then(x => {
1717
expect(x.splits[0]).to.equal('h1 { color: brand-color(c4); }');
1818
});
1919
});
@@ -30,7 +30,7 @@ describe('scss split creation', function () {
3030
`;
3131
const parsed = parse(sassString);
3232

33-
parsed.then(x => {
33+
return parsed.then(x => {
3434
expect(x.splits[1])
3535
.to.equal('@include brand(foo) {\n margin: 0;\n }');
3636
});
@@ -48,7 +48,7 @@ describe('scss split creation', function () {
4848
`;
4949
const parsed = parse(sassString);
5050

51-
parsed.then(x => {
51+
return parsed.then(x => {
5252
expect(x.splits[0]).to.equal('div h2 { color: brand-color(c4); }');
5353
});
5454
});
@@ -68,7 +68,7 @@ div {
6868
}`;
6969
const parsed = parse(sassString);
7070

71-
parsed.then(x => {
71+
return parsed.then(x => {
7272
expect(x.splits[0]).to.equal('@media (min-width: 40em) {');
7373
expect(x.splits[1]).to.equal('@include brand(foo) {\n div span span {\n color: red\n }\n }');
7474
});
@@ -88,7 +88,7 @@ div {
8888
}`;
8989
const parsed = parse(sassString);
9090

91-
parsed.then(x => {
91+
return parsed.then(x => {
9292
expect(x.splits[0]).to.equal('@media (min-width: 40em) {');
9393
expect(x.splits[1]).to.equal('div span span { color: brand-color(c4); }');
9494
});
@@ -106,8 +106,29 @@ body {
106106
`;
107107
const parsed = parse(sassString);
108108

109-
parsed.then(x => {
110-
expect(x.splits[1]).to.equal('@include brand(mozo) {\n @include brand-text();\n }');
109+
return parsed.then(x => {
110+
expect(x.splits[1]).to.equal('@include brand(foo) {\n @include brand-text();\n }');
111+
});
112+
});
113+
114+
it('does not orphan one-line includes', function () {
115+
const sassString = `
116+
.foo {
117+
@media (min-width: 40em) {
118+
@include clearfix;
119+
}
120+
}
121+
`;
122+
const parsed = parse(sassString);
123+
124+
return parsed.then(x => {
125+
expect(x.css).to.equal(`
126+
@media (min-width: 40em) {
127+
.foo {
128+
@include clearfix
129+
}
130+
}
131+
`);
111132
});
112133
});
113134
});

0 commit comments

Comments
 (0)