diff --git a/packages/compiler/test/render3/r3_ast_spans_spec.ts b/packages/compiler/test/render3/r3_ast_spans_spec.ts index 0afa07a20e..e9c0712074 100644 --- a/packages/compiler/test/render3/r3_ast_spans_spec.ts +++ b/packages/compiler/test/render3/r3_ast_spans_spec.ts @@ -225,6 +225,24 @@ describe('R3 AST source spans', () => { // TODO(joost): improve spans of nodes extracted from macrosyntax describe('inline templates', () => { it('is correct for attribute and bound attributes', () => { + // Desugared form is + // + //
+ //
+ expectFromHtml('
').toEqual([ + ['Template', '0:32', '0:32', '32:38'], + ['TextAttribute', '5:31', ''], + ['BoundAttribute', '5:31', ''], + ['Variable', '5:31', ''], + ['Element', '0:38', '0:32', '32:38'], + ]); + + // Note that this test exercises an *incorrect* usage of the ngFor + // directive. There is a missing 'let' in the beginning of the expression + // which causes the template to be desugared into + // + //
+ //
expectFromHtml('
').toEqual([ ['Template', '0:28', '0:28', '28:34'], ['BoundAttribute', '5:27', ''], diff --git a/packages/compiler/test/render3/r3_template_transform_spec.ts b/packages/compiler/test/render3/r3_template_transform_spec.ts index 1bcadadd4c..13f5e1b41c 100644 --- a/packages/compiler/test/render3/r3_template_transform_spec.ts +++ b/packages/compiler/test/render3/r3_template_transform_spec.ts @@ -290,6 +290,24 @@ describe('R3 template transform', () => { describe('inline templates', () => { it('should support attribute and bound attributes', () => { + // Desugared form is + // + //
+ //
+ expectFromHtml('
').toEqual([ + ['Template'], + ['TextAttribute', 'ngFor', ''], + ['BoundAttribute', BindingType.Property, 'ngForOf', 'items'], + ['Variable', 'item', '$implicit'], + ['Element', 'div'], + ]); + + // Note that this test exercises an *incorrect* usage of the ngFor + // directive. There is a missing 'let' in the beginning of the expression + // which causes the template to be desugared into + // + //
+ //
expectFromHtml('
').toEqual([ ['Template'], ['BoundAttribute', BindingType.Property, 'ngFor', 'item'],