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

Commit 296f1c7

Browse files
ErinCoughlanThomasBurleson
authored andcommitted
fix(panel): Fix panel tests in Angular 1.3.
Closes #8418
1 parent 2b8d18f commit 296f1c7

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

src/components/panel/panel.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ describe('$mdPanel', function() {
592592
var closeCalled = false;
593593
panelRef.close = function() {
594594
closeCalled = true;
595-
return panelRef._$q.resolve(self);
595+
return panelRef._$q.when(self);
596596
};
597597

598598
clickPanelContainer();

src/core/util/animation/animateCss.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,36 +140,44 @@ if (angular.version.minor >= 4) {
140140
.factory('$$forceReflow', $$ForceReflowFactory)
141141
.factory('$$AnimateRunner', $$AnimateRunnerFactory)
142142
.factory('$$rAFMutex', $$rAFMutexFactory)
143-
.factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout',
144-
function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout) {
143+
.factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout', '$animate',
144+
function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout, $animate) {
145145

146146
function init(element, options) {
147147

148148
var temporaryStyles = [];
149149
var node = getDomNode(element);
150+
var areAnimationsAllowed = node && $animate.enabled();
150151

151-
if (options.transitionStyle) {
152-
temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]);
153-
}
152+
var hasCompleteStyles = false;
153+
var hasCompleteClasses = false;
154154

155-
if (options.keyframeStyle) {
156-
temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]);
157-
}
155+
if (areAnimationsAllowed) {
156+
if (options.transitionStyle) {
157+
temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]);
158+
}
158159

159-
if (options.delay) {
160-
temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']);
161-
}
160+
if (options.keyframeStyle) {
161+
temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]);
162+
}
163+
164+
if (options.delay) {
165+
temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']);
166+
}
167+
168+
if (options.duration) {
169+
temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']);
170+
}
171+
172+
hasCompleteStyles = options.keyframeStyle ||
173+
(options.to && (options.duration > 0 || options.transitionStyle));
174+
hasCompleteClasses = !!options.addClass || !!options.removeClass;
162175

163-
if (options.duration) {
164-
temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']);
176+
blockTransition(element, true);
165177
}
166178

167-
var hasCompleteStyles = options.keyframeStyle ||
168-
(options.to && (options.duration > 0 || options.transitionStyle));
169-
var hasCompleteClasses = !!options.addClass || !!options.removeClass;
170-
var hasCompleteAnimation = hasCompleteStyles || hasCompleteClasses;
179+
var hasCompleteAnimation = areAnimationsAllowed && (hasCompleteStyles || hasCompleteClasses);
171180

172-
blockTransition(element, true);
173181
applyAnimationFromStyles(element, options);
174182

175183
var animationClosed = false;

0 commit comments

Comments
 (0)