-
Notifications
You must be signed in to change notification settings - Fork 6.7k
refactor(collapse): use ngAnimate #1444
refactor(collapse): use ngAnimate #1444
Conversation
@chrisirhc this looks really cool! I'm going to start rebasing the BS3 branch today to get the BS3 release out of the doors before the New Year and then we are going to focus on AngularJS 1.2.x. |
Sounds good. Looking forward to it. 😄 Do tag any issues / pull requests that may need extra hands so I (and others) know which ones to focus on. I looked through the issues tagged with Bootstrap3 and didn't see any that were still awaiting action. |
@chrisirhc I'm just going over PRs trying to merge the ones that are ready / worth merging. Then going to rebase the BS3 branch and create a milestone for the next release - items in the milestone will need the immediate attention. Will ping you guys on the mailing list ([email protected]) with more details today. |
Great stuff thank you! |
Rebased and updated. Take note that the tests currently don't test the $animate methods. But I'm not sure how to go about testing them or whether they need to be tested. |
@chrisirhc I think testing is still necessary in this case, because you're using a service. Maybe this topic is useful? |
@@ -41,7 +44,7 @@ describe('collapse directive', function () { | |||
scope.isCollapsed = false; | |||
scope.$digest(); | |||
//No animation timeout here | |||
expect(element.height()).not.toBe(0); | |||
expect(element.hasClass('in')).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the expect(element).toHaveClass()
helper for better error messages
Just an update, I'm working on refactoring this PR at the moment so that hopefully collapse will just consist of an |
I like it! Perhaps we should even consider adding a Currently, it fails to apply to the latest - once you rebase (again! lol) it and fix conflicts I'll test it out. |
@ajoslin , rebased! |
@chrisirhc Can you check why this is failing? I think you need to replace the |
Any progress for this one? |
It seems that the Furthermore, after adding the aforementioned modules, the lines having
need to be changed to
Moreover, these need to be called each time the states of the Currently, I have a working local copy. The only failing test is 'should be shown on initialization if isCollapsed = false without transition', since the
to this:
where the
|
9d5ff5a
to
478f5c0
Compare
- Animations are now opt-in, include ngAnimate to see collapse animations - ngAnimate handles initial state and doesn't animate if first reflow hasn't occurred. angular/angular.js@cc58460 - Tests may need more work. Right now they test for 'in' class. Fixes angular-ui#1774 Fixes angular-ui#2821 Fixes angular-ui#2836 Closes angular-ui#1274 Closes angular-ui#1444
Updated this PR to move accordion animation logic into collapse directive. Planning to merge this soon. |
478f5c0
to
c8c0418
Compare
- Animations are now opt-in, include ngAnimate to see collapse animations - ngAnimate handles initial state and doesn't animate if first reflow hasn't occurred. angular/angular.js@cc58460 - Tests may need more work. Right now they test for 'in' class. Fixes angular-ui#1774 Fixes angular-ui#2821 Fixes angular-ui#2836 Closes angular-ui#1274 Closes angular-ui#1444
This LGTM. |
- Animations are now opt-in, include ngAnimate to see collapse animations - ngAnimate handles initial state and doesn't animate if first reflow hasn't occurred. angular/angular.js@cc58460 - Tests may need more work. Right now they test for 'in' class. Fixes angular-ui#1774 Fixes angular-ui#2821 Fixes angular-ui#2836 Closes angular-ui#1274 Closes angular-ui#1444
c8c0418
to
36e6363
Compare
- Animations are now opt-in, include ngAnimate to see collapse animations - ngAnimate handles initial state and doesn't animate if first reflow hasn't occurred. angular/angular.js@cc58460 - Tests may need more work. Right now they test for 'in' class. Fixes angular-ui#1774 Fixes angular-ui#2821 Fixes angular-ui#2836 Closes angular-ui#1274 Closes angular-ui#1444
Update: After merging #1675, I realized most of that logic can now be moved into collapse, as AngularJS 1.3 supports style options on animation calls. I've refactored it so that accordion and collapse share the same logic.
This is my attempt at #1274 .