Skip to content

Commit b6fbbea

Browse files
committed
Revert "fix(animations): fix stagger timing not handling params (angular#47208)" (angular#47222)
This reverts commit 05f5e8a. Reason: breaks internal g3 tests PR Close angular#47222
1 parent a44b4bf commit b6fbbea

File tree

4 files changed

+4
-109
lines changed

4 files changed

+4
-109
lines changed

packages/animations/browser/src/dsl/animation_ast_builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
473473
}
474474
const timings = metadata.timings === 'full' ?
475475
{duration: 0, delay: 0, easing: 'full'} :
476-
constructTimingAst(metadata.timings, context.errors);
476+
resolveTiming(metadata.timings, context.errors, true);
477477

478478
return {
479479
type: AnimationMetadataType.Stagger,

packages/animations/browser/src/dsl/animation_timeline_builder.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,12 @@ export class AnimationTimelineBuilderVisitor implements AstVisitor {
278278
context.previousNode = ast;
279279
}
280280

281-
private _visitTiming(
282-
ast: TimingAst, context: AnimationTimelineContext,
283-
allowNegativeValues = false): AnimateTimings {
281+
private _visitTiming(ast: TimingAst, context: AnimationTimelineContext): AnimateTimings {
284282
if ((ast as DynamicTimingAst).dynamic) {
285283
const strValue = (ast as DynamicTimingAst).strValue;
286284
const timingValue =
287285
context.params ? interpolateParams(strValue, context.params, context.errors) : strValue;
288-
return resolveTiming(timingValue, context.errors, allowNegativeValues);
286+
return resolveTiming(timingValue, context.errors);
289287
} else {
290288
return {duration: ast.duration, delay: ast.delay, easing: ast.easing};
291289
}
@@ -415,8 +413,7 @@ export class AnimationTimelineBuilderVisitor implements AstVisitor {
415413
visitStagger(ast: StaggerAst, context: AnimationTimelineContext) {
416414
const parentContext = context.parentContext!;
417415
const tl = context.currentTimeline;
418-
const timings = this._visitTiming(ast.timings, context, true);
419-
416+
const timings = ast.timings;
420417
const duration = Math.abs(timings.duration);
421418
const maxTime = duration * (context.currentQueryTotal - 1);
422419
let delay = duration * context.currentQueryIndex;

packages/core/test/animation/animation_query_integration_spec.ts

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -742,105 +742,6 @@ describe('animation query tests', function() {
742742
expect(p5.delay).toEqual(6000);
743743
});
744744

745-
it(`should handle params used in the stagger's timing argument`, () => {
746-
@Component({
747-
selector: 'ani-cmp',
748-
template: `
749-
<div [@myAnimation]="exp">
750-
<div *ngFor="let item of items" class="item">
751-
{{ item }}
752-
</div>
753-
</div>
754-
`,
755-
animations: [
756-
trigger('myAnimation', [
757-
transition('* => go', [
758-
query('.item', [
759-
stagger('{{staggerDelay}}ms',[
760-
style({opacity: 0}), animate(1000, style({opacity: .5})),
761-
animate(500, style({opacity: 1}))
762-
])
763-
])
764-
], {params: { staggerDelay: '1111' }})
765-
])
766-
]
767-
})
768-
class Cmp {
769-
public exp: any;
770-
public items: any[] = [0, 1, 2, 3, 4];
771-
}
772-
773-
TestBed.configureTestingModule({declarations: [Cmp]});
774-
775-
const engine = TestBed.inject(ɵAnimationEngine);
776-
const fixture = TestBed.createComponent(Cmp);
777-
const cmp = fixture.componentInstance;
778-
779-
cmp.exp = 'go';
780-
fixture.detectChanges();
781-
engine.flush();
782-
783-
const players = getLog();
784-
expect(players.length).toEqual(5);
785-
786-
const [p1, p2, p3, p4, p5] = players;
787-
expect(p1.delay).toEqual(0);
788-
expect(p2.delay).toEqual(1111);
789-
expect(p3.delay).toEqual(2222);
790-
expect(p4.delay).toEqual(3333);
791-
expect(p5.delay).toEqual(4444);
792-
});
793-
794-
it(`should handle params used in the stagger's timing argument producing a negative value`,
795-
() => {
796-
@Component({
797-
selector: 'ani-cmp',
798-
template: `
799-
<div [@myAnimation]="exp">
800-
<div *ngFor="let item of items" class="item">
801-
{{ item }}
802-
</div>
803-
</div>
804-
`,
805-
animations: [
806-
trigger('myAnimation', [
807-
transition('* => go', [
808-
query('.item', [
809-
stagger('{{staggerDelay}}ms',[
810-
style({opacity: 0}), animate(1000, style({opacity: .5})),
811-
animate(500, style({opacity: 1}))
812-
])
813-
])
814-
], {params: { staggerDelay: -1111 }})
815-
])
816-
]
817-
})
818-
class Cmp {
819-
public exp: any;
820-
public items: any[] = [0, 1, 2, 3, 4];
821-
}
822-
823-
TestBed.configureTestingModule({declarations: [Cmp]});
824-
825-
const engine = TestBed.inject(ɵAnimationEngine);
826-
const fixture = TestBed.createComponent(Cmp);
827-
const cmp = fixture.componentInstance;
828-
829-
cmp.exp = 'go';
830-
fixture.detectChanges();
831-
engine.flush();
832-
833-
const players = getLog();
834-
expect(players.length).toEqual(5);
835-
836-
const [p1, p2, p3, p4, p5] = players;
837-
expect(p5.delay).toEqual(0);
838-
expect(p4.delay).toEqual(1111);
839-
expect(p3.delay).toEqual(2222);
840-
expect(p2.delay).toEqual(3333);
841-
expect(p1.delay).toEqual(4444);
842-
});
843-
844745
it('should persist inner sub trigger styles once their animation is complete', () => {
845746
@Component({
846747
selector: 'ani-cmp',

packages/core/test/bundling/animations/bundle.golden_symbols.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,6 @@
647647
{
648648
"name": "connectableObservableDescriptor"
649649
},
650-
{
651-
"name": "constructTimingAst"
652-
},
653650
{
654651
"name": "containsElement"
655652
},

0 commit comments

Comments
 (0)