test(ivy): add tests for attributes and bound attributes to the tpl transform (#25272)
PR Close #25272
This commit is contained in:

committed by
Kara Erickson

parent
b38931b484
commit
1000fb8406
@ -9,10 +9,8 @@
|
|||||||
import {BindingType} from '../../src/expression_parser/ast';
|
import {BindingType} from '../../src/expression_parser/ast';
|
||||||
import {Lexer} from '../../src/expression_parser/lexer';
|
import {Lexer} from '../../src/expression_parser/lexer';
|
||||||
import {Parser} from '../../src/expression_parser/parser';
|
import {Parser} from '../../src/expression_parser/parser';
|
||||||
import {visitAll} from '../../src/ml_parser/ast';
|
|
||||||
import {HtmlParser} from '../../src/ml_parser/html_parser';
|
import {HtmlParser} from '../../src/ml_parser/html_parser';
|
||||||
import {DEFAULT_INTERPOLATION_CONFIG} from '../../src/ml_parser/interpolation_config';
|
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 * as t from '../../src/render3/r3_ast';
|
||||||
import {Render3ParseResult, htmlAstToRender3Ast} from '../../src/render3/r3_template_transform';
|
import {Render3ParseResult, htmlAstToRender3Ast} from '../../src/render3/r3_template_transform';
|
||||||
import {BindingParser} from '../../src/template_parser/binding_parser';
|
import {BindingParser} from '../../src/template_parser/binding_parser';
|
||||||
@ -283,6 +281,22 @@ describe('R3 template transform', () => {
|
|||||||
['Variable', 'a', 'b'],
|
['Variable', 'a', 'b'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should parse attributes', () => {
|
||||||
|
expectFromHtml('<ng-template k1="v1" k2="v2"></ng-template>').toEqual([
|
||||||
|
['Template'],
|
||||||
|
['TextAttribute', 'k1', 'v1'],
|
||||||
|
['TextAttribute', 'k2', 'v2'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse bound attributes', () => {
|
||||||
|
expectFromHtml('<ng-template [k1]="v1" [k2]="v2"></ng-template>').toEqual([
|
||||||
|
['Template'],
|
||||||
|
['BoundAttribute', BindingType.Property, 'k1', 'v1'],
|
||||||
|
['BoundAttribute', BindingType.Property, 'k2', 'v2'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('inline templates', () => {
|
describe('inline templates', () => {
|
||||||
|
Reference in New Issue
Block a user