Skip to content

Commit d8a27d0

Browse files
committed
Added test gulp-parent
1 parent 2f9ed4b commit d8a27d0

File tree

7 files changed

+37
-2
lines changed

7 files changed

+37
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-cssimport",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Parses a CSS file, finds imports, grabs the content of the linked file and replaces the import statement with it.",
55
"main": "gulp-cssimport.js",
66
"scripts": {

test/gulp-parent/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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* b.css */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import '../../../a.css';
2+
@import url('../../b.css');
3+
body {}

test/gulp-parent/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path="../../typings/node/node.d.ts" />
2+
/// <reference path="../../typings/tape/tape.d.ts" />
3+
var test = require("tape");
4+
var fs = require("fs");
5+
var collect = require("collect-stream");
6+
var plugin = require("../..");
7+
var gulp = require("gulp");
8+
9+
var options = {};
10+
11+
test("Gulp parent", function (t) {
12+
var stream;
13+
t.plan(1);
14+
var result = fs.readFileSync("result.css", { encoding: "utf8" });
15+
stream = gulp.src("design/style/css/main/style.css")
16+
.pipe(plugin(options))
17+
.pipe(gulp.dest("/dev/null"));
18+
collect(stream, function (err, data) {
19+
var file = data[0];
20+
data = file.contents.toString();
21+
// fs.writeFileSync("x.css", data);
22+
t.equal(data, result);
23+
t.end();
24+
});
25+
26+
});

test/gulp-parent/result.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* a.css */
2+
/* b.css */
3+
body {}

test/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ var tests = [
1111
"options-filter",
1212
"complete",
1313
"gulp-recursive",
14-
"gulp-complete"
14+
"gulp-complete",
15+
"gulp-parent"
1516
];
1617
emitter.on("run", function(index) {
1718
var name = tests[index];

0 commit comments

Comments
 (0)