aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-03-25 01:46:29 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-03 19:13:40 -0400
commit9e05a0a37fcc6fc4985a95370f91e1f792e2273b (patch)
tree0ddec05cd5d4859bb7260b6c691ae04205bf8fd1 /test
parent102053abd84124b1a69606565bd8da82bc5d30e9 (diff)
downloadjquery-9e05a0a37fcc6fc4985a95370f91e1f792e2273b.tar.gz
jquery-9e05a0a37fcc6fc4985a95370f91e1f792e2273b.zip
Fix #6562, tighten up the special code for form objects, add name attrHook for IE6/7, and don't check for undefined with getting hook'd attr
Diffstat (limited to 'test')
-rw-r--r--test/index.html3
-rw-r--r--test/unit/attributes.js38
2 files changed, 25 insertions, 16 deletions
diff --git a/test/index.html b/test/index.html
index 4a8aef529..584f1f864 100644
--- a/test/index.html
+++ b/test/index.html
@@ -203,7 +203,8 @@ Z</textarea>
<select name="D4" disabled="disabled">
<option selected="selected" value="NO">NO</option>
</select>
- <input name="id">
+ <input name="id" />
+ <input id="target" name="target" />
</form>
<div id="moretests">
<form>
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 5b6144462..adc1d5914 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -3,15 +3,18 @@ module("attributes", { teardown: moduleTeardown });
var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); };
-if ( !jQuery.support.getSetAttribute ) {
- test("jQuery.attrFix integrity test", function() {
- expect(1);
-
- // This must be maintained and equal jQuery.attrFix when appropriate
- // Ensure that accidental or erroneous property
- // overwrites don't occur
- // This is simply for better code coverage and future proofing.
- var propsShouldBe = {
+
+test("jQuery.attrFix integrity test", function() {
+ expect(1);
+
+ // This must be maintained and equal jQuery.attrFix when appropriate
+ // Ensure that accidental or erroneous property
+ // overwrites don't occur
+ // This is simply for better code coverage and future proofing.
+ var propsShouldBe;
+ if ( !jQuery.support.getSetAttribute ) {
+ propsShouldBe = {
+ tabindex: "tabIndex",
"for": "htmlFor",
"class": "className",
readonly: "readOnly",
@@ -19,14 +22,17 @@ if ( !jQuery.support.getSetAttribute ) {
cellspacing: "cellSpacing",
rowspan: "rowSpan",
colspan: "colSpan",
- tabindex: "tabIndex",
usemap: "useMap",
frameborder: "frameBorder"
};
+ } else {
+ propsShouldBe = {
+ tabindex: "tabIndex"
+ };
+ }
- same(propsShouldBe, jQuery.attrFix, "jQuery.attrFix passes integrity check");
- });
-}
+ same(propsShouldBe, jQuery.attrFix, "jQuery.attrFix passes integrity check");
+});
test("prop(String, Object)", function() {
expect(19);
@@ -69,7 +75,7 @@ test("prop(String, Object)", function() {
});
test("attr(String)", function() {
- expect(22);
+ expect(24);
equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' );
equals( jQuery('#radio1').attr('type'), "radio", 'Check for type attribute' );
@@ -84,7 +90,9 @@ test("attr(String)", function() {
ok( jQuery('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
// [7472] & [3113] (form contains an input with name="action" or name="id")
equals( jQuery('#form').attr('action','newformaction').attr('action'), 'newformaction', 'Check that action attribute was changed' );
- equals( jQuery('#testForm').removeAttr('id').attr('id'), undefined, 'Test that id does not equal the input with name=id after id is removed [#7472]' );
+ equals( jQuery('#testForm').attr('target'), undefined, 'Retrieving target does not equal the input with name=target' );
+ equals( jQuery('#testForm').attr('target', 'newTarget').attr('target'), 'newTarget', 'Set target successfully on a form' );
+ equals( jQuery('#testForm').removeAttr('id').attr('id'), undefined, 'Retrieving id does not equal the input with name=id after id is removed [#7472]' );
equals( jQuery('#text1').attr('maxlength'), '30', 'Check for maxlength attribute' );
equals( jQuery('#text1').attr('maxLength'), '30', 'Check for maxLength attribute' );