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
This commit is contained in:
parent
3ac9eb7ce3
commit
d274b7b9f7
4 changed files with 95 additions and 44 deletions
|
@ -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<Element>|jQuery)", function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue