X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=inline;f=test%2Funit%2Fmanipulation.js;h=9242dddb5f7ebcb5e886d75e1088397cf92ce633;hb=e424e01c47084f29d83a643cc5540fd37b85c68d;hp=03f8f32c8e7666745f1183067f5c779c165a16eb;hpb=1a4d1904ae8631f94b7400d99af24d3fe2f33ecd;p=jquery.git
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 03f8f32..9242ddd 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -619,7 +619,7 @@ test("clone() on XML nodes", function() {
}
test("val()", function() {
- expect(9);
+ expect(17);
document.getElementById('text1').value = "bla";
equals( jQuery("#text1").val(), "bla", "Check for modified value of input element" );
@@ -641,6 +641,33 @@ test("val()", function() {
equals( jQuery('#option3e').val(), 'no value', 'Call val() on a option element with no value attribute' );
+ equals( jQuery('#option3a').val(), '', 'Call val() on a option element with no value attribute' );
+
+ jQuery('#select3').val("");
+ same( jQuery('#select3').val(), [''], 'Call val() on a multiple="multiple" select' );
+
+ var checks = jQuery("").appendTo("#form")
+ .add( jQuery("").appendTo("#form") )
+ .add( jQuery("").appendTo("#form") )
+ .add( jQuery("").appendTo("#form") );
+
+ same( checks.serialize(), "", "Get unchecked values." );
+
+ equals( checks.eq(3).val(), "on", "Make sure a value of 'on' is provided if none is specified." );
+
+ checks.val([ "2" ]);
+ same( checks.serialize(), "test=2", "Get a single checked value." );
+
+ checks.val([ "1", "" ]);
+ same( checks.serialize(), "test=1&test=", "Get multiple checked values." );
+
+ checks.val([ "", "2" ]);
+ same( checks.serialize(), "test=2&test=", "Get multiple checked values." );
+
+ checks.val([ "1", "on" ]);
+ same( checks.serialize(), "test=1&test=on", "Get multiple checked values." );
+
+ checks.remove();
});
var testVal = function(valueObj) {