@@ -526,13 +526,13 @@ describe('Test lib.js:', function() {
526
526
. toEqual ( '42' ) ;
527
527
528
528
expect ( coerce ( { s : [ 1 , 2 , 3 ] } , { } , stringAttrs , 's' ) )
529
- . toEqual ( '1,2,3' ) ;
529
+ . toEqual ( dflt ) ;
530
530
531
531
expect ( coerce ( { s : true } , { } , stringAttrs , 's' ) )
532
532
. toEqual ( 'true' ) ;
533
533
534
534
expect ( coerce ( { s : { 1 : 2 } } , { } , stringAttrs , 's' ) )
535
- . toEqual ( '[object Object]' ) ; // useless, but that's what it does!!
535
+ . toEqual ( dflt ) ;
536
536
} ) ;
537
537
} ) ;
538
538
@@ -861,27 +861,26 @@ describe('Test lib.js:', function() {
861
861
} ) ;
862
862
863
863
it ( 'should work for valType \'string\' where' , function ( ) {
864
+ var date = new Date ( 2016 , 1 , 1 ) ;
864
865
865
- // This fails as the coerceFunction coerce all values
866
- // (except when 'strict' is true) using String()
867
- //
868
- // Things like undefined, null, {}, [] should be considered valid!
869
- //
870
- // The question becomes how the change this while not
871
- // scarifying perf??
872
-
873
- assert ( [ '3' , '4' , 'a' ] , [ undefined , { } , [ ] , null ] , {
866
+ assert ( [ '3' , '4' , 'a' , 3 , 1.2113 , '' , date , false ] , [ undefined , { } , [ ] , null ] , {
874
867
valType : 'string' ,
875
868
dflt : 'a'
876
869
} ) ;
877
870
878
- assert ( [ '3' , '4' , 'a' ] , [ undefined , { } , [ ] , null , '' ] , {
871
+ assert ( [ '3' , '4' , 'a' , 3 , 1.2113 , date , true ] , [ '' , undefined , { } , [ ] , null ] , {
879
872
valType : 'string' ,
880
873
dflt : 'a' ,
881
874
noBlank : true
882
875
} ) ;
883
876
884
- assert ( [ '3' , '4' ] , [ undefined , 1 , { } , [ ] , null , '' ] , {
877
+ assert ( [ '3' , '4' , '' ] , [ undefined , 1 , { } , [ ] , null , date , true , false ] , {
878
+ valType : 'string' ,
879
+ dflt : 'a' ,
880
+ strict : true
881
+ } ) ;
882
+
883
+ assert ( [ '3' , '4' ] , [ undefined , 1 , { } , [ ] , null , date , '' , true , false ] , {
885
884
valType : 'string' ,
886
885
dflt : 'a' ,
887
886
strict : true ,
0 commit comments