Browse Source

Update for node-sass@3

This required updating the test suite. Many of the assertion were
depending on node-sass bugs that are long fixed.
master
xzyfer 9 years ago
parent
commit
0b1ea143b8
  1. 2
      package.json
  2. 13
      test/compileSpec.js
  3. 2
      test/css3/borderRadiusSpec.js
  4. 2
      test/css3/boxShadowSpec.js
  5. 6
      test/css3/imagesSpec.js
  6. 2
      test/css3/transitionSpec.js
  7. 4
      test/functionsSpec.js
  8. 9
      test/helper/render.js

2
package.json

@ -38,6 +38,6 @@
"devDependencies": {
"chalk": "^0.5.1",
"jasmine-node": "^1.14.5",
"node-sass": "^2.0.0-beta"
"node-sass": "^3.4.2"
}
}

13
test/compileSpec.js

@ -10,17 +10,16 @@ describe("Imports", function () {
done();
}
["imports", "imports_animation"].forEach(function(importFile) {
["imports.scss", "imports_animation.scss"].forEach(function(importFile) {
sass.render({
file: __dirname + "/" + importFile,
success: function(s){
success();
complete();
},
error: function(e){
}, function(e, s) {
if (e) {
console.log(chalk.red("Sass error:"), e);
complete();
} else {
success();
}
complete();
});
});

2
test/css3/borderRadiusSpec.js

@ -4,7 +4,7 @@ var ruleset = require('../helper/ruleset');
describe("CSS3 Border Radius", function () {
it("should generate a border radius", function (done) {
render(ruleset('$experimental-support-for-mozilla: false; $experimental-support-for-opera: false; @include border-radius(0, 0)'), function(output, err) {
render(ruleset('$experimental-support-for-mozilla: false !global; $experimental-support-for-opera: false !global; @include border-radius(0, 0)'), function(output, err) {
expect(output).toBe(ruleset('-webkit-border-radius:0 0;border-radius:0 / 0'));
done();
}, ['compass/css3/border-radius']);

2
test/css3/boxShadowSpec.js

@ -4,7 +4,7 @@ var ruleset = require('../helper/ruleset');
describe("CSS3 Box Shadow", function () {
it("should generate a default box shadow", function (done) {
render(ruleset('$default-box-shadow-inset: inset; $default-box-shadow-h-offset: 23px; $default-box-shadow-v-offset: 24px; $default-box-shadow-blur: 17px; $default-box-shadow-spread: 15px; $default-box-shadow-color: #DEADBE; $experimental-support-for-mozilla: false; $experimental-support-for-opera: false; @include box-shadow'), function(output, err) {
render(ruleset('$default-box-shadow-inset: inset !global; $default-box-shadow-h-offset: 23px !global; $default-box-shadow-v-offset: 24px !global; $default-box-shadow-blur: 17px !global; $default-box-shadow-spread: 15px !global; $default-box-shadow-color: #DEADBE !global; $experimental-support-for-mozilla: false !global; $experimental-support-for-opera: false !global; @include box-shadow'), function(output, err) {
expect(output).toBe(ruleset('-webkit-box-shadow:inset 23px 24px 17px 15px #DEADBE;box-shadow:inset 23px 24px 17px 15px #DEADBE'));
done();
}, ['compass/css3/box-shadow']);

6
test/css3/imagesSpec.js

@ -11,15 +11,15 @@ describe("CSS3 Images", function () {
});
it("should generate multiple backgrounds", function (done) {
render(ruleset('$support-for-original-webkit-gradients: false; $experimental-support-for-mozilla: false; $experimental-support-for-opera: false; @include background(a, b, c)'), function(output, err) {
render(ruleset('$support-for-original-webkit-gradients: false !global; $experimental-support-for-mozilla: false !global; $experimental-support-for-opera: false !global; @include background(a, b, c)'), function(output, err) {
expect(output).toBe(ruleset('background:-webkit-a,-webkit-b,-webkit-c;background:a,b,c'));
done();
}, ['compass/css3/images']);
});
it("should generate multiple backgrounds of different types", function (done) {
render(ruleset('$support-for-original-webkit-gradients: false; $experimental-support-for-mozilla: false; $experimental-support-for-opera: false; @include background(#fff, url(1.gif), linear-gradient(white, black))'), function(output, err) {
expect(output).toBe(ruleset('background:#fff,url(1.gif),-webkit-linear-gradient(white, black);background:#fff,url(1.gif),linear-gradient(white, black)'));
render(ruleset('$support-for-original-webkit-gradients: false !global; $experimental-support-for-mozilla: false !global; $experimental-support-for-opera: false !global; @include background(#fff, url(1.gif), linear-gradient(white, black))'), function(output, err) {
expect(output).toBe(ruleset('background:#fff,url(1.gif),-webkit-linear-gradient(#fff, #000);background:#fff,url(1.gif),linear-gradient(#fff, #000)'));
done();
}, ['compass/css3/images']);
});

2
test/css3/transitionSpec.js

@ -4,7 +4,7 @@ var ruleset = require('../helper/ruleset');
describe("CSS3 Transition", function () {
it("should generate a transition", function (done) {
render(ruleset('$experimental-support-for-mozilla: false; $experimental-support-for-opera: false; @include transition(ok 0s);'), function(output, err) {
render(ruleset('$experimental-support-for-mozilla: false !global; $experimental-support-for-opera: false !global; @include transition(ok 0s);'), function(output, err) {
expect(output).toBe(ruleset('-webkit-transition:ok 0s;transition:ok 0s'));
done();
}, ['compass/css3/transition']);

4
test/functionsSpec.js

@ -80,7 +80,7 @@ describe("Cross Browser Functions", function () {
it("should prefix a list of complex properties", function(done) {
render(property('prefix(-webkit, linear-gradient(-45deg, rgb(0,0,0) 25%, transparent 75%, transparent), linear-gradient(-45deg, #000 25%, transparent 75%, transparent))'), function(output, err) {
expect(output).toBe(property('-webkit-linear-gradient(-45deg, #000000 25%, transparent 75%, transparent),-webkit-linear-gradient(-45deg, #000 25%, transparent 75%, transparent)'));
expect(output).toBe(property('-webkit-linear-gradient(-45deg, #000 25%, transparent 75%, transparent),-webkit-linear-gradient(-45deg, #000 25%, transparent 75%, transparent)'));
done();
});
});
@ -126,7 +126,7 @@ describe("Gradient Functions", function () {
it("should prefix a list with color stops", function(done) {
render(property('prefix(-webkit, linear-gradient(-45deg, color-stops(rgb(0,0,0) 25%, transparent 75%, transparent)), linear-gradient(-45deg, color-stops(#000 25%, transparent 75%, transparent)))'), function(output, err) {
expect(output).toBe(property('-webkit-linear-gradient(-45deg, #000000 25%, transparent 75%, transparent),-webkit-linear-gradient(-45deg, #000 25%, transparent 75%, transparent)'));
expect(output).toBe(property('-webkit-linear-gradient(-45deg, #000 25%,transparent 75%,transparent),-webkit-linear-gradient(-45deg, #000 25%,transparent 75%,transparent)'));
done();
});
});

9
test/helper/render.js

@ -8,12 +8,13 @@ module.exports = function(data, callback, imports) {
sass.render({
data: '@import "'+libDir+'/compass/functions";' + imports.join('') + data,
outputStyle: 'compressed',
success: function(output){
callback(output.css);
},
error: function(err){
includePaths: [__dirname],
}, function(err, output) {
if (err) {
console.log(chalk.red("Sass error:"), err);
callback('', err);
} else {
callback(output.css.toString().trim());
}
});
}

Loading…
Cancel
Save