diff --git a/src/ngAnimate/.eslintrc.json b/src/ngAnimate/.eslintrc.json index 976e640e7..2c29ef3ce 100644 --- a/src/ngAnimate/.eslintrc.json +++ b/src/ngAnimate/.eslintrc.json @@ -57,11 +57,11 @@ "applyInlineStyle": false, "assertArg": false, "blockKeyframeAnimations": false, - "blockTransitions": false, "clearGeneratedClasses": false, "concatWithSpace": false, "extractElementNode": false, "getDomNode": false, + "helpers": false, "mergeAnimationDetails": false, "mergeClasses": false, "packageStyles": false, diff --git a/src/ngAnimate/animateCss.js b/src/ngAnimate/animateCss.js index e18bb9017..8f69edfbd 100644 --- a/src/ngAnimate/animateCss.js +++ b/src/ngAnimate/animateCss.js @@ -560,7 +560,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro // that if there is no transition defined then nothing will happen and this will also allow // other transitions to be stacked on top of each other without any chopping them out. if (isFirst && !options.skipBlocking) { - blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + helpers.blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); } var timings = computeTimings(node, fullClassName, cacheKey, !isStructural); @@ -646,7 +646,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro if (flags.blockTransition || flags.blockKeyframeAnimation) { applyBlocking(maxDuration); } else if (!options.skipBlocking) { - blockTransitions(node, false); + helpers.blockTransitions(node, false); } // TODO(matsko): for 1.5 change this code to have an animator object for better debugging @@ -699,7 +699,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro } blockKeyframeAnimations(node, false); - blockTransitions(node, false); + helpers.blockTransitions(node, false); forEach(temporaryStyles, function(entry) { // There is only one way to remove inline style properties entirely from elements. @@ -750,7 +750,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro function applyBlocking(duration) { if (flags.blockTransition) { - blockTransitions(node, duration); + helpers.blockTransitions(node, duration); } if (flags.blockKeyframeAnimation) { diff --git a/src/ngAnimate/shared.js b/src/ngAnimate/shared.js index 2708bbb2e..6f7f326d3 100644 --- a/src/ngAnimate/shared.js +++ b/src/ngAnimate/shared.js @@ -329,15 +329,6 @@ function clearGeneratedClasses(element, options) { } } -function blockTransitions(node, duration) { - // we use a negative delay value since it performs blocking - // yet it doesn't kill any existing transitions running on the - // same element which makes this safe for class-based animations - var value = duration ? '-' + duration + 's' : ''; - applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); - return [TRANSITION_DELAY_PROP, value]; -} - function blockKeyframeAnimations(node, applyBlock) { var value = applyBlock ? 'paused' : ''; var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; @@ -356,3 +347,14 @@ function concatWithSpace(a,b) { if (!b) return a; return a + ' ' + b; } + +var helpers = { + blockTransitions: function(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; + } +}; diff --git a/test/ngAnimate/.eslintrc.json b/test/ngAnimate/.eslintrc.json index f51d109b4..fea5242cb 100644 --- a/test/ngAnimate/.eslintrc.json +++ b/test/ngAnimate/.eslintrc.json @@ -4,6 +4,7 @@ }, "globals": { "getDomNode": false, + "helpers": false, "mergeAnimationDetails": false, "prepareAnimationOptions": false, "applyAnimationStyles": false, diff --git a/test/ngAnimate/animateCssSpec.js b/test/ngAnimate/animateCssSpec.js index d22100f7c..e90844291 100644 --- a/test/ngAnimate/animateCssSpec.js +++ b/test/ngAnimate/animateCssSpec.js @@ -1822,7 +1822,7 @@ describe('ngAnimate $animateCss', function() { they('should not place a CSS transition block if options.skipBlocking is provided', ['enter', 'leave', 'move', 'addClass', 'removeClass'], function(event) { - inject(function($animateCss, $rootElement, $document, $window) { + inject(function($animateCss, $rootElement, $document) { var element = angular.element('
'); $rootElement.append(element); angular.element($document[0].body).append($rootElement); @@ -1840,7 +1840,7 @@ describe('ngAnimate $animateCss', function() { data.event = event; } - var blockSpy = spyOn($window, 'blockTransitions').and.callThrough(); + var blockSpy = spyOn(helpers, 'blockTransitions').and.callThrough(); data.skipBlocking = true; var animator = $animateCss(element, data);