aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2011-09-14 14:25:14 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 15:42:32 -0400
commitdaeb66504565d3b95dbd6310778def4166044750 (patch)
tree5793d806dda845aaf6d2592312a5123ca6e1a92d /test
parentb7ebbb9142f1f18f887fde6dfbb5fa5fd72dba47 (diff)
downloadjquery-daeb66504565d3b95dbd6310778def4166044750.tar.gz
jquery-daeb66504565d3b95dbd6310778def4166044750.zip
Check for property support in the boolHook before falling back to attribute node. Fixes #10278.
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 6565d5db8..2b68e2863 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -153,11 +153,10 @@ test("attr(Hash)", function() {
ok( pass, "Set Multiple Attributes" );
equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" );
equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
-
});
test("attr(String, Object)", function() {
- expect(76);
+ expect(77);
var div = jQuery("div").attr("foo", "bar"),
fail = false;
@@ -212,6 +211,13 @@ test("attr(String, Object)", function() {
equal( jQuery("#check2").prop("checked"), true, "Set checked attribute" );
equal( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" );
+ QUnit.reset();
+
+ var $radios = jQuery("#checkedtest").find("input[type='radio']");
+ $radios.eq(1).click();
+ equal( $radios.eq(1).prop("checked"), true, "Second radio was checked when clicked");
+ equal( $radios.attr("checked"), $radios[0].checked ? "checked" : undefined, "Known booleans do not fall back to attribute presence (#10278)");
+
jQuery("#text1").prop("readOnly", true);
equals( document.getElementById("text1").readOnly, true, "Set readonly attribute" );
equals( jQuery("#text1").prop("readOnly"), true, "Set readonly attribute" );
@@ -295,8 +301,6 @@ test("attr(String, Object)", function() {
equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );
j.removeAttr("name");
- QUnit.reset();
-
// Type
var type = jQuery("#check2").attr("type");
var thrown = false;
@@ -309,7 +313,7 @@ test("attr(String, Object)", function() {
equals( type, jQuery("#check2").attr("type"), "Verify that you can't change the type of an input element" );
var check = document.createElement("input");
- var thrown = true;
+ thrown = true;
try {
jQuery(check).attr("type", "checkbox");
} catch(e) {
@@ -318,8 +322,8 @@ test("attr(String, Object)", function() {
ok( thrown, "Exception thrown when trying to change type property" );
equals( "checkbox", jQuery(check).attr("type"), "Verify that you can change the type of an input element that isn't in the DOM" );
- var check = jQuery("<input />");
- var thrown = true;
+ check = jQuery("<input />");
+ thrown = true;
try {
check.attr("type","checkbox");
} catch(e) {
@@ -329,7 +333,7 @@ test("attr(String, Object)", function() {
equals( "checkbox", check.attr("type"), "Verify that you can change the type of an input element that isn't in the DOM" );
var button = jQuery("#button");
- var thrown = false;
+ thrown = false;
try {
button.attr("type","submit");
} catch(e) {