diff options
| author | Matias Niemelä | 2013-11-06 01:57:34 -0500 | 
|---|---|---|
| committer | Matias Niemelä | 2013-11-06 02:01:19 -0500 | 
| commit | 9470080762aecca5285d0f5cac4ae01540bbad4c (patch) | |
| tree | a7d5c896504ad499e29ba9953cf5137a196e855b /test | |
| parent | aba0fe683040f753f60a0f8030777d94aa9f58bf (diff) | |
| download | angular.js-9470080762aecca5285d0f5cac4ae01540bbad4c.tar.bz2 | |
fix($animate): only apply the fallback property if any transition animations are detected
Diffstat (limited to 'test')
| -rw-r--r-- | test/ngAnimate/animateSpec.js | 49 | 
1 files changed, 48 insertions, 1 deletions
| diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index dee9bcba..562d94a0 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -814,7 +814,7 @@ describe("ngAnimate", function() {            $timeout.flush();            expect(child.attr('style') || '').not.toContain('transition-property'); -          expect(child.hasClass('ng-animate')).toBe(true); +          expect(child.hasClass('ng-animate-start')).toBe(true);            expect(child.hasClass('ng-animate-active')).toBe(true);            browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 }); @@ -845,6 +845,53 @@ describe("ngAnimate", function() {            expect(child2.hasClass('ng-animate-active')).toBe(false);          })); +        it("should not apply the fallback classes if no animations are going on or if CSS animations are going on", +          inject(function($compile, $rootScope, $animate, $sniffer, $timeout) { + +          if (!$sniffer.animations) return; + +          ss.addRule('.transitions',  '-webkit-transition:1s linear all;' + +                                              'transition:1s linear all'); + +          ss.addRule('.keyframes',  '-webkit-animation:my_animation 1s;' + +                                            'animation:my_animation 1s'); + +          var element = $compile('<div class="transitions">...</div>')($rootScope); +          $rootElement.append(element); +          jqLite($document[0].body).append($rootElement); + +          $animate.enabled(false); + +          $animate.addClass(element, 'klass'); + +          expect(element.hasClass('ng-animate-start')).toBe(false); + +          element.removeClass('klass'); + +          $animate.enabled(true); + +          $animate.addClass(element, 'klass'); + +          $timeout.flush(); + +          expect(element.hasClass('ng-animate-start')).toBe(true); +          expect(element.hasClass('ng-animate-active')).toBe(true); + +          browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 }); + +          expect(element.hasClass('ng-animate-start')).toBe(false); +          expect(element.hasClass('ng-animate-active')).toBe(false); + +          element.attr('class', 'keyframes'); + +          $animate.addClass(element, 'klass2'); + +          $timeout.flush(); + +          expect(element.hasClass('ng-animate-start')).toBe(false); +          expect(element.hasClass('ng-animate-active')).toBe(false); +        })); +          it("should skip transitions if disabled and run when enabled",            inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { | 
