Make sure that ambiguous val() selection works correctly.
[jquery.git] / test / unit / attributes.js
index de7754b..a483195 100644 (file)
@@ -307,7 +307,7 @@ test("removeAttr(String)", function() {
 });
 
 test("val()", function() {
-       expect(20);
+       expect(23);
 
        document.getElementById('text1').value = "bla";
        equals( jQuery("#text1").val(), "bla", "Check for modified value of input element" );
@@ -342,6 +342,14 @@ test("val()", function() {
        jQuery('#select4').attr('disabled', true);
        same( jQuery('#select4').val(), ['2', '3'], 'Call val() on disabled multiple="multiple" select' );
 
+       equals( jQuery('#select5').val(), "3", "Check value on ambiguous select." );
+
+       jQuery('#select5').val(1);
+       equals( jQuery('#select5').val(), "1", "Check value on ambiguous select." );
+
+       jQuery('#select5').val(3);
+       equals( jQuery('#select5').val(), "3", "Check value on ambiguous select." );
+
        var checks = jQuery("<input type='checkbox' name='test' value='1'/><input type='checkbox' name='test' value='2'/><input type='checkbox' name='test' value=''/><input type='checkbox' name='test'/>").appendTo("#form");
 
        same( checks.serialize(), "", "Get unchecked values." );