aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/attributes.js
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2011-10-22 16:03:57 -0400
committertimmywil <timmywillisn@gmail.com>2011-10-22 16:03:57 -0400
commitc51b29477e2884fc28cfe4de5b64308177678262 (patch)
tree04d4245f38e0fd1355a99d9a4f5da6a9919813a1 /test/unit/attributes.js
parentf2c1d2e016018ba14cd3f1612f9a1803d5e1709e (diff)
downloadjquery-c51b29477e2884fc28cfe4de5b64308177678262.tar.gz
jquery-c51b29477e2884fc28cfe4de5b64308177678262.zip
Support setting both the enctype attribute and property (encoding in IE6/7). Fixes #6743.
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r--test/unit/attributes.js46
1 files changed, 29 insertions, 17 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 926ee6ff4..a9d79462d 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -12,25 +12,29 @@ test("jQuery.propFix integrity test", function() {
// overwrites don't occur
// This is simply for better code coverage and future proofing.
var props = {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- };
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ };
+
+ if ( !jQuery.support.enctype ) {
+ props.enctype = "encoding";
+ }
deepEqual(props, jQuery.propFix, "jQuery.propFix passes integrity check");
});
test("attr(String)", function() {
- expect(45);
+ expect(46);
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
@@ -118,6 +122,9 @@ test("attr(String)", function() {
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
equal( jQuery("<div/>").attr("value"), undefined, "An unset value on a div returns undefined." );
equal( jQuery("<input/>").attr("value"), "", "An unset value on an input returns current value." );
+
+ $form = jQuery("#form").attr("enctype", "multipart/form-data");
+ equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" );
});
if ( !isLocal ) {
@@ -475,7 +482,7 @@ test("removeAttr(String)", function() {
});
test("prop(String, Object)", function() {
- expect(30);
+ expect(31);
equals( jQuery("#text1").prop("value"), "Test", "Check for value attribute" );
equals( jQuery("#text1").prop("value", "Test2").prop("defaultValue"), "Test", "Check for defaultValue attribute" );
@@ -505,7 +512,9 @@ test("prop(String, Object)", function() {
equals( jQuery("#table").prop("frameBorder"), 1, "Check setting and retrieving frameBorder" );
QUnit.reset();
- var body = document.body, $body = jQuery( body );
+ var body = document.body,
+ $body = jQuery( body );
+
ok( $body.prop("nextSibling") === null, "Make sure a null expando returns null" );
body.foo = "bar";
equals( $body.prop("foo"), "bar", "Make sure the expando is preferred over the dom attribute" );
@@ -527,13 +536,16 @@ test("prop(String, Object)", function() {
strictEqual( jQuery(ele).prop("nonexisting"), undefined, "prop works correctly for non existing attributes (bug #7500)." );
});
- var obj = {};
+ obj = {};
jQuery.each( [document, obj], function( i, ele ) {
var $ele = jQuery( ele );
$ele.prop( "nonexisting", "foo" );
equal( $ele.prop("nonexisting"), "foo", "prop(name, value) works correctly for non existing attributes (bug #7500)." );
});
jQuery( document ).removeProp("nonexisting");
+
+ var $form = jQuery("#form").prop("enctype", "multipart/form-data");
+ equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" );
});
test("removeAttr(Multi String)", function() {