Commit 705fa104 by Michael Mifsud

Merge pull request #1058 from saper/extracolortest

Additional tests for SassTypes::Color
parents 8d499724 df1c827c
...@@ -769,6 +769,50 @@ describe('api', function() { ...@@ -769,6 +769,50 @@ describe('api', function() {
}); });
}); });
describe('should properly bubble up errors from sass color constructor', function() {
it('four booleans', function(done) {
sass.render({
data: 'div { color: foo(); }',
functions: {
'foo()': function() {
return new sass.types.Color(false, false, false, false);
}
}
}, function(error) {
assert.ok(/Constructor arguments should be numbers exclusively/.test(error.message));
done();
});
});
it('two arguments', function(done) {
sass.render({
data: 'div { color: foo(); }',
functions: {
'foo()': function() {
return sass.types.Color(2,3);
}
}
}, function(error) {
assert.ok(/Constructor should be invoked with either 0, 1, 3 or 4 arguments/.test(error.message));
done();
});
});
it('single string argument', function(done) {
sass.render({
data: 'div { color: foo(); }',
functions: {
'foo()': function() {
return sass.types.Color('foo');
}
}
}, function(error) {
assert.ok(/Only argument should be an integer/.test(error.message));
done();
});
});
});
it('should properly bubble up errors from sass value constructors', function(done) { it('should properly bubble up errors from sass value constructors', function(done) {
sass.render({ sass.render({
data: 'div { color: foo(); }', data: 'div { color: foo(); }',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment