From d249f07e5e7f057ce8897c3d7101c26be477a812 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulrich-Matthias=20Sch=C3=A4fer?= Date: Sun, 15 Nov 2015 21:57:31 +0100 Subject: [PATCH] added new provisionally specs for fx --- bower.json | 2 +- component.json | 2 +- package.json | 2 +- spec/spec/fx.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 5676ae3..571cf50 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "svg.js", - "version":"2.2.4", + "version":"3.0.0", "homepage": "http://svgjs.com/", "authors": [ "Wout Fierens " diff --git a/component.json b/component.json index c5bbc14..5336580 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "svg.js", "repo": "wout/svg.js", "description": "A lightweight library for manipulating and animating SVG", - "version": "2.2.4", + "version": "3.0.0", "keywords": ["svg"], "author": "Wout Fierens ", "main": "dist/svg.js", diff --git a/package.json b/package.json index f7a8aed..e595757 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svg.js", - "version": "2.2.4", + "version": "3.0.0", "description": "A lightweight library for manipulating and animating SVG.", "url": "http://svgjs.com", "homepage": "http://www.svgjs.com", diff --git a/spec/spec/fx.js b/spec/spec/fx.js index f1171f5..e93eb4d 100644 --- a/spec/spec/fx.js +++ b/spec/spec/fx.js @@ -9,6 +9,71 @@ describe('FX', function() { it('creates an instance of SVG.FX', function() { expect(fx instanceof SVG.FX).toBe(true) }) + + it('creates a new queue and pushes one animation into it', function() { + expect(fx._queue.length).toBe(1) + expect(fx._queue[0] instance of SVG.QueueItem).toBe(true) + }) + + describe('queue()', function() { + it('returns the queue of this animation instance', function() { + expect(fx.queue() instanceof Array).toBe(true) + }) + }) + + describe('enqueue()', function() { + it('pushes one item to the animation queue', function() { + expect(fx.enqueue(500).queue().length).toBe(2) + }) + }) + + describe('reverse()', function() { + it('sets the direction of the animation to -1', function() { + expect(fx.reverse()._direction).toBe(-1) + }) + }) + + describe('play()', function() { + it('sets the direction of the animation to 1', function() { + expect(fx.play()._direction).toBe(1) + }) + }) + + describe('get()', function() { + it('gets the specified situation object from the queue', function() { + expect(fx.get(0)).toBe(fx.queue()[0]) + }) + }) + + describe('seek()', function() { + it('sets the position of the whole animation queue to the specified position', function() { + expect(fx.seek(0.5)._pos).toBe(0.5) + }) + }) + + describe('get(0).seek()', function() { + it('sets the position of a certain animation in the queue to the specified position', function() { + expect(fx.get(0).seek(0.5)._pos).toBe(0.5) + }) + }) + + describe('stop()', function() { + it('sets the direction of the animation to 0', function() { + expect(fx.stop()._direction).toBe(0) + }) + }) + + describe('finish()', function() { + it('sets the position of the whole animation queue to 1', function() { + expect(fx.finish()._pos).toBe(1) + }) + }) + + describe('get(0).finish()', function() { + it('sets the position of a certain animation in the queue to 1', function() { + expect(fx.get(0).finish(1)._pos).toBe(1) + }) + }) it('animates the x/y-attr', function(done) { -- 2.39.5