Unit Tests: Adding some basic unit tests for effects.* modules

This commit is contained in:
gnarf 2011-05-01 06:23:19 -05:00
parent d82a44ab4b
commit ec5aeb1b15
2 changed files with 27 additions and 9 deletions

View File

@ -32,10 +32,9 @@
<script src="../swarminject.js"></script>
<style type="text/css">
/*
Space intentionally left blank - eventually
we will probably define some basic css here to test effects
*/
.hidden {
display: none;
}
</style>
</head>
<body>
@ -48,7 +47,8 @@
</ol>
<div id="qunit-fixture">
<div class="hidden test"></div>
<div class="shown test"></div>
</div>
</body>

View File

@ -1,10 +1,28 @@
(function($) {
module( "effects - Core Effects" );
var animateTime = 15;
test( "Empty Unit", function() {
expect( 1 );
equals( 0, 0, "Unit Tests work" );
module( "effects.core" );
$.each( $.effects.effect, function( effect ) {
if ( effect === "transfer" ) {
return;
}
QUnit.reset();
module( "effect."+effect );
test( "show/hide", function() {
var hidden = $( "div.hidden" );
expect( 3 );
stop();
hidden.show( effect, animateTime, function() {
equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
}).hide( effect, animateTime, function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
}).queue( function(next) {
deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains")
start();
});
});
});
})(jQuery);