'],
- [BoundDirectivePropertyAst, 'aProp', '(foo | bar)', '[a-prop]="foo | bar"']
- ]);
- });
-
- });
});
}
-function humanizeTplAst(templateAsts: TemplateAst[]): any[] {
- var humanizer = new TemplateHumanizer(false);
- templateVisitAll(humanizer, templateAsts);
- return humanizer.result;
-}
-
-function humanizeTplAstSourceSpans(templateAsts: TemplateAst[]): any[] {
- var humanizer = new TemplateHumanizer(true);
+export function humanizeTemplateAsts(templateAsts: TemplateAst[]): any[] {
+ var humanizer = new TemplateHumanizer();
templateVisitAll(humanizer, templateAsts);
return humanizer.result;
}
class TemplateHumanizer implements TemplateAstVisitor {
result: any[] = [];
-
- constructor(private includeSourceSpan: boolean){};
-
visitNgContent(ast: NgContentAst, context: any): any {
- var res = [NgContentAst];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([NgContentAst]);
return null;
}
visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any {
- var res = [EmbeddedTemplateAst];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([EmbeddedTemplateAst]);
templateVisitAll(this, ast.attrs);
templateVisitAll(this, ast.outputs);
templateVisitAll(this, ast.vars);
@@ -959,8 +778,7 @@ class TemplateHumanizer implements TemplateAstVisitor {
return null;
}
visitElement(ast: ElementAst, context: any): any {
- var res = [ElementAst, ast.name];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([ElementAst, ast.name]);
templateVisitAll(this, ast.attrs);
templateVisitAll(this, ast.inputs);
templateVisitAll(this, ast.outputs);
@@ -970,44 +788,38 @@ class TemplateHumanizer implements TemplateAstVisitor {
return null;
}
visitVariable(ast: VariableAst, context: any): any {
- var res = [VariableAst, ast.name, ast.value];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([VariableAst, ast.name, ast.value]);
return null;
}
visitEvent(ast: BoundEventAst, context: any): any {
- var res = [BoundEventAst, ast.name, ast.target, expressionUnparser.unparse(ast.handler)];
- this.result.push(this._appendContext(ast, res));
+ this.result.push(
+ [BoundEventAst, ast.name, ast.target, expressionUnparser.unparse(ast.handler)]);
return null;
}
visitElementProperty(ast: BoundElementPropertyAst, context: any): any {
- var res = [
+ this.result.push([
BoundElementPropertyAst,
ast.type,
ast.name,
expressionUnparser.unparse(ast.value),
ast.unit
- ];
- this.result.push(this._appendContext(ast, res));
+ ]);
return null;
}
visitAttr(ast: AttrAst, context: any): any {
- var res = [AttrAst, ast.name, ast.value];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([AttrAst, ast.name, ast.value]);
return null;
}
visitBoundText(ast: BoundTextAst, context: any): any {
- var res = [BoundTextAst, expressionUnparser.unparse(ast.value)];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([BoundTextAst, expressionUnparser.unparse(ast.value)]);
return null;
}
visitText(ast: TextAst, context: any): any {
- var res = [TextAst, ast.value];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([TextAst, ast.value]);
return null;
}
visitDirective(ast: DirectiveAst, context: any): any {
- var res = [DirectiveAst, ast.directive];
- this.result.push(this._appendContext(ast, res));
+ this.result.push([DirectiveAst, ast.directive]);
templateVisitAll(this, ast.inputs);
templateVisitAll(this, ast.hostProperties);
templateVisitAll(this, ast.hostEvents);
@@ -1015,16 +827,10 @@ class TemplateHumanizer implements TemplateAstVisitor {
return null;
}
visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any {
- var res = [BoundDirectivePropertyAst, ast.directiveName, expressionUnparser.unparse(ast.value)];
- this.result.push(this._appendContext(ast, res));
+ this.result.push(
+ [BoundDirectivePropertyAst, ast.directiveName, expressionUnparser.unparse(ast.value)]);
return null;
}
-
- private _appendContext(ast: TemplateAst, input: any[]): any[] {
- if (!this.includeSourceSpan) return input;
- input.push(ast.sourceSpan.toString());
- return input;
- }
}
function sourceInfo(ast: TemplateAst): string {
diff --git a/modules/angular2/test/core/linker/integration_spec.ts b/modules/angular2/test/core/linker/integration_spec.ts
index fc330b2338..37a52345d4 100644
--- a/modules/angular2/test/core/linker/integration_spec.ts
+++ b/modules/angular2/test/core/linker/integration_spec.ts
@@ -9,7 +9,7 @@ import {
expect,
iit,
inject,
- beforeEachProviders,
+ beforeEachBindings,
it,
xit,
containsRegexp,
@@ -99,7 +99,7 @@ const ANCHOR_ELEMENT = CONST_EXPR(new OpaqueToken('AnchorElement'));
export function main() {
describe('integration tests', function() {
- beforeEachProviders(() => [provide(ANCHOR_ELEMENT, {useValue: el('
')})]);
+ beforeEachBindings(() => [provide(ANCHOR_ELEMENT, {useValue: el('
')})]);
describe('react to record changes', function() {
it('should consume text node changes',
@@ -536,21 +536,21 @@ export function main() {
})}));
it('should assign a directive to a var-',
- inject(
- [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MyComp, new ViewMetadata({
- template: '
',
- directives: [ExportDir]
- }))
+ inject([TestComponentBuilder, AsyncTestCompleter],
+ (tcb: TestComponentBuilder, async) => {
+ tcb.overrideView(MyComp, new ViewMetadata({
+ template: '
',
+ directives: [ExportDir]
+ }))
- .createAsync(MyComp)
- .then((fixture) => {
- expect(fixture.debugElement.componentViewChildren[0].getLocal('localdir'))
- .toBeAnInstanceOf(ExportDir);
+ .createAsync(MyComp)
+ .then((fixture) => {
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('localdir'))
+ .toBeAnInstanceOf(ExportDir);
- async.done();
- });
- }));
+ async.done();
+ });
+ }));
it('should make the assigned component accessible in property bindings',
inject(
@@ -616,9 +616,9 @@ export function main() {
it('should assign the element instance to a user-defined variable',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MyComp, new ViewMetadata({
- template: '
'
- }))
+ tcb.overrideView(MyComp,
+ new ViewMetadata(
+ {template: '
Hello
'}))
.createAsync(MyComp)
.then((fixture) => {
@@ -1514,7 +1514,7 @@ export function main() {
PromiseWrapper.catchError(tcb.createAsync(MyComp), (e) => {
expect(e.message).toEqual(
- `Template parse errors:\nCan't bind to 'unknown' since it isn't a known native property ("
"): MyComp@0:5`);
+ `Template parse errors:\nCan't bind to 'unknown' since it isn't a known native property in MyComp > div:nth-child(0)[unknown={{ctxProp}}]`);
async.done();
return null;
});
@@ -1572,7 +1572,7 @@ export function main() {
});
describe('logging property updates', () => {
- beforeEachProviders(() => [
+ beforeEachBindings(() => [
provide(ChangeDetectorGenConfig,
{useValue: new ChangeDetectorGenConfig(true, true, false)})
]);
diff --git a/modules/angular2/test/core/linker/projection_integration_spec.ts b/modules/angular2/test/core/linker/projection_integration_spec.ts
index 8bc47d2e63..df4031ddea 100644
--- a/modules/angular2/test/core/linker/projection_integration_spec.ts
+++ b/modules/angular2/test/core/linker/projection_integration_spec.ts
@@ -569,7 +569,7 @@ class Empty {
@Component({selector: 'multiple-content-tags'})
@View({
- template: '(
,
)',
+ template: '(
,
)',
directives: []
})
class MultipleContentTagsComponent {
diff --git a/modules/playground/src/zippy_component/zippy.html b/modules/playground/src/zippy_component/zippy.html
index 4d5c36fb45..418bdc9ab8 100644
--- a/modules/playground/src/zippy_component/zippy.html
+++ b/modules/playground/src/zippy_component/zippy.html
@@ -1,6 +1,6 @@
- {{ visible ? '▾' : '▸' }} {{title}}
+ {{ visible ? '▾' : '▸' }} {{title}}