-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Escalante
committed
Aug 18, 2015
1 parent
bb4da6f
commit e54bbe7
Showing
5 changed files
with
46 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var chai = require ('chai'), | ||
path = require ('path'), | ||
fs = require ('fs'), | ||
accord = require ('accord'), | ||
axis = require ('../..'), | ||
autoprefixer = require ('autoprefixer-stylus'), | ||
cssparse = require ('css-parse'); | ||
|
||
var test_path = path.join(__dirname, '../fixtures'); | ||
should = chai.should(); | ||
|
||
// utility functions | ||
|
||
var compile = function(p){ | ||
return accord.load('stylus').renderFile(p, { use: [axis(), autoprefixer()] }); | ||
} | ||
|
||
var match_expected = function(out, p, done) { | ||
try { | ||
var expected_path = path.join(path.dirname(p), path.basename(p, '.styl')) + '.css'; | ||
if (!fs.existsSync(expected_path)) { throw '"expected" file doesnt exist' }; | ||
var expected_contents = fs.readFileSync(expected_path, 'utf8'); | ||
cssparse(out).should.eql(cssparse(expected_contents)) | ||
} catch (err) { | ||
return done(err) | ||
} | ||
done() | ||
} | ||
|
||
var compile_and_match = function(p, done) { | ||
compile(p).done(function(out) { match_expected(out.result, p, done) }, done) | ||
} | ||
|
||
// expose needed variables globally for tests | ||
|
||
global.test_path = test_path; | ||
global.axis = axis; | ||
global.compile_and_match = compile_and_match; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
--reporter spec | ||
--compilers coffee:coffee-script/register | ||
--require test/helpers/index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters