diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2011-11-21 13:25:46 -0500 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-11-21 13:25:46 -0500 |
commit | 299bc655c90cc89652417675f976ae1bfefc4d8b (patch) | |
tree | 551ee4bad1259efdcb4c1e87173f475e061f4027 /test | |
parent | 65d3dc695540719d0a72ad0c790532aceea39c04 (diff) | |
download | jquery-299bc655c90cc89652417675f976ae1bfefc4d8b.tar.gz jquery-299bc655c90cc89652417675f976ae1bfefc4d8b.zip |
Landing pull request 581. Updates original patch by Orkel. Fixes #10006.
More Details:
- https://github.com/jquery/jquery/pull/581
- http://bugs.jquery.com/ticket/10006
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/effects.js | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js index 82067cb8b..02ddd973d 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -167,7 +167,7 @@ test("Persist correct display value", function() { }); }); -test("show() resolves correct default display #8099", function() { +test("show() resolves correct default display (#8099)", function() { expect(7); var tt8099 = jQuery("<tt/>").appendTo("body"), dfn8099 = jQuery("<dfn/>", { html: "foo"}).appendTo("body"); @@ -185,7 +185,60 @@ test("show() resolves correct default display #8099", function() { tt8099.remove(); dfn8099.remove(); +}); + +test( "show() resolves correct default display, detached nodes (#10006)", function(){ + // Tests originally contributed by Orkel in + // https://github.com/jquery/jquery/pull/458 + expect( 11 ); + + var div, span; + + div = jQuery("<div class='hidden'>"); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div is visible." ); + + div = jQuery("<div style='display: none'>"); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div is visible." ); + + span = jQuery("<span class='hidden'/>"); + span.show().appendTo("#qunit-fixture"); + equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through stylesheets ) span has default display." ); + + span = jQuery("<span style='display: inline'/>"); + span.show().appendTo("#qunit-fixture"); + equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through inline style ) span has default display." ); + + div = jQuery("<div><div class='hidden'></div></div>").children("div"); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div inside another visible div is visible." ); + + div = jQuery("<div><div style='display: none'></div></div>").children("div"); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div inside another visible div is visible." ); + + div = jQuery("div.hidden"); + div.detach().show(); + equal( div.css("display"), "block", "Make sure a detached( through detach() ), pre-hidden div is visible." ); + div.remove(); + + span = jQuery("<span>"); + span.appendTo("#qunit-fixture").detach().show().appendTo("#qunit-fixture" ); + equal( span.css("display"), "inline", "Make sure a detached( through detach() ), pre-hidden span has default display." ); + span.remove(); + + div = jQuery("<div>"); + div.show().appendTo("#qunit-fixture"); + ok( !!div.get( 0 ).style.display, "Make sure not hidden div has a inline style." ); + + div = jQuery( document.createElement("div") ); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "block", "Make sure a pre-created element has default display." ); + div = jQuery("<div style='display: inline'/>"); + div.show().appendTo("#qunit-fixture"); + equal( div.css("display"), "inline", "Make sure that element has same display when it was created." ); }); |