Add tests for sass+scss syntax

This commit is contained in:
Vincent Prouillet 2015-03-24 22:36:26 +00:00
parent d59befea89
commit 9c0e76fc8b
3 changed files with 53 additions and 0 deletions

3
test/expected/indent.css Normal file
View file

@ -0,0 +1,3 @@
#main {
color: blue;
font-size: 0.3em; }

View file

@ -153,6 +153,53 @@ describe('gulp-sass -- async compile', function() {
});
stream.write(sassFile);
});
it('should compile a single indented sass file', function(done) {
var sassFile = createVinyl('indent.sass');
var stream = sass();
stream.on('data', function(cssFile) {
should.exist(cssFile);
should.exist(cssFile.path);
should.exist(cssFile.relative);
should.exist(cssFile.contents);
String(cssFile.contents).should.equal(
fs.readFileSync(path.join(__dirname, 'expected/indent.css'), 'utf8')
);
done();
});
stream.write(sassFile);
});
it('should parse files in sass and scss', function(done) {
var files = [
createVinyl('mixins.scss'),
createVinyl('indent.sass')
];
var stream = sass();
var mustSee = files.length;
var expectedPath = 'expected/mixins.css';
stream.on('data', function(cssFile) {
should.exist(cssFile);
should.exist(cssFile.path);
should.exist(cssFile.relative);
should.exist(cssFile.contents);
if (cssFile.path.indexOf('indent') !== -1) {
expectedPath = 'expected/indent.css';
}
String(cssFile.contents).should.equal(
fs.readFileSync(path.join(__dirname, expectedPath), 'utf8')
);
mustSee--;
if (mustSee <= 0) {
done();
}
});
files.forEach(function (file) {
stream.write(file);
});
});
});
describe('gulp-sass -- sync compile', function() {

3
test/scss/indent.sass Normal file
View file

@ -0,0 +1,3 @@
#main
color: blue
font-size: 0.3em