test(ivy): add html to ivy ast transformer tests (#23546)

PR Close #23546
This commit is contained in:
Victor Berchet
2018-04-24 14:22:55 -07:00
committed by Igor Minar
parent c5ca5c0d9f
commit 46674d5fac
15 changed files with 567 additions and 67 deletions

View File

@ -8,7 +8,7 @@
import {CompileDirectiveSummary, CompilePipeSummary} from '../compile_metadata';
import {SecurityContext} from '../core';
import {ASTWithSource, BindingPipe, BoundElementBindingType, BoundElementProperty, EmptyExpr, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast';
import {ASTWithSource, BindingPipe, BindingType, BoundElementProperty, EmptyExpr, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast';
import {Parser} from '../expression_parser/parser';
import {InterpolationConfig} from '../ml_parser/interpolation_config';
import {mergeNsAndName} from '../ml_parser/tags';
@ -239,12 +239,12 @@ export class BindingParser {
BoundElementProperty {
if (boundProp.isAnimation) {
return new BoundElementProperty(
boundProp.name, BoundElementBindingType.Animation, SecurityContext.NONE,
boundProp.expression, null, boundProp.sourceSpan);
boundProp.name, BindingType.Animation, SecurityContext.NONE, boundProp.expression, null,
boundProp.sourceSpan);
}
let unit: string|null = null;
let bindingType: BoundElementBindingType = undefined !;
let bindingType: BindingType = undefined !;
let boundPropertyName: string|null = null;
const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
let securityContexts: SecurityContext[] = undefined !;
@ -264,15 +264,15 @@ export class BindingParser {
boundPropertyName = mergeNsAndName(ns, name);
}
bindingType = BoundElementBindingType.Attribute;
bindingType = BindingType.Attribute;
} else if (parts[0] == CLASS_PREFIX) {
boundPropertyName = parts[1];
bindingType = BoundElementBindingType.Class;
bindingType = BindingType.Class;
securityContexts = [SecurityContext.NONE];
} else if (parts[0] == STYLE_PREFIX) {
unit = parts.length > 2 ? parts[2] : null;
boundPropertyName = parts[1];
bindingType = BoundElementBindingType.Style;
bindingType = BindingType.Style;
securityContexts = [SecurityContext.STYLE];
}
}
@ -282,7 +282,7 @@ export class BindingParser {
boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
securityContexts = calcPossibleSecurityContexts(
this._schemaRegistry, elementSelector, boundPropertyName, false);
bindingType = BoundElementBindingType.Property;
bindingType = BindingType.Property;
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
}

View File

@ -9,7 +9,7 @@
import {AstPath} from '../ast_path';
import {CompileDirectiveSummary, CompileProviderMetadata, CompileTokenMetadata} from '../compile_metadata';
import {SecurityContext} from '../core';
import {AST, BoundElementBindingType, BoundElementProperty, ParsedEvent, ParsedEventType, ParsedVariable} from '../expression_parser/ast';
import {AST, BindingType, BoundElementProperty, ParsedEvent, ParsedEventType, ParsedVariable} from '../expression_parser/ast';
import {LifecycleHooks} from '../lifecycle_reflector';
import {ParseSourceSpan} from '../parse_util';
@ -72,11 +72,11 @@ export enum PropertyBindingType {
}
const BoundPropertyMapping = {
[BoundElementBindingType.Animation]: PropertyBindingType.Animation,
[BoundElementBindingType.Attribute]: PropertyBindingType.Attribute,
[BoundElementBindingType.Class]: PropertyBindingType.Class,
[BoundElementBindingType.Property]: PropertyBindingType.Property,
[BoundElementBindingType.Style]: PropertyBindingType.Style,
[BindingType.Animation]: PropertyBindingType.Animation,
[BindingType.Attribute]: PropertyBindingType.Attribute,
[BindingType.Class]: PropertyBindingType.Class,
[BindingType.Property]: PropertyBindingType.Property,
[BindingType.Style]: PropertyBindingType.Style,
};
/**