Commit a475f1aa authored by Dave Methvin's avatar Dave Methvin

Pull in unit tests from gh-877, thanks @orkel!

parent cc6c0141
...@@ -561,8 +561,10 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi ...@@ -561,8 +561,10 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi
}); });
test("toggle()", function() { test("toggle()", function() {
expect(7); expect(9);
var x = jQuery("#foo"); var div,
x = jQuery("#foo");
ok( x.is(":visible"), "is visible" ); ok( x.is(":visible"), "is visible" );
x.toggle(); x.toggle();
ok( x.is(":hidden"), "is hidden" ); ok( x.is(":hidden"), "is hidden" );
...@@ -575,7 +577,12 @@ test("toggle()", function() { ...@@ -575,7 +577,12 @@ test("toggle()", function() {
ok( x.is(":hidden"), "is hidden" ); ok( x.is(":hidden"), "is hidden" );
x.toggle(true); x.toggle(true);
ok( x.is(":visible"), "is visible again" ); ok( x.is(":visible"), "is visible again" );
div = jQuery("<div style='display:none'><div></div></div>").appendTo("#qunit-fixture");
x = div.find("div");
strictEqual( x.toggle().css( "display" ), "none", "is hidden" );
strictEqual( x.toggle().css( "display" ), "block", "is visible" );
// Ensure hide() is called when toggled (#12148) // Ensure hide() is called when toggled (#12148)
var oldHide = jQuery.fn.hide; var oldHide = jQuery.fn.hide;
jQuery.fn.hide = function() { jQuery.fn.hide = function() {
...@@ -584,8 +591,6 @@ test("toggle()", function() { ...@@ -584,8 +591,6 @@ test("toggle()", function() {
}; };
x.toggle( name === "show" ); x.toggle( name === "show" );
jQuery.fn.hide = oldHide; jQuery.fn.hide = oldHide;
}); });
test("hide hidden elements (bug #7141)", function() { test("hide hidden elements (bug #7141)", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment