@@ -619,7 +619,7 @@ test("clone() on XML nodes", function() {
619619}
620620
621621test ( "val()" , function ( ) {
622- expect ( 11 ) ;
622+ expect ( 15 ) ;
623623
624624 document . getElementById ( 'text1' ) . value = "bla" ;
625625 equals ( jQuery ( "#text1" ) . val ( ) , "bla" , "Check for modified value of input element" ) ;
@@ -646,6 +646,22 @@ test("val()", function() {
646646 jQuery ( '#select3' ) . val ( "" ) ;
647647 same ( jQuery ( '#select3' ) . val ( ) , [ '' ] , 'Call val() on a multiple="multiple" select' ) ;
648648
649+ var checks = jQuery ( "<input type='checkbox' name='test' value='1'/>" ) . appendTo ( "#form" )
650+ . add ( jQuery ( "<input type='checkbox' name='test' value='2'/>" ) . appendTo ( "#form" ) )
651+ . add ( jQuery ( "<input type='checkbox' name='test' value=''/>" ) . appendTo ( "#form" ) ) ;
652+
653+ same ( checks . serialize ( ) , "" , "Get unchecked values." ) ;
654+
655+ checks . val ( [ "2" ] ) ;
656+ same ( checks . serialize ( ) , "test=2" , "Get a single checked value." ) ;
657+
658+ checks . val ( [ "1" , "" ] ) ;
659+ same ( checks . serialize ( ) , "test=1&test=" , "Get multiple checked values." ) ;
660+
661+ checks . val ( [ "" , "2" ] ) ;
662+ same ( checks . serialize ( ) , "test=2&test=" , "Get multiple checked values." ) ;
663+
664+ checks . remove ( ) ;
649665} ) ;
650666
651667var testVal = function ( valueObj ) {
0 commit comments