animation.test.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. describe("animation", function () {
  2. beforeEach(function () {
  3. $("#animmator").remove();
  4. $(document.body).append("<div id='animmator'></div>");
  5. });
  6. it("should be an object",function(){
  7. var foo=$("#animmator").animation();
  8. expect($.isObject(foo)).to.be.true;
  9. });
  10. it("should run an animation",function(done){
  11. $("#animmator").animation().end(function(){
  12. done();
  13. }).run('asdf');
  14. });
  15. it("should run an animation with no callback",function(done){
  16. $("#animmator").animation().run('asdf');
  17. done();
  18. });
  19. it("should keep the class",function(done){
  20. $("#animmator").animation().keep().end(function(){
  21. expect(this.classList.contains("asdf")).to.be.true;
  22. done();
  23. }).run('asdf');
  24. });
  25. it("should keep the class",function(done){
  26. $("#animmator").animation().keep().end(function(){
  27. expect(this.classList.contains("asdf")).to.be.true;
  28. done();
  29. }).run('asdf');
  30. });
  31. it("should rerun the animation",function(done){
  32. $("#animmator").animation().end(function(){
  33. done();
  34. }).reRun('asdf');
  35. });
  36. it("should run the animation in reverse",function(done){
  37. $("#animmator").animation().reverse().end(function(){
  38. done();
  39. }).run('asdf');
  40. });
  41. it("should run the slide-in animation",function(done){
  42. $("#animmator").animation().end(function(){
  43. done();
  44. }).run('slide-in');
  45. });
  46. });