', [dirA, dirB])))
                .toEqual([
                  [EmbeddedTemplateAst, [dirA], 'TestComp > div:nth-child(0)'],
                  [BoundPropertyAst, 'a', 'b', 'TestComp > div:nth-child(0)[template=a b]'],
                  [ElementAst, [dirB], 'TestComp > div:nth-child(0)'],
                  [AttrAst, 'b', '', 'TestComp > div:nth-child(0)[b=]']
                ]);
          });
          it('should locate directives in variable bindings', () => {
            var dirA =
                new DirectiveMetadata({selector: '[a=b]', type: new TypeMeta({typeName: 'DirA'})});
            var dirB =
                new DirectiveMetadata({selector: '[b]', type: new TypeMeta({typeName: 'DirB'})});
            expect(humanizeTemplateAsts(parse('
', [dirA, dirB])))
                .toEqual([
                  [EmbeddedTemplateAst, [dirA], 'TestComp > div:nth-child(0)'],
                  [VariableAst, 'a', 'b', 'TestComp > div:nth-child(0)[template=#a=b]'],
                  [ElementAst, [dirB], 'TestComp > div:nth-child(0)'],
                  [AttrAst, 'b', '', 'TestComp > div:nth-child(0)[b=]']
                ]);
          });
        });
        it('should work with *... and use the attribute name as property binding name', () => {
          expect(humanizeTemplateAsts(parse('
', [])))
              .toEqual([
                [EmbeddedTemplateAst, [], 'TestComp > div:nth-child(0)'],
                [BoundPropertyAst, 'ngIf', 'test', 'TestComp > div:nth-child(0)[*ng-if=test]'],
                [ElementAst, [], 'TestComp > div:nth-child(0)']
              ]);
        });
      });
    });
    describe('splitClasses', () => {
      it('should keep an empty class', () => { expect(splitClasses('a')).toEqual(['a']); });
      it('should split 2 classes', () => { expect(splitClasses('a b')).toEqual(['a', 'b']); });
      it('should trim classes', () => { expect(splitClasses(' a  b ')).toEqual(['a', 'b']); });
    });
  });
}
export function humanizeTemplateAsts(templateAsts: TemplateAst[]): any[] {
  var humanizer = new TemplateHumanizer();
  templateVisitAll(humanizer, templateAsts);
  return humanizer.result;
}
class TemplateHumanizer implements TemplateAstVisitor {
  result: any[] = [];
  visitNgContent(ast: NgContentAst): any {
    this.result.push([NgContentAst, ast.select, ast.sourceInfo]);
    return null;
  }
  visitEmbeddedTemplate(ast: EmbeddedTemplateAst): any {
    this.result.push([EmbeddedTemplateAst, ast.directives, ast.sourceInfo]);
    templateVisitAll(this, ast.attrs);
    templateVisitAll(this, ast.properties);
    templateVisitAll(this, ast.vars);
    templateVisitAll(this, ast.children);
    return null;
  }
  visitElement(ast: ElementAst): any {
    this.result.push([ElementAst, ast.directives, ast.sourceInfo]);
    templateVisitAll(this, ast.attrs);
    templateVisitAll(this, ast.properties);
    templateVisitAll(this, ast.events);
    templateVisitAll(this, ast.vars);
    templateVisitAll(this, ast.children);
    return null;
  }
  visitVariable(ast: VariableAst): any {
    this.result.push([VariableAst, ast.name, ast.value, ast.sourceInfo]);
    return null;
  }
  visitEvent(ast: BoundEventAst): any {
    this.result.push(
        [BoundEventAst, ast.name, expressionUnparser.unparse(ast.handler), ast.sourceInfo]);
    return null;
  }
  visitProperty(ast: BoundPropertyAst): any {
    this.result.push(
        [BoundPropertyAst, ast.name, expressionUnparser.unparse(ast.value), ast.sourceInfo]);
    return null;
  }
  visitAttr(ast: AttrAst): any {
    this.result.push([AttrAst, ast.name, ast.value, ast.sourceInfo]);
    return null;
  }
  visitBoundText(ast: BoundTextAst): any {
    this.result.push([BoundTextAst, expressionUnparser.unparse(ast.value), ast.sourceInfo]);
    return null;
  }
  visitText(ast: TextAst): any {
    this.result.push([TextAst, ast.value, ast.sourceInfo]);
    return null;
  }
}