Fixed #1095 bug where radio buttons became unchecked during show(). Also added unit test and had to fix a selector test that was broken by the new testing div in test/index.html. Last made some whitespace changes.
This commit is contained in:
parent
b9371a6ca4
commit
e2ef3df86d
|
@ -765,7 +765,7 @@ jQuery.extend({
|
||||||
// Otherwise, we need to flip out more values
|
// Otherwise, we need to flip out more values
|
||||||
} else {
|
} else {
|
||||||
elem = jQuery( elem.cloneNode(true) )
|
elem = jQuery( elem.cloneNode(true) )
|
||||||
.find(":radio").removeAttr("checked").end()
|
.find(":radio").removeAttr("checked").removeAttr("defaultChecked").end()
|
||||||
.css({
|
.css({
|
||||||
visibility: "hidden",
|
visibility: "hidden",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
|
|
|
@ -132,15 +132,24 @@ Z</textarea>
|
||||||
<input type="radio" name="R1" value="2" />
|
<input type="radio" name="R1" value="2" />
|
||||||
<input type="text" name="My Name" value="me" />
|
<input type="text" name="My Name" value="me" />
|
||||||
<input type="reset" name="reset" value="NO" />
|
<input type="reset" name="reset" value="NO" />
|
||||||
<select name="S1">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select>
<select name="S2" multiple="multiple" size="3">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select>
|
<select name="S1">
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
</select>
|
||||||
|
<select name="S2" multiple="multiple" size="3">
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
<option value="abc">ABC</option>
|
||||||
|
</select>
|
||||||
<select name="S3">
|
<select name="S3">
|
||||||
<option selected="selected">YES</option>
|
<option selected="selected">YES</option>
|
||||||
</select>
|
</select>
|
||||||
<select name="S4">
|
<select name="S4">
|
||||||
<option value="" selected="selected">NO</option>
|
<option value="" selected="selected">NO</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" name="sub1" value="NO" />
|
<input type="submit" name="sub1" value="NO" />
|
||||||
<input type="submit" name="sub2" value="NO" />
|
<input type="submit" name="sub2" value="NO" />
|
||||||
<input type="image" name="sub3" value="NO" src="submit.gif" />
|
<input type="image" name="sub3" value="NO" src="submit.gif" />
|
||||||
<button name="sub4" type="submit" value="NO">NO</button>
|
<button name="sub4" type="submit" value="NO">NO</button>
|
||||||
<input name="D1" type="text" value="NO" disabled="disabled" />
|
<input name="D1" type="text" value="NO" disabled="disabled" />
|
||||||
|
@ -150,6 +159,16 @@ Z</textarea>
|
||||||
<option selected="selected" value="NO">NO</option>
|
<option selected="selected" value="NO">NO</option>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
<div id="moretests">
|
||||||
|
<form>
|
||||||
|
<div id="checkedtest" style="display:none;">
|
||||||
|
<input type="radio" name="checkedtestradios" checked="checked"/>
|
||||||
|
<input type="radio" name="checkedtestradios" value="on"/>
|
||||||
|
<input type="checkbox" name="checkedtestcheckboxes" checked="checked"/>
|
||||||
|
<input type="checkbox" name="checkedtestcheckboxes" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,18 @@ test("css(String, Object)", function() {
|
||||||
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
|
ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
|
||||||
|
expect(4);
|
||||||
|
|
||||||
|
var $checkedtest = $("#checkedtest");
|
||||||
|
// IE6 was clearing "checked" in jQuery.css(elem, "height");
|
||||||
|
jQuery.css($checkedtest[0], "height");
|
||||||
|
ok( !! $(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
|
||||||
|
ok( ! $(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
|
||||||
|
ok( !! $(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
|
||||||
|
ok( ! $(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
|
||||||
|
});
|
||||||
|
|
||||||
test("text()", function() {
|
test("text()", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
var expected = "This link has class=\"blog\": Simon Willison's Weblog";
|
var expected = "This link has class=\"blog\": Simon Willison's Weblog";
|
||||||
|
|
|
@ -12,43 +12,43 @@ test("animate(Hash, Object, Function)", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("animate option (queue === false)", function () {
|
test("animate option (queue === false)", function () {
|
||||||
expect(1);
|
expect(1);
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
var order = [];
|
var order = [];
|
||||||
|
|
||||||
var $foo = $("#foo");
|
var $foo = $("#foo");
|
||||||
$foo.animate({width:'100px'}, 200, function () {
|
$foo.animate({width:'100px'}, 200, function () {
|
||||||
// should finish after unqueued animation so second
|
// should finish after unqueued animation so second
|
||||||
order.push(2);
|
order.push(2);
|
||||||
});
|
});
|
||||||
$foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () {
|
$foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () {
|
||||||
// short duration and out of queue so should finish first
|
// short duration and out of queue so should finish first
|
||||||
order.push(1);
|
order.push(1);
|
||||||
}});
|
}});
|
||||||
$foo.animate({height:'100px'}, 10, function() {
|
$foo.animate({height:'100px'}, 10, function() {
|
||||||
// queued behind the first animation so should finish third
|
// queued behind the first animation so should finish third
|
||||||
order.push(3);
|
order.push(3);
|
||||||
isSet( order, [ 1, 2, 3], "Animations finished in the correct order" );
|
isSet( order, [ 1, 2, 3], "Animations finished in the correct order" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("queue() defaults to 'fx' type", function () {
|
test("queue() defaults to 'fx' type", function () {
|
||||||
expect(2);
|
expect(2);
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
var $foo = $("#foo");
|
var $foo = $("#foo");
|
||||||
$foo.queue("fx", [ "sample", "array" ]);
|
$foo.queue("fx", [ "sample", "array" ]);
|
||||||
var arr = $foo.queue();
|
var arr = $foo.queue();
|
||||||
isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'");
|
isSet(arr, [ "sample", "array" ], "queue() got an array set with type 'fx'");
|
||||||
$foo.queue([ "another", "one" ]);
|
$foo.queue([ "another", "one" ]);
|
||||||
var arr = $foo.queue("fx");
|
var arr = $foo.queue("fx");
|
||||||
isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type");
|
isSet(arr, [ "another", "one" ], "queue('fx') got an array set with no type");
|
||||||
// clean up after test
|
// clean up after test
|
||||||
$foo.queue([]);
|
$foo.queue([]);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("stop()", function() {
|
test("stop()", function() {
|
||||||
|
|
|
@ -59,8 +59,8 @@ test("id", function() {
|
||||||
t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
|
t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
|
||||||
t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
||||||
|
|
||||||
t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
|
t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
|
||||||
t( "ID Selector, not an ancestor ID", "#form #first", [] );
|
t( "ID Selector, not an ancestor ID", "#form #first", [] );
|
||||||
t( "ID Selector, not a child ID", "#form > #option1a", [] );
|
t( "ID Selector, not a child ID", "#form > #option1a", [] );
|
||||||
|
|
||||||
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
|
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
|
||||||
|
@ -193,7 +193,7 @@ test("pseudo (:) selectors", function() {
|
||||||
t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c"] );
|
t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c"] );
|
||||||
t( "Text Contains", "a:contains('Google')", ["google","groups"] );
|
t( "Text Contains", "a:contains('Google')", ["google","groups"] );
|
||||||
t( "Text Contains", "a:contains('Google Groups')", ["groups"] );
|
t( "Text Contains", "a:contains('Google Groups')", ["groups"] );
|
||||||
t( "Element Preceded By", "p ~ div", ["foo","fx-queue","fx-tests"] );
|
t( "Element Preceded By", "p ~ div", ["foo","fx-queue","fx-tests", "moretests"] );
|
||||||
t( "Not", "a.blog:not(.link)", ["mark"] );
|
t( "Not", "a.blog:not(.link)", ["mark"] );
|
||||||
|
|
||||||
t( "nth Element", "p:nth(1)", ["ap"] );
|
t( "nth Element", "p:nth(1)", ["ap"] );
|
||||||
|
|
Loading…
Reference in a new issue