Sie sind auf Seite 1von 5

##cGcG####�£

##########D#b#C#o#n#t#e#x#t#_#C#S#_#V#6#.#0#.#v#s#t#e#m#p#l#a#t#e#��#@####�b######�
@n #### Q�#####�=�#############�###f###cGcG####`k�
##########C#S#h#a#r#p#D#b#C#o#n#t#e#x#t#.#T#y#p#e#s#.#t#t#��#@####�Y######�?n
#### Q�######J�#############S###f###cGcG####�B�
##########C#S#h#a#r#p#D#b#C#o#n#t#e#x#t#.#C#o#n#t#e#x#t#.#t#t#��#@####�'######�;n
#### Q�#####################g###f###cGcG####�#�
##########_#_#T#e#m#p#l#a#t#e#I#c#o#n#.#i#c#o#��#@####�#######$An
#####;�#####�G�#############�###<###cGcG#####��
##########D#b#C#o#n#t#e#x#t#_#C#S#_#V#5#.#0#.#v#s#t#e#m#p#l#a#t#e#��#@####Op######V
@n #####;�#####�E�#############�###<###cGcG#### `�
##########C#S#h#a#r#p#D#b#C#o#n#t#e#x#t#.#T#y#p#e#s#.#t#t#��#@####5f######�>n
#####;�######D�#############�###<###cGcG####�<�
##########C#S#h#a#r#p#D#b#C#o#n#t#e#x#t#.#C#o#n#t#e#x#t#.#t#t#��#@####�'######�9n
#####;�#####################=###<###cGcG####P��
##########_#_#T#e#m#p#l#a#t#e#I#c#o#n#.#i#c#o#��#@####################�L�#####�C�##
###�I�#####�###8###�H�H####�I�
##########C#F#C#S#E#F#6#��#@####################�L�######M�#####�9�#####d###8###�H�
H####�A�
####
#####D#b#C#t#x#C#S#E#F#6#��#@####################�L�#############`A�#####9###8###�H
�H####�2�
####
#####D#b#C#t#x#C#S#E#F#5#��#@############�Fn #### K�#####
H�#############�###�###cGcG####�Y�
##########P#r#o#j#e#c#t#I#t#e#m#.#c#s#��#@####H########=n ####
K�#####################�###�###cGcG#####�##########################################
###############################################################################or:
if(foo(null), #fff, #000); }' +
'table { color: if(bar() == null, #fff, #000); }',
functions: {
'foo($a)': function(a) {
return sass.types.Boolean(a instanceof sass.types.Null);
},
'bar()': function() {
return sass.NULL;
}
}
}, function(error, result) {
assert.equal(
result.css.toString().trim(),
'div {\n color: #000; }\n\nspan {\n color: #fff; }\n\ntable {\n color:
#fff; }'
);
done();
});
});

it('should be possible to carry sass values across different renders',


function(done) {
var persistentMap;

sass.render({
data: 'div { color: foo((abc: #112233, #ddeeff: true)); }',
functions: {
foo: function(m) {
persistentMap = m;
return sass.types.Color(0, 0, 0);
}
}
}, function() {
sass.render({
data: 'div { color: map-get(bar(), abc); background-color: baz(); }',
functions: {
bar: function() {
return persistentMap;
},
baz: function() {
return persistentMap.getKey(1);
}
}
}, function(errror, result) {
assert.equal(result.css.toString().trim(), 'div {\n color: #112233;\n
background-color: #ddeeff; }');
done();
});
});
});

it('should let us register custom functions without signatures', function(done)


{
sass.render({
data: 'div { color: foo(20, 22); }',
functions: {
foo: function(a, b) {
return new sass.types.Number(a.getValue() + b.getValue(), 'em');
}
}
}, function(error, result) {
assert.equal(result.css.toString().trim(), 'div {\n color: 42em; }');
done();
});
});

it('should fail when returning anything other than a sass value from a custom
function', function(done) {
sass.render({
data: 'div { color: foo(); }',
functions: {
'foo()': function() {
return {};
}
}
}, function(error) {
assert.ok(/A SassValue object was expected/.test(error.message));
done();
});
});

it('should properly bubble up standard JS errors thrown by custom functions',


function(done) {
sass.render({
data: 'div { color: foo(); }',
functions: {
'foo()': function() {
throw new RangeError('This is a test
erro###############################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
#########################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
###################################################################################
##################################################

Das könnte Ihnen auch gefallen