refactor(): use const and let instead of var
This commit is contained in:

committed by
Victor Berchet

parent
73593d4bf3
commit
77ee27c59e
@ -16,8 +16,8 @@ import {ElementSchemaRegistry} from '../../src/schema/element_schema_registry';
|
||||
|
||||
export function main() {
|
||||
describe('RuntimeAnimationCompiler', () => {
|
||||
var resolver: CompileMetadataResolver;
|
||||
var parser: AnimationParser;
|
||||
let resolver: CompileMetadataResolver;
|
||||
let parser: AnimationParser;
|
||||
beforeEach(inject(
|
||||
[CompileMetadataResolver, ElementSchemaRegistry],
|
||||
(res: CompileMetadataResolver, schema: ElementSchemaRegistry) => {
|
||||
@ -27,19 +27,19 @@ export function main() {
|
||||
|
||||
const compiler = new AnimationCompiler();
|
||||
|
||||
var compileAnimations =
|
||||
const compileAnimations =
|
||||
(component: CompileDirectiveMetadata): AnimationEntryCompileResult[] => {
|
||||
const parsedAnimations = parser.parseComponent(component);
|
||||
return compiler.compile(component.type.name, parsedAnimations);
|
||||
};
|
||||
|
||||
var compileTriggers = (input: any[]) => {
|
||||
var entries: CompileAnimationEntryMetadata[] = input.map(entry => {
|
||||
var animationTriggerData = trigger(entry[0], entry[1]);
|
||||
const compileTriggers = (input: any[]) => {
|
||||
const entries: CompileAnimationEntryMetadata[] = input.map(entry => {
|
||||
const animationTriggerData = trigger(entry[0], entry[1]);
|
||||
return resolver.getAnimationEntryMetadata(animationTriggerData);
|
||||
});
|
||||
|
||||
var component = CompileDirectiveMetadata.create({
|
||||
const component = CompileDirectiveMetadata.create({
|
||||
type: new CompileTypeMetadata({name: 'myCmp'}),
|
||||
template: new CompileTemplateMetadata({animations: entries})
|
||||
});
|
||||
@ -47,18 +47,18 @@ export function main() {
|
||||
return compileAnimations(component);
|
||||
};
|
||||
|
||||
var compileSequence = (seq: AnimationMetadata) => {
|
||||
const compileSequence = (seq: AnimationMetadata) => {
|
||||
return compileTriggers([['myAnimation', [transition('state1 => state2', seq)]]]);
|
||||
};
|
||||
|
||||
it('should throw an exception containing all the inner animation parser errors', () => {
|
||||
var animation = sequence([
|
||||
const animation = sequence([
|
||||
style({'color': 'red'}), animate(1000, style({'font-size': '100px'})),
|
||||
style({'color': 'blue'}), animate(1000, style(':missing_state')), style({'color': 'gold'}),
|
||||
animate(1000, style('broken_state'))
|
||||
]);
|
||||
|
||||
var capturedErrorMessage: string;
|
||||
let capturedErrorMessage: string;
|
||||
try {
|
||||
compileSequence(animation);
|
||||
} catch (e) {
|
||||
|
Reference in New Issue
Block a user