Skip to content

Commit

Permalink
Merge branch 'phopkins-feature/finish-all-queued'
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwheeler committed Sep 26, 2015
2 parents 2a952e2 + f28c610 commit 1ad0a81
Show file tree
Hide file tree
Showing 6 changed files with 500 additions and 427 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
##Velocity 1.2.2
##Velocity 1.2.3

**News**
**News**
You can now order the Velocity book on [Amazon](http://amazon.com/Web-Animation-using-JavaScript-Develop/dp/0134096665)!

WhatsApp, Tumblr, Windows, Samsung, Uber, and thousands of other companies rely on Velocity. Visit [Libscore.com](http://libscore.com/#$.Velocity) to see which sites use Velocity on their homepage.

Also, a round of Velocity updates are coming shortly, including an official React plugin :)

**Docs**
**Docs**
[VelocityJS.org](http://VelocityJS.org)

**Quickstart**
**Quickstart**

Velocity (CDN):
`<script src="//cdn.jsdelivr.net/velocity/1.2.2/velocity.min.js"></script>`
Velocity (CDN):
`<script src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>`

Velocity UI pack (CDN):
`<script src="//cdn.jsdelivr.net/velocity/1.2.2/velocity.ui.min.js"></script>`
Velocity UI pack (CDN):
`<script src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>`

Package managers:
`bower install velocity`
`npm install velocity-animate`
Package managers:
`bower install velocity`
`npm install velocity-animate`

**Found a Possible Bug?**

Expand All @@ -33,7 +33,7 @@ Ask on [StackOverflow](http://stackoverflow.com/tags/velocity.js) (make sure you
###**Updates**

- **1.2.0**: [Custom tweens](http://VelocityJS.org/#progress). [Custom easings](http://VelocityJS.org/#easing). ["Finish" command](http://VelocityJS.org/#finish). See [commit log](https://github.com/julianshapiro/velocity/commit/2a28e3812c6fe9262244ed3b6d41d12ae9a107c6) for more.
- **1.0.0**: File name changed to `velocity.js`. Read [VelocityJS.org/#dependencies](http://VelocityJS.org/#dependencies).
- **1.0.0**: File name changed to `velocity.js`. Read [VelocityJS.org/#dependencies](http://VelocityJS.org/#dependencies).
- **0.1.0**: `stop` now stops animations *immediately* (instead of only clearing the remainder of the animation queue). No other backwards-incompatible changes were made.

###**Learn**
Expand All @@ -51,5 +51,5 @@ Ask on [StackOverflow](http://stackoverflow.com/tags/velocity.js) (make sure you

====

[MIT License](LICENSE.md). © Julian Shapiro (http://twitter.com/shapiro).
[MIT License](LICENSE.md). © Julian Shapiro (http://twitter.com/shapiro).
[Stripe](https://stripe.com/blog/stripe-open-source-retreat) sponsors Velocity's development. [BrowserStack](http://www.browserstack.com/) provides testing services.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity",
"version": "1.2.2",
"version": "1.2.3",
"homepage": "http://velocityjs.org",
"authors": [
{ "name" : "Julian Shapiro",
Expand Down Expand Up @@ -31,7 +31,7 @@
"jquery": "*"
},
"repository" :
{
{
"type" : "git",
"url" : "http://github.com/julianshapiro/velocity.git"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity-animate",
"version": "1.2.2",
"version": "1.2.3",
"description": "Accelerated JavaScript animation.",
"keywords": [
"velocity",
Expand Down
57 changes: 56 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<script>

// Needed tests:
// - "finish"
// - new stop behvaior
// - e/p/o shorthands

Expand Down Expand Up @@ -986,6 +985,62 @@
}, asyncCheckDuration);
});

/******************
Command: Finish
******************/

QUnit.asyncTest("Command: Finish / FinishAll", function() {
expect(9);

var $target1 = getTarget();
/* Ensure an error isn't thrown when "finish" is called on a $target that isn't animating. */
Velocity($target1, "finish");

/* Animate to defaultProperties, and then "finish" to jump to the end of it. */
Velocity($target1, defaultProperties, Velocity.Utilities.extend({}, defaultOptions, { delay: 1000}));
Velocity($target1, "finish");

setTimeout(function() {
/* Ensure "finish" has removed all queued animations. */
/* We're using the element's queue length as a proxy. 0 and 1 both mean that the element's queue has been cleared -- a length of 1 just indicates that the animation is in progress. */
equal(Velocity.Utilities.queue($target1).length <= 1, true, "Queue cleared.");

/* End result of the animation should be applied */
equal(parseFloat(Velocity.CSS.getPropertyValue($target1, "width")), defaultProperties.width, "Standard end value #1 was set.");
equal(parseFloat(Velocity.CSS.getPropertyValue($target1, "opacity")), defaultProperties.opacity, "Standard end value #2 was set.");
}, asyncCheckDuration);

var $target2 = getTarget();
Velocity($target2, { opacity: 0 }, Velocity.Utilities.extend({}, defaultOptions, { delay: 1000 }));
Velocity($target2, { width: 0 }, defaultOptions);
Velocity($target2, "finish");

var $target3 = getTarget();
Velocity($target3, { opacity: 0, width: 50 }, Velocity.Utilities.extend({}, defaultOptions, { delay: 1000 }));
Velocity($target3, { width: 0 }, defaultOptions);
Velocity($target3, { width: 100 }, defaultOptions);
Velocity($target3, "finish", true);

var $target4 = getTarget();
Velocity($target4, { opacity: 0, width: 50 }, Velocity.Utilities.extend({}, defaultOptions, { delay: 1000 }));
Velocity($target4, { width: 0 }, defaultOptions);
Velocity($target4, { width: 100 }, defaultOptions);
Velocity($target4, "finishAll", true);

setTimeout(function() {
equal(Data($target2, pluginName).tweensContainer.opacity, undefined, "Active call stopped.");
notEqual(Data($target2, pluginName).tweensContainer.width, undefined, "Next queue item started.");

equal(Velocity.Utilities.queue($target3, "").length, 0, "Full queue array cleared.");
equal(parseFloat(Velocity.CSS.getPropertyValue($target3, "width")), 50, "Just the first call's width was applied.");

equal(Velocity.Utilities.queue($target4, "").length, 0, "Full queue array cleared.");
equal(parseFloat(Velocity.CSS.getPropertyValue($target4, "width")), 100, "The last call's width was applied.");

start();
}, asyncCheckDuration);
});

/***********************
Feature: Redirects
***********************/
Expand Down
Loading

0 comments on commit 1ad0a81

Please sign in to comment.