Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ export class TimelineBuilder {
const val = interpolateParams(value, params, errors);
this._pendingStyles.set(prop, val);
if (!this._localTimelineStyles.has(prop)) {
this._backFill.set(prop, this._globalTimelineStyles.get(prop) || AUTO_STYLE);
this._backFill.set(prop, this._globalTimelineStyles.get(prop) ?? AUTO_STYLE);
}
this._updateStyle(prop, val);
}
Expand Down
39 changes: 39 additions & 0 deletions packages/core/test/animation/animation_integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3981,6 +3981,45 @@ describe('animation tests', function() {
expect(pcp.duration).toEqual(7333); // 2s + 3s + 2000 + 111 + 222
});

it('should keep (transition from/to) styles defined in different timelines', () => {
@Component({
selector: 'cmp',
template: '<div @animation *ngIf="exp"></div>',
animations: [trigger(
'animation',
[transition(':enter', [group([
style({opacity: 0, color: 'red'}),
// Note: the objective of this test is to make sure the animation
// transitions from opacity 0 and color red to opacity 1 and color blue,
// even though the two styles are defined in different timelines
animate(500, style({opacity: 1, color: 'blue'})),
])])])]
})
class Cmp {
exp: boolean = false;
}

TestBed.configureTestingModule({declarations: [Cmp]});

const engine = TestBed.inject(ɵAnimationEngine);
const fixture = TestBed.createComponent(Cmp);
const cmp = fixture.componentInstance;
cmp.exp = true;

fixture.detectChanges();
engine.flush();

const players = getLog();
expect(players.length).toEqual(1);

const [player] = players;

expect(player.keyframes).toEqual([
new Map<string, string|number>([['opacity', '0'], ['color', 'red'], ['offset', 0]]),
new Map<string, string|number>([['opacity', '1'], ['color', 'blue'], ['offset', 1]]),
]);
});

describe('errors for not using the animation module', () => {
beforeEach(() => {
TestBed.configureTestingModule({
Expand Down