aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2011-11-13 12:10:21 +0400
committerDave Methvin <dave.methvin@gmail.com>2011-11-14 11:30:53 -0500
commita467aa0a779b8741581cc2ab1fcd914f5718f5c8 (patch)
tree9d08e1d02b4e1c2af138c5b23d4b3e624e0a75ab /test
parentfa96f4bdeedd5b134ea1923e1147b4282fa4d6fa (diff)
downloadjquery-a467aa0a779b8741581cc2ab1fcd914f5718f5c8.tar.gz
jquery-a467aa0a779b8741581cc2ab1fcd914f5718f5c8.zip
Fix #10773. Improve parameter handling in removeAttr.
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js57
1 files changed, 35 insertions, 22 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index f8305a28f..ac3de94bd 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -481,6 +481,41 @@ test("removeAttr(String)", function() {
}
});
+test("removeAttr, #", function() {
+
+ var div = jQuery("<div />");
+
+ ok( div.removeAttr( "" ), "empty string" );
+ ok( div.removeAttr(), "nothing" );
+ ok( div.removeAttr( false ), "false" );
+ ok( div.removeAttr( true ), "true" );
+ ok( div.removeAttr({ }), "object" );
+ ok( div.removeAttr( function(){} ), "function" );
+
+});
+
+test("removeAttr(Multi String)", function() {
+ expect(8);
+
+ var div = jQuery("<div id='a' alt='b' title='c' rel='d'></div>"),
+ tests = {
+ id: "a",
+ alt: "b",
+ title: "c",
+ rel: "d"
+ };
+
+ jQuery.each( tests, function( key, val ) {
+ equal( div.attr(key), val, "Attribute `" + key + "` exists, and has a value of `" + val + "`" );
+ });
+
+ div.removeAttr( "id alt title rel " );
+
+ jQuery.each( tests, function( key, val ) {
+ equal( div.attr(key), undefined, "Attribute `" + key + "` was removed" );
+ });
+});
+
test("prop(String, Object)", function() {
expect(31);
@@ -548,28 +583,6 @@ test("prop(String, Object)", function() {
equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" );
});
-test("removeAttr(Multi String)", function() {
- expect(8);
-
- var div = jQuery("<div id='a' alt='b' title='c' rel='d'></div>"),
- tests = {
- id: "a",
- alt: "b",
- title: "c",
- rel: "d"
- };
-
- jQuery.each( tests, function( key, val ) {
- equal( div.attr(key), val, "Attribute `" + key + "` exists, and has a value of `" + val + "`" );
- });
-
- div.removeAttr( "id alt title rel" );
-
- jQuery.each( tests, function( key, val ) {
- equal( div.attr(key), undefined, "Attribute `" + key + "` was removed" );
- });
-});
-
test("prop('tabindex')", function() {
expect(8);