From 1000fb8406f2220ebb99e6d06e6559a4eecdaa16 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Wed, 1 Aug 2018 21:39:31 -0700 Subject: [PATCH] test(ivy): add tests for attributes and bound attributes to the tpl transform (#25272) PR Close #25272 --- .../test/render3/r3_template_transform_spec.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/compiler/test/render3/r3_template_transform_spec.ts b/packages/compiler/test/render3/r3_template_transform_spec.ts index f172257929..79c359e3d2 100644 --- a/packages/compiler/test/render3/r3_template_transform_spec.ts +++ b/packages/compiler/test/render3/r3_template_transform_spec.ts @@ -9,10 +9,8 @@ import {BindingType} from '../../src/expression_parser/ast'; import {Lexer} from '../../src/expression_parser/lexer'; import {Parser} from '../../src/expression_parser/parser'; -import {visitAll} from '../../src/ml_parser/ast'; import {HtmlParser} from '../../src/ml_parser/html_parser'; import {DEFAULT_INTERPOLATION_CONFIG} from '../../src/ml_parser/interpolation_config'; -import {ParseError} from '../../src/parse_util'; import * as t from '../../src/render3/r3_ast'; import {Render3ParseResult, htmlAstToRender3Ast} from '../../src/render3/r3_template_transform'; import {BindingParser} from '../../src/template_parser/binding_parser'; @@ -283,6 +281,22 @@ describe('R3 template transform', () => { ['Variable', 'a', 'b'], ]); }); + + it('should parse attributes', () => { + expectFromHtml('').toEqual([ + ['Template'], + ['TextAttribute', 'k1', 'v1'], + ['TextAttribute', 'k2', 'v2'], + ]); + }); + + it('should parse bound attributes', () => { + expectFromHtml('').toEqual([ + ['Template'], + ['BoundAttribute', BindingType.Property, 'k1', 'v1'], + ['BoundAttribute', BindingType.Property, 'k2', 'v2'], + ]); + }); }); describe('inline templates', () => {