X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fattributes.js;h=8cf47bed6635b870ba0dd80b88149de82fca752f;hb=43a41ba7ecef732b48dcfc930fa9df8835fc4944;hp=c58111de1630bcda7e56bf6580a2afecf11b450f;hpb=78fc79fad47ce2991c0a7148b65acd7221223eb9;p=jquery.git diff --git a/test/unit/attributes.js b/test/unit/attributes.js index c58111d..8cf47be 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -546,6 +546,25 @@ test("val(Function) with incoming value", function() { equals( jQuery("#select1").val(), "4", "Should be possible to set the val() to a newly created option" ); }); +// testing if a form.reset() breaks a subsequent call to a select element's .val() (in IE only) +test("val(select) after form.reset() (Bug #2551)", function() { + expect(3); + + jQuery('
').appendTo("#main"); + + jQuery("#kkk").val( "gf" ); + + document.kk.reset(); + + equal( jQuery("#kkk")[0].value, "cf", "Check value of select after form reset." ); + equal( jQuery("#kkk").val(), "cf", "Check value of select after form reset." ); + + // re-verify the multi-select is not broken (after form.reset) by our fix for single-select + same( jQuery('#select3').val(), ['1', '2'], 'Call val() on a multiple="multiple" select' ); + + jQuery("#kk").remove(); +}); + var testAddClass = function(valueObj) { expect(5); var div = jQuery("div");