Skip to content

Commit 659ac9c

Browse files
committed
Tests: Add assertion for the jQuery#val method
1 parent fdd78fa commit 659ac9c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/unit/attributes.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ if ( "value" in document.createElement("meter") &&
926926
}
927927

928928
var testVal = function( valueObj ) {
929-
expect( 8 );
929+
expect( 9 );
930930

931931
jQuery("#text1").val( valueObj("test") );
932932
equal( document.getElementById("text1").value, "test", "Check for modified (via val(String)) value of input element" );
@@ -941,7 +941,9 @@ var testVal = function( valueObj ) {
941941
equal( document.getElementById("text1").value, "", "Check for modified (via val(null)) value of input element" );
942942

943943
var j,
944-
$select1 = jQuery("#select1");
944+
select = jQuery( "<select multiple><option value='1'/><option value='2'/></select>" );
945+
$select1 = jQuery("#select1"),
946+
945947
$select1.val( valueObj("3") );
946948
equal( $select1.val(), "3", "Check for modified (via val(String)) value of select element" );
947949

@@ -957,6 +959,9 @@ var testVal = function( valueObj ) {
957959
j.val( valueObj( "asdf" ) );
958960
equal( j.val(), "asdf", "Check node,textnode,comment with val()" );
959961
j.removeAttr("value");
962+
963+
select.val( valueObj( [ "1", "2" ] ) );
964+
deepEqual( select.val(), [ "1", "2" ], "Should set array of values" );
960965
};
961966

962967
test( "val(String/Number)", function() {

0 commit comments

Comments
 (0)