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

Fix($animate) : svg element with classNameFilter animation fix. #14529

Merged
merged 1 commit into from
May 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ngAnimate/animateCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
$$jqLite.addClass(element, activeClasses);

if (flags.recalculateTimingStyles) {
fullClassName = node.className + ' ' + preparationClasses;
fullClassName = node.getAttribute('class') + ' ' + preparationClasses;
cacheKey = gcsHashFn(node, fullClassName);

timings = computeTimings(node, fullClassName, cacheKey);
Expand Down
2 changes: 1 addition & 1 deletion src/ngAnimate/animateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
return runner;
}

var className = [node.className, options.addClass, options.removeClass].join(' ');
var className = [node.getAttribute('class'), options.addClass, options.removeClass].join(' ');
if (!isAnimatableClassName(className)) {
close();
return runner;
Expand Down
22 changes: 21 additions & 1 deletion test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe("animations", function() {
});
});

it('should animate only the specified CSS className matched within $animateProvider.classNameFilter', function() {
it('should animate only the specified CSS className matched within $animateProvider.classNameFilter for div', function() {
module(function($animateProvider) {
$animateProvider.classNameFilter(/only-allow-this-animation/);
});
Expand All @@ -198,6 +198,26 @@ describe("animations", function() {
});
});

it('should animate only the specified CSS className matched within $animateProvider.classNameFilter for svg', function() {
module(function($animateProvider) {
$animateProvider.classNameFilter(/only-allow-this-animation-svg/);
});
inject(function($animate, $rootScope, $compile) {
var svgElement = $compile('<svg class="element"></svg>')($rootScope);
expect(svgElement).not.toHaveClass('only-allow-this-animation-svg');

$animate.enter(svgElement, parent);
$rootScope.$digest();
expect(capturedAnimation).toBeFalsy();

svgElement.attr('class', 'element only-allow-this-animation-svg');

$animate.leave(svgElement, parent);
$rootScope.$digest();
expect(capturedAnimation).toBeTruthy();
});
});

they('should not apply the provided options.$prop value unless it\'s a string or string-based array', ['addClass', 'removeClass'], function(prop) {
inject(function($animate, $rootScope) {
var startingCssClasses = element.attr('class') || '';
Expand Down