Skip to content

Commit da04809

Browse files
committed
Added new test for commented imports
1 parent 148cd8e commit da04809

File tree

17 files changed

+113
-1
lines changed

17 files changed

+113
-1
lines changed

test/commented-import/design/a.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* a.css */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import url("./a.css");
2+
/*
3+
@import url("./b.css");
4+
*/

test/commented-import/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var test = require("tape");
2+
var fs = require("fs");
3+
var collect = require("collect-stream");
4+
var plugin = require("../..");
5+
var gulp = require("gulp");
6+
var options = {};
7+
8+
test("Commented import", function (t) {
9+
var result = fs.readFileSync("result.css", { encoding: "utf8" });
10+
var stream;
11+
var p = plugin(options);
12+
stream = gulp.src("design/style.css")
13+
.pipe(p);
14+
collect(stream, function(err, data) {
15+
if (err) throw err;
16+
var file = data[0];
17+
data = file.contents.toString();
18+
// fs.writeFileSync("x.css", data);
19+
t.equal(data, result);
20+
t.end();
21+
});
22+
});

test/commented-import/result.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* a.css */
2+
/*
3+
@import url("./b.css");
4+
*/

test/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ var tests = [
1111
"options-matchpattern",
1212
"parent",
1313
"include-paths",
14-
"recursive"
14+
"recursive",
15+
"commented-import",
16+
"wild-commented-import",
17+
"sass-commented-import",
1518
];
1619
emitter.on("run", function(index) {
1720
var name = tests[index];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* a.css */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* b.css */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* c.css */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import url("./a.css");
2+
// @import url("./x1.css"); /**/
3+
@import url("./b.css");
4+
/*
5+
@import url("./x2.css"); /*
6+
/**/
7+
@import url("./c.css");
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var test = require("tape");
2+
var fs = require("fs");
3+
var collect = require("collect-stream");
4+
var plugin = require("../..");
5+
var gulp = require("gulp");
6+
var options = {};
7+
8+
test("Sass commented import", function (t) {
9+
var result = fs.readFileSync("result.css", { encoding: "utf8" });
10+
var stream;
11+
var p = plugin(options);
12+
stream = gulp.src("design/style.css")
13+
.pipe(p);
14+
collect(stream, function(err, data) {
15+
if (err) throw err;
16+
var file = data[0];
17+
data = file.contents.toString();
18+
// fs.writeFileSync("x.css", data);
19+
t.equal(data, result);
20+
t.end();
21+
});
22+
});

0 commit comments

Comments
 (0)