Permalink
Browse files

add tests

  • Loading branch information...
1 parent c1e65b9 commit f2c785adf7796012b8adcf9de85a40a9c96f6043 Jeff Escalante committed Oct 14, 2013
Showing with 31 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 index.js
  3. +2 −1 package.json
  4. +1 −1 readme.md
  5. +2 −0 test/basic/example.styl
  6. +4 −0 test/basic/expected.css
  7. +2 −0 test/mocha.opts
  8. +17 −0 test/test.coffee
View
@@ -0,0 +1,2 @@
+.DS_Store
+node_modules
View
@@ -1,6 +1,6 @@
var autoprefixer = require('autoprefixer');
-module.exports = function(opts) {
+module.exports = function() {
return function(style){
style.on('end', function(css, cb){
cb(null, autoprefixer.compile(css));
View
@@ -8,7 +8,8 @@
},
"devDependencies": {
"mocha": "*",
- "should": "*"
+ "should": "*",
+ "stylus": "*"
},
"author": "Jeff Escalante",
"main": "index.js",
View
@@ -16,7 +16,7 @@ var stylus = require('stylus');
var autoprefixer = require('autoprefixer-stylus');
stylus(css)
- .use(autoprefixer)
+ .use(autoprefixer())
.render(function(err, output){
console.log(output);
});
View
@@ -0,0 +1,2 @@
+p
+ transition: all 1s ease
View
@@ -0,0 +1,4 @@
+p {
+ -webkit-transition: all 1s ease;
+ transition: all 1s ease;
+}
View
@@ -0,0 +1,2 @@
+--reporter spec
+--compilers coffee:coffee-script
View
@@ -0,0 +1,17 @@
+should = require 'should'
+fs = require 'fs'
+path = require 'path'
+autoprefixer = require '../index'
+stylus = require 'stylus'
+
+describe 'basic', ->
+
+ it 'works', (done) ->
+ contents = fs.readFileSync(path.join(__dirname, 'basic/example.styl'), 'utf8')
+ expected = fs.readFileSync(path.join(__dirname, 'basic/expected.css'), 'utf8')
+
+ stylus(contents).use(autoprefixer()).render (err, out) ->
+ # this is absurd, but it comes back as undefined unless wrapped like this...
+ process.nextTick ->
+ should.equal(out, expected)
+ done()

0 comments on commit f2c785a

Please sign in to comment.