Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Importer: Adds tests for render and renderSync.
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Dec 18, 2014
1 parent fd6a32c commit acae62b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ describe('api', function() {
}
});
});

it('should override imports with custom importer', function(done) {
var src = read(fixture('include-files/index.scss'), 'utf8');

sass.render({
data: src,
success: function(result) {
assert.equal(result.css.trim(), 'div {\n color: yellow; }\n\ndiv {\n color: yellow; }');
done();
},
importer: function(url, prev, done) {
done({
file: '/some/other/path.scss',
contents: 'div {color: yellow;}'
});
}
});
});
});

describe('.renderSync(options)', function() {
Expand Down Expand Up @@ -164,6 +182,23 @@ describe('api', function() {

done();
});

it('should override imports with custom importer', function(done) {
var src = read(fixture('include-files/index.scss'), 'utf8');

var result = sass.renderSync({
data: src,
importer: function(url, prev, finish) {
finish({
file: '/some/other/path.scss',
contents: 'div {color: yellow;}'
});
}
});

assert.equal(result.css.trim(), 'div {\n color: yellow; }\n\ndiv {\n color: yellow; }');
done();
});
});

describe('.render({stats: {}})', function() {
Expand Down

0 comments on commit acae62b

Please sign in to comment.