aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-04-21 21:51:23 -0400
committerjeresig <jeresig@gmail.com>2011-04-21 21:51:23 -0400
commitd274b7b9f7727e8bccd6906d954e4dc790404d23 (patch)
treefb02a206c0e5206af9a546de8f2c2e744bda3bb3 /test
parent3ac9eb7ce37b461a34e303e8b77aa544d313441c (diff)
downloadjquery-d274b7b9f7727e8bccd6906d954e4dc790404d23.tar.gz
jquery-d274b7b9f7727e8bccd6906d954e4dc790404d23.zip
Landing pull request 332. Appending disconnected radio or checkbox inputs and keeping checked setting Fixes #8060, #8500.
More Details: - https://github.com/jquery/jquery/pull/332 - http://bugs.jquery.com/ticket/8060 - http://bugs.jquery.com/ticket/8500
Diffstat (limited to 'test')
-rw-r--r--test/unit/manipulation.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index e0fb369a6..b71b6962e 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -227,7 +227,7 @@ test("unwrap()", function() {
});
var testAppend = function(valueObj) {
- expect(37);
+ expect(40);
var defaultText = "Try them out:"
var result = jQuery("#first").append(valueObj("<b>buga</b>"));
equals( result.text(), defaultText + "buga", "Check if text appending works" );
@@ -330,6 +330,20 @@ var testAppend = function(valueObj) {
d.contents().appendTo("#nonnodes");
d.remove();
ok( jQuery("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
+
+ QUnit.reset();
+ var $input = jQuery("<input />").attr({ "type": "checkbox", "checked": true }).appendTo('#testForm');
+ equals( $input[0].checked, true, "A checked checkbox that is appended stays checked" );
+
+ QUnit.reset();
+ var $radios = jQuery("input:radio[name='R1']"),
+ $radioNot = jQuery("<input type='radio' name='R1' checked='checked'/>").insertAfter( $radios ),
+ $radio = $radios.eq(1).click();
+ $radioNot[0].checked = false;
+ $radios.parent().wrap("<div></div>");
+ equals( $radio[0].checked, true, "Reappending radios uphold which radio is checked" );
+ equals( $radioNot[0].checked, false, "Reappending radios uphold not being checked" );
+ QUnit.reset();
}
test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() {