From f601dd4d2373fe74654eb26330f3fbf3c1b41842 Mon Sep 17 00:00:00 2001 From: Oleg Date: Thu, 16 Jan 2014 06:55:56 +0400 Subject: Attrs: Restore ability to pass array to jQuery#val Thanks @gibson042 --- test/unit/attributes.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 2b2eee425..ff89b444e 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -928,7 +928,7 @@ if ( "value" in document.createElement("meter") && } var testVal = function( valueObj ) { - expect( 8 ); + expect( 9 ); jQuery("#text1").val( valueObj("test") ); equal( document.getElementById("text1").value, "test", "Check for modified (via val(String)) value of input element" ); @@ -943,7 +943,9 @@ var testVal = function( valueObj ) { equal( document.getElementById("text1").value, "", "Check for modified (via val(null)) value of input element" ); var j, - $select1 = jQuery("#select1"); + select = jQuery( "" ); + $select1 = jQuery("#select1"), + $select1.val( valueObj("3") ); equal( $select1.val(), "3", "Check for modified (via val(String)) value of select element" ); @@ -959,6 +961,9 @@ var testVal = function( valueObj ) { j.val( valueObj( "asdf" ) ); equal( j.val(), "asdf", "Check node,textnode,comment with val()" ); j.removeAttr("value"); + + select.val( valueObj( [ "1", "2" ] ) ); + deepEqual( select.val(), [ "1", "2" ], "Should set array of values" ); }; test( "val(String/Number)", function() { -- cgit v1.2.3