aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-05-04 01:54:47 -0500
committergnarf <gnarf@gnarf.net>2011-05-04 01:54:47 -0500
commit4dcfeee8d54d81db4d5af8b2fd189b799cd9561e (patch)
tree864f8e0cfb7685dc89b086f8f73e3207c7dbe147 /tests
parentd61e0656c59761cf9729d2aacbc16d74e576a440 (diff)
downloadjquery-ui-4dcfeee8d54d81db4d5af8b2fd189b799cd9561e.tar.gz
jquery-ui-4dcfeee8d54d81db4d5af8b2fd189b799cd9561e.zip
Added some better queue order testing
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/effects/effects_core.js28
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 3da0b6f47..0359b73d3 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -12,16 +12,34 @@ $.each( $.effects.effect, function( effect ) {
module( "effect."+effect );
test( "show/hide", function() {
var hidden = $( "div.hidden" );
- expect( 3 );
+ expect( 8 );
stop();
- hidden.show( effect, animateTime, function() {
+
+ var count = 0,
+ test = 0;
+
+ function queueTest( fn ) {
+ count++;
+ var point = count;
+ return function( next ) {
+ test++;
+ equals( point, test, "Queue function fired in order" );
+ if ( fn ) {
+ fn ()
+ } else {
+ setTimeout( next, animateTime );
+ }
+ }
+ }
+
+ hidden.queue( queueTest() ).show( effect, animateTime, queueTest(function() {
equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
- }).hide( effect, animateTime, function() {
+ })).queue( queueTest() ).hide( effect, animateTime, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
- }).queue( function(next) {
+ })).queue( queueTest(function(next) {
deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains")
start();
- });
+ }));
});
});