Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix:(animation): Animator does not correctly parse transition durations with multiple values #2381

Closed
wants to merge 2 commits into from

Conversation

cburgdorf
Copy link
Contributor

This fixes #2373

Unfortunately I don't really know how to write tests for that. Any idea would be welcome.

@cburgdorf
Copy link
Contributor Author

I rebased against latest master and (hopefully) improved the commit message

@petebacondarwin
Copy link
Contributor

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR doesn't contain a breaking change
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@petebacondarwin
Copy link
Contributor

@cburgdorf - can you take a look at the list here. Most importantly we need a CLA signature and unit tests.

@cburgdorf
Copy link
Contributor Author

Hey @petebacondarwin, thanks for taking the time to look through it. The CLA is already signed and I also contributed before (only to docs though).

I now changed an existing test since I personally guess that's more appropriate here. If your rather want me to test it seperately I will change that. But the tests would look pretty much identical then.

It's rebased against latest master and squashed into one commit.

@petebacondarwin
Copy link
Contributor

Looks good. I'll push it into the CI server for a sanity check.

@petebacondarwin
Copy link
Contributor

Fails on Safari 6.0 Mac: http://ci.angularjs.org/job/angular.js-pete/75/console

@cburgdorf
Copy link
Contributor Author

That's a bit weird because I just checked it with Safari 6 and it's picking the highest duration for me. I know absolutely nothing about the testing frameworks Angular uses because I mostly just use qunit. So pardon me, is there any way for me to just run this particular test in safari so that I can hook in with the inspector and attach breakpoints?

@petebacondarwin
Copy link
Contributor

If you have node installed then try:

npm install -g grunt-cli

then cd into the project directory

npm install
grunt
grunt test:unit

That should trigger a run with Chrome but you can modify the
karma-*.conf.js files to run with different browsers.

On 16 April 2013 17:39, Christoph Burgdorf [email protected] wrote:

That's a bit weird because I just checked it with Safari 6 and it's
picking the highest duration for me. I know absolutely nothing about the
testing frameworks Angular uses because I mostly just use qunit. So pardon
me, is there any way for me to just run this particular test in safari so
that I can hook in with the inspector and attach breakpoints?


Reply to this email directly or view it on GitHubhttps://github.com//pull/2381#issuecomment-16455971
.

@petebacondarwin
Copy link
Contributor

Actually run grunt autotest then change the particular test to from "it" to
"iit". In the browser, you should be able to hit the "debug" link and then
every time you refresh the page it should rerun that test.

On 16 April 2013 17:44, Peter Bacon Darwin [email protected] wrote:

If you have node installed then try:

npm install -g grunt-cli

then cd into the project directory

npm install
grunt
grunt test:unit

That should trigger a run with Chrome but you can modify the
karma-*.conf.js files to run with different browsers.

On 16 April 2013 17:39, Christoph Burgdorf [email protected]:

That's a bit weird because I just checked it with Safari 6 and it's
picking the highest duration for me. I know absolutely nothing about the
testing frameworks Angular uses because I mostly just use qunit. So pardon
me, is there any way for me to just run this particular test in safari so
that I can hook in with the inspector and attach breakpoints?


Reply to this email directly or view it on GitHubhttps://github.com//pull/2381#issuecomment-16455971
.

@cburgdorf
Copy link
Contributor Author

That's a neat trick with this iit thingy :)

I fixed the bug with Safari. It was actually a bug within the test as I forgot to vendor prefix one of the css properties. It did work in Chrome as Chrome does not require the vendor prefix anymore.

@cburgdorf
Copy link
Contributor Author

@petebacondarwin Can you check against the CI again (or can I do that, too?). It should be fine actually since the test is working for me on Safari locally. Is there anything left for me to do to get that merged?

@matsko
Copy link
Contributor

matsko commented Apr 23, 2013

Once you guys are close to complete, I can merge this with the other two PRs I have for CSS animations and transition delays.

@cburgdorf
Copy link
Contributor Author

I'm would be happy to continue @romiem's work in that other PR (#2396) if that's ok for your @romiem? I would do it in a way that I keep your commit and just amend it so that the commit log shows you as an author. So that we would only have two logical commits but keeping you and me as an author. Guess no one likes to see his work being hidden under a different name ;-)

@romiem
Copy link

romiem commented Apr 23, 2013

Hey there @cburgdorf - apologies for the late reply. That would be great if you could make that change. I had written the function to calculate the max duration+delay pair but hadn't got around to writing unit tests or the other formal process that goes into committing code into Angular. Here is the method that I had written - please feel free to modify as you wish :)
https://gist.github.com/romiem/5447476
Thanks again for your patience!

@romiem
Copy link

romiem commented Apr 23, 2013

I should also mention that if you leave the delayString parameter empty, it returns the max duration, which means that we can combine our patches - but I shall await your thoughts on how best to progress this :)

@cburgdorf
Copy link
Contributor Author

Hey @matsko I rebased @romiem 's PR on top of mine and and also added a test to take the following case into account:

property    |    duration    |   delay
height      |     1s         |   2s
left        |     2s         |   1s
opacity     |     1s         |   2s

In this situation the overall time spent is 3s and not 4s.

@romiem I liked your approach! I just adjusted minor stuff (e.g. I removed the map since that would result into looping three times instead of just looping once). I made those minor adjustments under your name so that we can stick to only two commits (one by me, one by you).

@matsko anything left for us to do or is it ready for you to take over?

@matsko
Copy link
Contributor

matsko commented Apr 24, 2013

I'm happy to take over, could you provide me with the latest commit so that I can put the final changes together?

@cburgdorf
Copy link
Contributor Author

It's all pushed so it's only those two commits here https://github.com/angular/angular.js/pull/2381/commits The first one provides support for multiple durations (cburgdorf@8a3fc7d) and the second one provides support for multiple delays and also takes the special situation about multiple delays and durations into account (cburgdorf@d0288b1)

So basically, you can pick or rebase from my PR2373 branch.

@matsko
Copy link
Contributor

matsko commented May 1, 2013

Going to combine this into a larger commit. Plans are to change animation-enter-setup to just be called animation-enter and animation-enter-start to be called animation-enter-active so that CSS Animations work cleanly (since there is no need for two CSS classes). Your delay and multi-property duration code will be merged in together with the CSS Animation values too.

@@ -267,6 +267,25 @@ var $AnimatorProvider = function() {
// $window.setTimeout(beginAnimation, 0); this was causing the element not to animate
// keep at 1 for animation dom rerender
$window.setTimeout(beginAnimation, 1);

function savelySplitByComma(str){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

savely -> safely???

move to top level

@cburgdorf
Copy link
Contributor Author

@matsko should I override the branch with the corrections from @mhevery then? Or did you already rebase and it's easier for you to adjust yourself? Either is fine for me. When you say you combine it, will you keep our commits then?

@cburgdorf
Copy link
Contributor Author

Ok, I made those changes now and forced push the branch. @matsko I think if you already rebased on top of this, then you probably don't care about this PR update and just apply them again in your already rebased branch. On the other hand, if you haven't already started rebasing on top of this PR, then we might just merge it to master and you rebase on master then?

@mhevery I put safelySplitByComma into the Angular.js file. That's where you wanted me to put it, right? I'm wasn't sure if you have a convention on where exactly to put the generic helper stuff so I put it directly after the reverseParams function. Is that the right way?

I also did the other stuff. I just left the getMaxDuration function where it is since as I noted on your inline comment, this function is safe to assume to only deal with seconds as getComputedStyle already normalizes the units for us.

cburgdorf and others added 2 commits May 2, 2013 21:55
In case multiple durations are specified like so:

 transition-duration: 0.5s, 3000ms;
 transition-property: left, height;

The animator will pick the longest duration.

Fixes angular#2373
The code also handles situations with multiple different
delay and duration values.

E.g. in the following example, the correct duration would
be 3 seconds:

property    |    duration    |   delay
height      |     1s         |   2s
left        |     2s         |   1s
opacity     |     1s         |   2s
@matsko
Copy link
Contributor

matsko commented May 6, 2013

Hey guys. Sorry for being out of touch. There are bunch of fixes for animations that are taking place so I'm merging your commits into a bigger PR.

@matsko
Copy link
Contributor

matsko commented May 9, 2013

Landed in:

1475787

Thank you guys for the animator and test code.

@matsko
Copy link
Contributor

matsko commented May 17, 2013

@cburgdorf, please close the PR. This feature is complete and it will be 1.1.5.

@cburgdorf
Copy link
Contributor Author

Done

@cburgdorf cburgdorf closed this May 17, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animator does not correctly parse transition durations with multiple values
5 participants