Sha256: 0db6403aa15ab3e73db3a504c5d62d7a6f801739cef45fb8c38bfd60c4b5db42

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

/*
---
name: Chain.Wait Tests
requires: [More/Chain.Wait]
provides: [Chain.Wait.Tests]
...
*/
describe('Chain.Wait', function(){

	it('should wait some milliseconds between firing the functions', function(){

		var chain = this.chain = new Chain(),
			first = jasmine.createSpy(),
			second = jasmine.createSpy(),
			third = jasmine.createSpy();

		chain.chain(function(){
			first();
			chain.callChain();
		});

		chain.wait(400);
		chain.chain(function(){
			second();
			chain.callChain();
		});

		chain.wait(400);
		chain.chain(function(){
			third();
			chain.callChain();
		});

		// start chain
		chain.callChain();

		// first
		runs(function(){
			expect(first).toHaveBeenCalled();
		});

		// second
		waits(500);
		runs(function(){
			expect(second).toHaveBeenCalled();
		});

		// third
		waits(900);
		runs(function(){
			expect(third).toHaveBeenCalled();
		});

	});

	it('should not break the chainComplete event in Fx', function(){
		var count = 0;
		new Fx({
			link: 'chain',
			onChainComplete: function(){
				count++;
			},
			duration: 50
		}).start(0, 1).wait(40).start(1, 0);

		waits(500);

		runs(function(){
			expect(count).toEqual(1);
		});

	});

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1.5 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1.4 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1.3 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1.2 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1.1 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js
lsd_rails-0.1 Packages/mootools-more/Tests/Specs/1.3/Class/Chain.Wait.js