fix(animations): properly detect state transition changes for object literals

This commit is contained in:
Matias Niemelä
2017-07-06 17:33:16 -07:00
committed by Jason Aden
parent c81ad9d19d
commit f85b543cc1
3 changed files with 108 additions and 1 deletions

View File

@ -200,6 +200,16 @@ export class AnimationTransitionNamespace {
return player;
}
const isRemoval = toState.value === VOID_VALUE;
// normally this isn't reached by here, however, if an object expression
// is passed in then it may be a new object each time. Comparing the value
// is important since that will stay the same despite there being a new object.
// The removal arc here is special cased because the same element is triggered
// twice in the event that it contains animations on the outer/inner portions
// of the host container
if (!isRemoval && fromState.value === toState.value) return;
const playersOnElement: TransitionAnimationPlayer[] =
getOrSetAsInMap(this._engine.playersByElement, element, []);
playersOnElement.forEach(player => {

View File

@ -132,7 +132,7 @@ export function main() {
engine.destroy(DEFAULT_NAMESPACE_ID, null);
registerTrigger(element, engine, trig);
setProperty(element, engine, 'myTrigger', 'value');
setProperty(element, engine, 'myTrigger', 'value2');
engine.flush();
expect((engine.players[0].getRealPlayer() as MockAnimationPlayer).duration)
.toEqual(1234);