diff --git a/test/api.js b/test/api.js index 8e644cab3..85eed938e 100644 --- a/test/api.js +++ b/test/api.js @@ -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() { @@ -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() {