Permalink
Browse files

allow 0s-duration animations; fixes #56

  • Loading branch information...
1 parent 53cc4c7 commit 252ce7272fd4a05f196c207ee950898b40956552 @madrobby committed Dec 17, 2010
Showing with 20 additions and 2 deletions.
  1. +1 −1 src/fx.js
  2. +19 −1 test/fx.html
View
@@ -6,7 +6,7 @@
else transforms.push(key + '(' + properties[key] + ')');
return this.css({
- '-webkit-transition': 'all ' + (duration || 0.5) + 's ' + (ease || ''),
+ '-webkit-transition': 'all ' + (duration !== undefined ? duration : 0.5) + 's ' + (ease || ''),
'-webkit-transform': transforms.join(' '),
opacity: opacity
});
View
@@ -14,7 +14,9 @@ <h1>Zepto FX unit tests</h1>
</p>
<div id="animtest" style="width:40px;height:40px;background:red"></div>
-
+ <div id="durationtest_1" style="width:40px;height:40px;background:red"></div>
+ <div id="durationtest_2" style="width:40px;height:40px;background:red"></div>
+
<script>
Evidence.TestCase.extend('ZeptoFXTest', {
@@ -29,6 +31,22 @@ <h1>Zepto FX unit tests</h1>
t.assertEqual('translate3d(100px, 100px, 100px) rotateZ(90deg)', el.style.webkitTransform);
t.assertEqual('ease-out', el.style.webkitTransitionTimingFunction);
t.assertEqual('0.5', el.style.opacity);
+ },
+
+ testDuration: function(t){
+ $('#durationtest_1').anim({
+ translate3d: '100px, 100px, 100px',
+ rotateZ: '90deg',
+ opacity: 0.5
+ });
+ t.assertEqual('0.5s', $('#durationtest_1').get(0).style.webkitTransitionDuration);
+
+ $('#durationtest_2').anim({
+ translate3d: '100px, 100px, 100px',
+ rotateZ: '90deg',
+ opacity: 0.5
+ }, 0);
+ t.assertEqual('0s', $('#durationtest_2').get(0).style.webkitTransitionDuration);
}
});

0 comments on commit 252ce72

Please sign in to comment.