@@ -400,4 +400,38 @@ describe('cli', function() {
400400 } ) ;
401401 } ) ;
402402 } ) ;
403+
404+ describe ( 'functions' , function ( ) {
405+ it ( 'should let custom functions call setter methods on wrapped sass values (number)' , function ( done ) {
406+ var dest = fixture ( 'custom-functions/setter.css' ) ;
407+ var src = fixture ( 'custom-functions/setter.scss' ) ;
408+ var expected = read ( fixture ( 'custom-functions/setter-expected.css' ) , 'utf8' ) . trim ( ) . replace ( / \r \n / g, '\n' ) ;
409+ var bin = spawn ( cli , [
410+ src , '--output' , path . dirname ( dest ) ,
411+ '--functions' , fixture ( 'extras/my_custom_functions_setter.js' )
412+ ] ) ;
413+
414+ bin . once ( 'close' , function ( ) {
415+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
416+ fs . unlinkSync ( dest ) ;
417+ done ( ) ;
418+ } ) ;
419+ } ) ;
420+
421+ it ( 'should properly convert strings when calling custom functions' , function ( done ) {
422+ var dest = fixture ( 'custom-functions/string-conversion.css' ) ;
423+ var src = fixture ( 'custom-functions/string-conversion.scss' ) ;
424+ var expected = read ( fixture ( 'custom-functions/string-conversion-expected.css' ) , 'utf8' ) . trim ( ) . replace ( / \r \n / g, '\n' ) ;
425+ var bin = spawn ( cli , [
426+ src , '--output' , path . dirname ( dest ) ,
427+ '--functions' , fixture ( 'extras/my_custom_functions_string_conversion.js' )
428+ ] ) ;
429+
430+ bin . once ( 'close' , function ( ) {
431+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
432+ fs . unlinkSync ( dest ) ;
433+ done ( ) ;
434+ } ) ;
435+ } ) ;
436+ } ) ;
403437} ) ;
0 commit comments