diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-05-28 22:25:04 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-05-28 22:36:23 -0400 |
commit | 7f2cc46955b35dc3d5a0526d0cb038d4a50b936b (patch) | |
tree | e2a4e841e16f90c93118130ec93319013eb3f08f /test/unit/effects.js | |
parent | 82d4c72fb15edd91869afa01a5bca3af678852fb (diff) | |
download | jquery-7f2cc46955b35dc3d5a0526d0cb038d4a50b936b.tar.gz jquery-7f2cc46955b35dc3d5a0526d0cb038d4a50b936b.zip |
Fix #11767. Modularize build and unit tests for exluding effects.
Closes gh-785. To build a version of jQuery without effects, use `grunt build:*:*:-effects`. The unit tests feature-check for the interfaces and skip the unit tests for effects if they don't detect it.
Diffstat (limited to 'test/unit/effects.js')
-rw-r--r-- | test/unit/effects.js | 108 |
1 files changed, 14 insertions, 94 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js index a2645b106..2b1cff3d3 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1,3 +1,5 @@ +if ( jQuery.fx ) { + module("effects", { teardown: moduleTeardown }); test("sanity check", function() { @@ -6,7 +8,7 @@ test("sanity check", function() { }); test("show()", function() { - expect(28); + expect(26); var hiddendiv = jQuery("div.hidden"); @@ -42,7 +44,6 @@ test("show()", function() { var speeds = { "null speed": null, "undefined speed": undefined, - "empty string speed": "", "false speed": false }; @@ -167,82 +168,6 @@ test("Persist correct display value", function() { }); }); -test("show() resolves correct default display #8099", function() { - expect(7); - var tt8099 = jQuery("<tt/>").appendTo("body"), - dfn8099 = jQuery("<dfn/>", { html: "foo"}).appendTo("body"); - - equal( tt8099.css("display"), "none", "default display override for all tt" ); - equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" ); - - equal( jQuery("#foo").hide().show().css("display"), "block", "Correctly resolves display:block after hide/show" ); - - equal( tt8099.hide().css("display"), "none", "default display override for all tt" ); - equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" ); - - equal( dfn8099.css("display"), "none", "default display override for all dfn" ); - equal( dfn8099.show().css("display"), "inline", "Correctly resolves display:inline" ); - - 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." ); -}); - - test("animate(Hash, Object, Function)", function() { expect(1); stop(); @@ -480,7 +405,6 @@ asyncTest( "animate option { queue: true }", function() { notEqual( foo.queue().length, 0, "Default queue is not empty" ); }); - asyncTest( "animate option { queue: 'name' }", function() { expect( 5 ); var foo = jQuery( "#foo" ), @@ -1295,20 +1219,6 @@ test("animate with CSS shorthand properties", function(){ }); }); -test("hide hidden elements (bug #7141)", function() { - expect(3); - QUnit.reset(); - - var div = jQuery("<div style='display:none'></div>").appendTo("#qunit-fixture"); - equal( div.css("display"), "none", "Element is hidden by default" ); - div.hide(); - ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" ); - div.show(); - equal( div.css("display"), "block", "Show a double-hidden element" ); - - div.remove(); -}); - test("hide hidden elements, with animation (bug #7141)", function() { expect(3); QUnit.reset(); @@ -1437,6 +1347,14 @@ test("animate will scale margin properties individually", function() { start(); }); +test("Do not append px to 'fill-opacity' #9548", 1, function() { + var $div = jQuery("<div>").appendTo("#qunit-fixture"); + + $div.css("fill-opacity", 0).animate({ "fill-opacity": 1.0 }, 0, function () { + equal( jQuery(this).css("fill-opacity"), 1, "Do not append px to 'fill-opacity'"); + }); +}); + // Start 1.8 Animation tests asyncTest( "jQuery.Animation( object, props, opts )", 1, function() { var testObject = { @@ -1708,4 +1626,6 @@ asyncTest( "multiple unqueued and promise", 4, function() { strictEqual( step++, 4, "Step 4" ); start(); }); -});
\ No newline at end of file +}); + +} // if ( jQuery.fx )
\ No newline at end of file |