Skip to content

Commit

Permalink
Improve test for imported component
Browse files Browse the repository at this point in the history
Test mixin, placeholder selector, variable, function
  • Loading branch information
Antoine Lehurt committed Feb 26, 2014
1 parent 8593207 commit 5c9ed39
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/component-stylus.js
Expand Up @@ -43,7 +43,7 @@ describe('component-stylus', function() {

builder.build(function(err, res) {
if (err) return done(err);
assert.equal(res.css.trim(), 'body {\n content: "test";\n color: #f00;\n}\nbody div {\n display: block;\n}');
assert.equal(res.css.trim(), '.bar,\n#barz {\n content: "foo";\n}\n.bar {\n content: "mixin";\n font-size: 24px;\n}');
done();
});
});
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/utils/component.json
@@ -1,6 +1,9 @@
{
"name": "utils",
"styles": [
"index.styl"
"mixin.styl",
"variable.styl",
"placeholder.styl",
"function.styl"
]
}
3 changes: 3 additions & 0 deletions test/fixtures/utils/function.styl
@@ -0,0 +1,3 @@
add(a, b) {
a + b;
}
3 changes: 0 additions & 3 deletions test/fixtures/utils/index.styl

This file was deleted.

3 changes: 3 additions & 0 deletions test/fixtures/utils/mixin.styl
@@ -0,0 +1,3 @@
mixin() {
content: "mixin";
}
3 changes: 3 additions & 0 deletions test/fixtures/utils/placeholder.styl
@@ -0,0 +1,3 @@
$foo {
content: "foo";
}
1 change: 1 addition & 0 deletions test/fixtures/utils/variable.styl
@@ -0,0 +1 @@
font-size = 14px;
18 changes: 11 additions & 7 deletions test/fixtures/with-import/index.styl
@@ -1,10 +1,14 @@
@import "utils/index";
@import "utils/mixin";
@import "utils/placeholder";
@import "utils/function";
@import "utils/variable";

body {
test();
color: red;
.bar {
@extend $foo;
mixin();
font-size: add(font-size, 10);
}

div {
display: block;
}
#barz {
@extend $foo;
}

0 comments on commit 5c9ed39

Please sign in to comment.