diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-03-25 02:07:15 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-03 19:13:40 -0400 |
commit | 47c80c2050fbc15b84cb69edce309777e71b6387 (patch) | |
tree | a7b915a8ffe5361bf839e54d8e99a0fe2bc5fa18 | |
parent | 9e05a0a37fcc6fc4985a95370f91e1f792e2273b (diff) | |
download | jquery-47c80c2050fbc15b84cb69edce309777e71b6387.tar.gz jquery-47c80c2050fbc15b84cb69edce309777e71b6387.zip |
Add test for bug#3685, remove added html and add dynamicly to avoid global test suite errors
-rw-r--r-- | test/index.html | 2 | ||||
-rw-r--r-- | test/unit/attributes.js | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/test/index.html b/test/index.html index 584f1f864..c7c2ae55d 100644 --- a/test/index.html +++ b/test/index.html @@ -203,8 +203,6 @@ Z</textarea> <select name="D4" disabled="disabled"> <option selected="selected" value="NO">NO</option> </select> - <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 adc1d5914..96a836f3d 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -75,7 +75,7 @@ test("prop(String, Object)", function() { }); test("attr(String)", function() { - expect(24); + expect(25); equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' ); equals( jQuery('#radio1').attr('type'), "radio", 'Check for type attribute' ); @@ -88,11 +88,16 @@ test("attr(String)", function() { equals( jQuery('#name').attr('name'), "name", 'Check for name attribute' ); equals( jQuery('#text1').attr('name'), "action", 'Check for name attribute' ); ok( jQuery('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' ); + // [7472] & [3113] (form contains an input with name="action" or name="id") + var extras = jQuery('<input name="id" name="name" /><input id="target" name="target" />').appendTo('#testForm'); equals( jQuery('#form').attr('action','newformaction').attr('action'), 'newformaction', 'Check that action attribute was changed' ); 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]' ); + // Bug #3685 (form contains input with name="name") + equals( jQuery('#testForm').attr('name'), undefined, 'Retrieving name does not retrieve input with name=name' ); + extras.remove(); equals( jQuery('#text1').attr('maxlength'), '30', 'Check for maxlength attribute' ); equals( jQuery('#text1').attr('maxLength'), '30', 'Check for maxLength attribute' ); |