aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-02-13 02:23:38 -0500
committerjeresig <jeresig@gmail.com>2010-02-13 02:23:38 -0500
commitabcc1a76ee2a6733177b2cd104bc32cee5443ec4 (patch)
tree56f64b98689f8b8aab6934a4807c9b1e9cd8725b /test
parent83a044f1b5a733dc7ea76dbc9b7dd3a3dc4b7f25 (diff)
downloadjquery-abcc1a76ee2a6733177b2cd104bc32cee5443ec4.tar.gz
jquery-abcc1a76ee2a6733177b2cd104bc32cee5443ec4.zip
If .attr() is run on no elements undefined should be returned (as should be the case when no attribute is found). Fixes #6012.
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 234d58622..c5700adda 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -4,7 +4,7 @@ var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); };
test("attr(String)", function() {
- expect(28);
+ expect(30);
// This one sometimes fails randomly ?!
equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
@@ -61,6 +61,9 @@ test("attr(String)", function() {
select.appendChild( optgroup );
equals( jQuery(option).attr("selected"), true, "Make sure that a single option is selected, even when in an optgroup." );
+
+ ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." );
+ ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
});
if ( !isLocal ) {