From 8b618c8eefe9a2e9fd8b3af443023ffc332850f6 Mon Sep 17 00:00:00 2001 From: Sam Thorogood Date: Fri, 14 Nov 2014 10:07:48 +1100 Subject: [PATCH 1/2] added group iteration tests --- target-config.js | 3 ++- test/js/timing.js | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/js/timing.js diff --git a/target-config.js b/target-config.js index 72ea2a0..d1a5800 100644 --- a/target-config.js +++ b/target-config.js @@ -79,7 +79,8 @@ 'test/js/group-constructors.js', 'test/js/group-player.js', 'test/js/group-player-finish-event.js', - 'test/js/timeline.js'); + 'test/js/timeline.js', + 'test/js/timing.js'); // This object specifies the source and test files for different Web Animation build targets. var targetConfig = { diff --git a/test/js/timing.js b/test/js/timing.js new file mode 100644 index 0000000..8296ba9 --- /dev/null +++ b/test/js/timing.js @@ -0,0 +1,25 @@ +suite('timing-tests', function() { + setup(function() { + document.timeline._players = []; + }); + + test('animation iterations', function() { + var anim = new Animation(document.body, [], { + duration: 2000, + iterations: 2, + iterationStart: 0.5 + }); + assert.equal(anim.activeDuration, 4000); + }); + + test('group iterations', function() { + var anim = new Animation(document.body, [], { + duration: 2000 + }); + var group = new AnimationGroup([anim], { + iterations: 2, + iterationStart: 0.5 + }); + assert.equal(group.activeDuration, 4000); + }); +}); From 8a9761e9e0de6c3469b2fad9f28471cb65457244 Mon Sep 17 00:00:00 2001 From: Sam Thorogood Date: Fri, 14 Nov 2014 10:09:59 +1100 Subject: [PATCH 2/2] note about why it fails --- test/js/timing.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/js/timing.js b/test/js/timing.js index 8296ba9..561187b 100644 --- a/test/js/timing.js +++ b/test/js/timing.js @@ -18,7 +18,9 @@ suite('timing-tests', function() { }); var group = new AnimationGroup([anim], { iterations: 2, - iterationStart: 0.5 + iterationStart: 0.5/*, + duration: 2000*/ + // note: fails even with explicit duration here, as opposed to 'auto' }); assert.equal(group.activeDuration, 4000); });