diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html
index 2cffda7ec..0879a98b2 100644
--- a/tests/unit/effects/effects.html
+++ b/tests/unit/effects/effects.html
@@ -35,6 +35,22 @@
.hidden {
display: none;
}
+ .test {
+ background: #000;
+ border: 0;
+ }
+ .testAddBorder {
+ border: 10px solid #000;
+ }
+ .testChangeBackground {
+ background: #fff;
+ }
+ .test h2 {
+ font-size: 10px;
+ }
+ .testChildren h2 {
+ font-size: 20px;
+ }
@@ -48,7 +64,9 @@
-
+
+
Child Element Test
+
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 0359b73d3..228b6a79c 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -1,5 +1,13 @@
(function($) {
+function present( value, array, message ) {
+ QUnit.push( jQuery.inArray( value, array ) !== -1 , value, array, message );
+}
+
+function notPresent( value, array, message ) {
+ QUnit.push( jQuery.inArray( value, array ) === -1 , value, array, message );
+}
+
var animateTime = 15;
module( "effects.core" );
@@ -8,12 +16,10 @@ $.each( $.effects.effect, function( effect ) {
if ( effect === "transfer" ) {
return;
}
- QUnit.reset();
module( "effect."+effect );
- test( "show/hide", function() {
+ asyncTest( "show/hide", function() {
var hidden = $( "div.hidden" );
expect( 8 );
- stop();
var count = 0,
test = 0;
@@ -23,13 +29,13 @@ $.each( $.effects.effect, function( effect ) {
var point = count;
return function( next ) {
test++;
- equals( point, test, "Queue function fired in order" );
+ equal( point, test, "Queue function fired in order" );
if ( fn ) {
- fn ()
+ fn ();
} else {
setTimeout( next, animateTime );
}
- }
+ };
}
hidden.queue( queueTest() ).show( effect, animateTime, queueTest(function() {
@@ -37,10 +43,41 @@ $.each( $.effects.effect, function( effect ) {
})).queue( queueTest() ).hide( effect, animateTime, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
})).queue( queueTest(function(next) {
- deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains")
+ deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
start();
}));
});
});
+module("animateClass");
+
+asyncTest( "animateClass works with borderStyle", function() {
+ var test = $("div.animateClass"),
+ count = 0;
+ expect(3);
+ test.toggleClass("testAddBorder", 20, function() {
+ test.toggleClass("testAddBorder", 20, function() {
+ equal( test.css("borderLeftStyle"), "none", "None border set" );
+ start();
+ });
+ equal( test.css("borderLeftStyle"), "solid", "None border not immedately set" );
+ });
+ equal( test.css("borderLeftStyle"), "solid", "Solid border immedately set" );
+});
+
+asyncTest( "animateClass works with colors", function() {
+ var test = $("div.animateClass"),
+ count = 0;
+ expect(2);
+ test.toggleClass("testChangeBackground", 100, function() {
+ present( test.css("backgroundColor"), [ "#ffffff", "rgb(255, 255, 255)" ], "Color is final" );
+ start();
+ });
+ setTimeout(function() {
+ var color = test.css("backgroundColor");
+ notPresent( color, [ "#000000", "#ffffff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
+ "Color is not endpoints in middle." );
+ }, 50);
+});
+
})(jQuery);