UNPKG

jquery-vanish

Version:

[![Build Status](https://travis-ci.org/matheusazzi/jquery-vanish.svg)](https://travis-ci.org/matheusazzi/jquery-vanish) [![Code Climate](https://codeclimate.com/repos/559bcbc46956805f29001d02/badges/9e4dc9eea15a30549ba6/gpa.svg)](https://codeclimate.com/r

45 lines (33 loc) 939 B
describe('Jquery Vanish', function() { var subject; beforeEach(function() { subject = $('<h1>Hello Foo Bar</h1>'); }); describe('When finished', function() { it('Execute callback', function() { var foo = { fn: function() {} }; jasmine.clock().install(); spyOn(foo, 'fn'); subject.vanish({ duration: 100, animation: 0 }).on('vanished', foo.fn); jasmine.clock().tick(99); expect(foo.fn).not.toHaveBeenCalled(); jasmine.clock().tick(101); expect(foo.fn).toHaveBeenCalled(); jasmine.clock().uninstall(); }); it('Add class to elements', function() { jasmine.clock().install(); subject.vanish({ duration: 100, animation: 0, className: 'is-foo' }); jasmine.clock().tick(101); expect(subject.find('.is-foo').length).toEqual(11); jasmine.clock().uninstall(); }); }); });