Skip to content

Commit

Permalink
fill holes in transition values
Browse files Browse the repository at this point in the history
  • Loading branch information
chemerisuk committed Oct 24, 2014
1 parent 370fa19 commit fe6c772
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/util/animationhandler.js
Expand Up @@ -60,8 +60,13 @@ export default (node, computed, animationName, hiding, done) => {
transitionValues[hiding ? 3 : 2][visibilityTransitionIndex] = duration + "ms";
}

rules = transitionValues.map((prop, index) => {
return WEBKIT_PREFIX + TRANSITION_PROPS[index] + ":" + prop.join(", ");
rules = transitionValues.map((props, index) => {
// fill holes in a trasition property value
for (var i = 0, n = props.length; i < n; ++i) {
props[i] = props[i] || props[i - 1] || "initial";
}

return WEBKIT_PREFIX + TRANSITION_PROPS[index] + ":" + props.join(", ");
});

rules.push(
Expand Down
9 changes: 5 additions & 4 deletions test/spec/element/visibility.spec.js
Expand Up @@ -54,6 +54,7 @@ describe("visibility", function() {

it("by default updates display property", function() {
expect(link.css("display")).not.toBe("none");

link.hide(function() {
expect(link.css("display")).toBe("none");
});
Expand All @@ -62,14 +63,14 @@ describe("visibility", function() {
// it("should work for several transitions", function(done) {
// var start = Date.now();

// link = DOM.create("<a class=\"fade\" style='transition:opacity 50ms, transform 100ms;-webkit-transition:opacity 50ms, -webkit-transform 100ms'>abc</a>");
// var link = DOM.create("<a class=\"fade\" style='transition:opacity 50ms, transform 100ms;-webkit-transition:opacity 50ms, -webkit-transform 100ms'>abc</a>");

// jasmine.sandbox.set(link);

// link.hide(function() {
// if (hasAnimationSupport) {
// expect(Date.now() - start).toBeGreaterThan(75);
// }
// var delta = Date.now() - start;

// expect(delta < 50 || delta > 75).toBe(true);

// done();
// });
Expand Down

0 comments on commit fe6c772

Please sign in to comment.