Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animations): treat numeric state name values as strings #22923

Closed
wants to merge 1 commit into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -96,7 +96,7 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
if (def.type == AnimationMetadataType.State) {
const stateDef = def as AnimationStateMetadata;
const name = stateDef.name;
name.split(/\s*,\s*/).forEach(n => {
name.toString().split(/\s*,\s*/).forEach(n => {
stateDef.name = n;
states.push(this.visitState(stateDef, context));
});
Expand Down
11 changes: 11 additions & 0 deletions packages/animations/browser/test/dsl/animation_trigger_spec.ts
Expand Up @@ -203,6 +203,17 @@ import {makeTrigger} from '../shared';
]);
});

it('should treat numeric values (disguised as strings) as proper state values', () => {
const result = makeTrigger('name', [
state(1 as any as string, style({opacity: 0})),
state(0 as any as string, style({opacity: 0})), transition('* => *', animate(1000))
]);

expect(() => {
const trans = buildTransition(result, element, false, true) !;
}).not.toThrow();
});

describe('aliases', () => {
it('should alias the :enter transition as void => *', () => {
const result = makeTrigger('name', [transition(':enter', animate(3333))]);
Expand Down