aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2014-01-16 06:58:54 +0400
committerOleg <markelog@gmail.com>2014-01-16 06:58:54 +0400
commit659ac9c155a9ecee03e635dde1661be7081322f3 (patch)
treeab35e15555b861c3677324b5e2549b15615a7da3 /test
parentfdd78fad19ea3390cd96971cd29430e36378d137 (diff)
downloadjquery-659ac9c155a9ecee03e635dde1661be7081322f3.tar.gz
jquery-659ac9c155a9ecee03e635dde1661be7081322f3.zip
Tests: Add assertion for the jQuery#val method
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 7fc604470..e9d3e67b4 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -926,7 +926,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" );
@@ -941,7 +941,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( "<select multiple><option value='1'/><option value='2'/></select>" );
+ $select1 = jQuery("#select1"),
+
$select1.val( valueObj("3") );
equal( $select1.val(), "3", "Check for modified (via val(String)) value of select element" );
@@ -957,6 +959,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() {