From c13f46c7c56ea22e2ff28a4b16179c38bee23288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Tue, 30 Oct 2018 17:03:01 -0700 Subject: [PATCH] fix(ivy): enable packages/core/test/render3 test for AoT (#26863) PR Close #26863 --- .../test/bundling/hello_world_r2/BUILD.bazel | 8 +- .../hello_world_r2/bundle.golden_symbols.json | 3254 +---------------- .../test/bundling/hello_world_r2/index.ts | 4 +- packages/core/test/render3/BUILD.bazel | 2 - .../component_directives_spec.ts | 961 ----- .../content_projection_spec.ts | 98 - .../compiler_canonical/elements_spec.ts | 445 --- .../render3/compiler_canonical/i18n_spec.ts | 147 - .../compiler_canonical/injection_spec.ts | 205 -- .../compiler_canonical/life_cycle_spec.ts | 115 - .../local_reference_spec.ts | 92 - .../compiler_canonical/ng_module_spec.ts | 83 - .../render3/compiler_canonical/normative.md | 11 - .../render3/compiler_canonical/pipes_spec.ts | 219 -- .../render3/compiler_canonical/query_spec.ts | 188 - .../compiler_canonical/sanitize_spec.ts | 81 - .../template_variables_spec.ts | 225 -- packages/core/test/render3/component_spec.ts | 11 +- packages/core/test/render3/i18n_spec.ts | 7 +- packages/core/test/render3/pipe_spec.ts | 10 +- .../test/render3/view_container_ref_spec.ts | 11 +- packages/private/testing/BUILD.bazel | 14 + packages/private/testing/index.ts | 1 + 23 files changed, 54 insertions(+), 6138 deletions(-) delete mode 100644 packages/core/test/render3/compiler_canonical/component_directives_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/content_projection_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/elements_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/i18n_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/injection_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/life_cycle_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/local_reference_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/ng_module_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/normative.md delete mode 100644 packages/core/test/render3/compiler_canonical/pipes_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/query_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/sanitize_spec.ts delete mode 100644 packages/core/test/render3/compiler_canonical/template_variables_spec.ts diff --git a/packages/core/test/bundling/hello_world_r2/BUILD.bazel b/packages/core/test/bundling/hello_world_r2/BUILD.bazel index a0a82e3ce5..72a5c2a69b 100644 --- a/packages/core/test/bundling/hello_world_r2/BUILD.bazel +++ b/packages/core/test/bundling/hello_world_r2/BUILD.bazel @@ -9,11 +9,10 @@ ng_module( srcs = ["index.ts"], tags = [ "ivy-only", - "no-ivy-jit", ], deps = [ "//packages/core", - "//packages/platform-browser-dynamic", + "//packages/platform-browser", ], ) @@ -28,12 +27,11 @@ ng_rollup_bundle( entry_point = "packages/core/test/bundling/hello_world_r2/index.js", tags = [ "ivy-only", - "no-ivy-jit", ], deps = [ ":hello_world", "//packages/core", - "//packages/platform-browser-dynamic", + "//packages/platform-browser", ], ) @@ -43,7 +41,6 @@ ts_library( srcs = glob(["*_spec.ts"]), tags = [ "ivy-only", - "no-ivy-jit", ], deps = [ "//packages:types", @@ -63,7 +60,6 @@ jasmine_node_test( ], tags = [ "ivy-only", - "no-ivy-jit", ], deps = [":test_lib"], ) diff --git a/packages/core/test/bundling/hello_world_r2/bundle.golden_symbols.json b/packages/core/test/bundling/hello_world_r2/bundle.golden_symbols.json index 5a173f3ad6..dc428cb130 100644 --- a/packages/core/test/bundling/hello_world_r2/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hello_world_r2/bundle.golden_symbols.json @@ -1,187 +1,10 @@ [ - { - "name": "$$" - }, - { - "name": "$0" - }, - { - "name": "$9" - }, - { - "name": "$A" - }, - { - "name": "$AMPERSAND" - }, - { - "name": "$BACKSLASH" - }, - { - "name": "$BANG" - }, - { - "name": "$BAR" - }, - { - "name": "$BT" - }, - { - "name": "$CARET" - }, - { - "name": "$COLON" - }, - { - "name": "$COMMA" - }, - { - "name": "$CR" - }, - { - "name": "$DQ" - }, - { - "name": "$E" - }, - { - "name": "$EOF" - }, - { - "name": "$EQ" - }, - { - "name": "$F" - }, - { - "name": "$FF" - }, - { - "name": "$GT" - }, - { - "name": "$HASH" - }, - { - "name": "$LBRACE" - }, - { - "name": "$LBRACKET" - }, - { - "name": "$LF" - }, - { - "name": "$LPAREN" - }, - { - "name": "$LT" - }, - { - "name": "$MINUS" - }, - { - "name": "$NBSP" - }, - { - "name": "$PERCENT" - }, - { - "name": "$PERIOD" - }, - { - "name": "$PLUS" - }, - { - "name": "$QUESTION" - }, - { - "name": "$RBRACE" - }, - { - "name": "$RBRACKET" - }, - { - "name": "$RPAREN" - }, - { - "name": "$SEMICOLON" - }, - { - "name": "$SLASH" - }, - { - "name": "$SPACE" - }, - { - "name": "$SQ" - }, - { - "name": "$STAR" - }, - { - "name": "$TAB" - }, - { - "name": "$VTAB" - }, - { - "name": "$X" - }, - { - "name": "$Z" - }, - { - "name": "$_" - }, - { - "name": "$a" - }, - { - "name": "$e" - }, - { - "name": "$f" - }, - { - "name": "$n" - }, - { - "name": "$r" - }, - { - "name": "$t" - }, - { - "name": "$u" - }, - { - "name": "$v" - }, - { - "name": "$x" - }, - { - "name": "$z" - }, { "name": "ACTIVE_INDEX" }, - { - "name": "ALLOW_DEFAULT_VAR" - }, { "name": "ALLOW_MULTIPLE_PLATFORMS" }, - { - "name": "ANALYZE_FOR_ENTRY_COMPONENTS" - }, - { - "name": "ANIMATE_PROP_PREFIX" - }, - { - "name": "ANNOTATIONS" - }, { "name": "APP_BOOTSTRAP_LISTENER" }, @@ -191,21 +14,6 @@ { "name": "APP_ROOT" }, - { - "name": "AST" - }, - { - "name": "ASTWithSource" - }, - { - "name": "ATTRIBUTE_PREFIX" - }, - { - "name": "AbstractClassPart" - }, - { - "name": "AbstractEmitterVisitor" - }, { "name": "AnonymousSubject" }, @@ -215,81 +23,12 @@ { "name": "ApplicationRef" }, - { - "name": "ArrayType" - }, - { - "name": "AssertNotNull" - }, - { - "name": "AstTransformer" - }, - { - "name": "AstTransformer$1" - }, - { - "name": "AttrAst" - }, - { - "name": "Attribute$1" - }, - { - "name": "B64_DIGITS" - }, { "name": "BINDING_INDEX" }, - { - "name": "BIND_NAME_REGEXP$1" - }, - { - "name": "BLOCK_PLACEHOLDER" - }, { "name": "BLOOM_MASK" }, - { - "name": "BOOLEAN" - }, - { - "name": "BOOL_TYPE" - }, - { - "name": "Binary" - }, - { - "name": "BinaryOperator" - }, - { - "name": "BinaryOperatorExpr" - }, - { - "name": "BindingForm" - }, - { - "name": "BindingParser" - }, - { - "name": "BindingPipe" - }, - { - "name": "BoundDirectivePropertyAst" - }, - { - "name": "BoundElementProperty" - }, - { - "name": "BoundElementPropertyAst" - }, - { - "name": "BoundEventAst" - }, - { - "name": "BoundPropertyMapping" - }, - { - "name": "BoundTextAst" - }, { "name": "BrowserDomAdapter" }, @@ -299,183 +38,30 @@ { "name": "BrowserPlatformLocation" }, - { - "name": "BuiltinFunctionCall" - }, - { - "name": "BuiltinMethod" - }, - { - "name": "BuiltinType" - }, - { - "name": "BuiltinTypeName" - }, - { - "name": "BuiltinVar" - }, - { - "name": "CAMEL_CASE_REGEXP" - }, - { - "name": "CATCH_ERROR_VAR$1" - }, - { - "name": "CATCH_ERROR_VAR$2" - }, - { - "name": "CATCH_STACK_VAR$1" - }, - { - "name": "CATCH_STACK_VAR$2" - }, - { - "name": "CHECK_VAR" - }, { "name": "CIRCULAR" }, { "name": "CIRCULAR$1" }, - { - "name": "CLASS_ATTR" - }, - { - "name": "CLASS_ATTR$1" - }, - { - "name": "CLASS_PREFIX" - }, { "name": "CLEANUP" }, { "name": "CLEAN_PROMISE" }, - { - "name": "CLOSE_CURLY" - }, - { - "name": "COMPILER_OPTIONS" - }, - { - "name": "COMPILER_PROVIDERS" - }, { "name": "COMPONENT_FACTORY_RESOLVER" }, - { - "name": "COMPONENT_VARIABLE" - }, - { - "name": "COMP_VAR" - }, - { - "name": "CONSTANT_PREFIX" - }, { "name": "CONTAINER_INDEX" }, - { - "name": "CONTENT_ATTR" - }, { "name": "CONTEXT" }, - { - "name": "CORE" - }, - { - "name": "CR" - }, - { - "name": "CSS_IMPORT_REGEXP" - }, - { - "name": "CSS_STRIPPABLE_COMMENT_REGEXP" - }, - { - "name": "CUSTOM_ELEMENTS_SCHEMA$1" - }, - { - "name": "CastExpr" - }, - { - "name": "Chain" - }, { "name": "ChangeDetectionStrategy" }, - { - "name": "ChangeDetectionStrategy$1" - }, - { - "name": "ChangeDetectorRef" - }, - { - "name": "ChangeDetectorRefTokenKey" - }, - { - "name": "ClassGetter" - }, - { - "name": "ClassMethod" - }, - { - "name": "ClassStmt" - }, - { - "name": "CodegenComponentFactoryResolver" - }, - { - "name": "CommaExpr" - }, - { - "name": "Comment" - }, - { - "name": "CompileDirectiveMetadata" - }, - { - "name": "CompileMetadataResolver" - }, - { - "name": "CompileNgModuleMetadata" - }, - { - "name": "CompilePipeMetadata" - }, - { - "name": "CompileReflector" - }, - { - "name": "CompileStylesheetMetadata" - }, - { - "name": "CompileSummaryKind" - }, - { - "name": "CompileTemplateMetadata" - }, - { - "name": "CompiledStylesheet" - }, - { - "name": "CompiledTemplate" - }, - { - "name": "Compiler" - }, - { - "name": "CompilerConfig" - }, - { - "name": "CompilerFactory" - }, - { - "name": "CompilerImpl" - }, { "name": "ComponentFactory" }, @@ -491,66 +77,21 @@ { "name": "ComponentFactoryResolver$1" }, - { - "name": "ComponentFactory_" - }, { "name": "ComponentRef" }, { "name": "ComponentRef$1" }, - { - "name": "ComponentRef_" - }, - { - "name": "Conditional" - }, - { - "name": "ConditionalExpr" - }, { "name": "ConnectableSubscriber" }, { "name": "Console" }, - { - "name": "ConstantPool" - }, - { - "name": "Container" - }, - { - "name": "ConvertActionBindingResult" - }, - { - "name": "ConvertPropertyBindingResult" - }, - { - "name": "CssRule" - }, - { - "name": "CssSelector" - }, - { - "name": "DASH_CASE_REGEXP" - }, { "name": "DECLARATION_VIEW" }, - { - "name": "DEFAULT_INTERPOLATION_CONFIG" - }, - { - "name": "DEFAULT_PACKAGE_URL_PROVIDER" - }, - { - "name": "DEFINITION_CACHE" - }, - { - "name": "DELEGATE_CTOR" - }, { "name": "DOCUMENT" }, @@ -560,54 +101,6 @@ { "name": "DOM_KEY_LOCATION_NUMPAD" }, - { - "name": "DYNAMIC_TYPE" - }, - { - "name": "DebugAction" - }, - { - "name": "DebugContext_" - }, - { - "name": "DebugElement" - }, - { - "name": "DebugNode" - }, - { - "name": "DebugRenderer2" - }, - { - "name": "DebugRendererFactory2" - }, - { - "name": "Declaration" - }, - { - "name": "DeclareFunctionStmt" - }, - { - "name": "DeclareVarStmt" - }, - { - "name": "DefaultLocalResolver" - }, - { - "name": "DirectiveAst" - }, - { - "name": "DirectiveNormalizer" - }, - { - "name": "DirectiveResolver" - }, - { - "name": "Doctype" - }, - { - "name": "DomElementSchemaRegistry" - }, { "name": "EMPTY" }, @@ -620,36 +113,12 @@ { "name": "EMPTY_ARRAY$1" }, - { - "name": "EMPTY_ARRAY$4" - }, - { - "name": "EMPTY_CONTEXT" - }, - { - "name": "EMPTY_ELEMENT_CONTEXT" - }, - { - "name": "EMPTY_MAP" - }, { "name": "EMPTY_PAYLOAD" }, - { - "name": "EMPTY_RENDERER_TYPE_ID" - }, - { - "name": "EOF" - }, - { - "name": "ERROR_COLLECTOR_TOKEN" - }, { "name": "ERROR_COMPONENT" }, - { - "name": "ERROR_COMPONENT_TYPE" - }, { "name": "ERROR_DEBUG_CONTEXT" }, @@ -659,225 +128,51 @@ { "name": "ERROR_ORIGINAL_ERROR" }, - { - "name": "ERROR_PARSE_ERRORS" - }, - { - "name": "ERROR_SYNTAX_ERROR" - }, - { - "name": "EVENT_NAME_VAR" - }, - { - "name": "Element$1" - }, - { - "name": "ElementAst" - }, - { - "name": "ElementContext" - }, - { - "name": "ElementOrDirectiveRef" - }, { "name": "ElementRef" }, - { - "name": "ElementRefTokenKey" - }, - { - "name": "ElementSchemaRegistry" - }, - { - "name": "EmbeddedTemplateAst" - }, - { - "name": "EmitterVisitorContext" - }, { "name": "EmptyErrorImpl" }, - { - "name": "EmptyExpr" - }, - { - "name": "Endian" - }, { "name": "ErrorHandler" }, { "name": "EventEmitter" }, - { - "name": "EventHandlerVars" - }, - { - "name": "EventListener" - }, - { - "name": "ExampleVisitor" - }, - { - "name": "Expansion" - }, - { - "name": "ExpansionCase" - }, - { - "name": "ExpansionError" - }, - { - "name": "ExpansionResult" - }, - { - "name": "Expression" - }, - { - "name": "ExpressionStatement" - }, - { - "name": "ExpressionType" - }, - { - "name": "ExternalExpr" - }, - { - "name": "ExtractionResult" - }, { "name": "FLAGS" }, { "name": "FactoryPrototype" }, - { - "name": "FixupExpression" - }, - { - "name": "FnParam" - }, - { - "name": "FunctionCall" - }, - { - "name": "FunctionExpr" - }, - { - "name": "GOOG_GET_MSG" - }, { "name": "HEADER_OFFSET" }, { "name": "HOST" }, - { - "name": "HOST_ATTR" - }, { "name": "HOST_NODE" }, - { - "name": "HOST_REG_EXP" - }, { "name": "HelloWorldComponent" }, { "name": "HelloWorldModule" }, - { - "name": "HtmlParser" - }, - { - "name": "HtmlTagDefinition" - }, - { - "name": "I18NHtmlParser" - }, - { - "name": "I18N_ID_SEPARATOR" - }, - { - "name": "I18N_MEANING_SEPARATOR" - }, - { - "name": "I18nError" - }, - { - "name": "I18nToHtmlVisitor" - }, { "name": "IDENT" }, - { - "name": "IDENT_BANANA_BOX_IDX$1" - }, - { - "name": "IDENT_EVENT_IDX$1" - }, - { - "name": "IDENT_KW_IDX$1" - }, - { - "name": "IDENT_PROPERTY_IDX$1" - }, - { - "name": "ID_SEPARATOR" - }, - { - "name": "IMPLICIT_TEMPLATE_VAR" - }, - { - "name": "INFERRED_TYPE" - }, - { - "name": "INHERITED_CLASS" - }, - { - "name": "INHERITED_CLASS_WITH_CTOR" - }, { "name": "INJECTOR" }, { "name": "INJECTOR$1" }, - { - "name": "INJECTORRefTokenKey" - }, - { - "name": "INJECTORRefTokenKey$1" - }, { "name": "INJECTOR_SIZE" }, - { - "name": "INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS" - }, - { - "name": "INTERNAL_BROWSER_PLATFORM_PROVIDERS" - }, - { - "name": "INTERPOLATION_BLACKLIST_REGEXPS" - }, - { - "name": "Icu" - }, - { - "name": "IcuPlaceholder" - }, - { - "name": "Identifiers" - }, - { - "name": "IfStmt" - }, - { - "name": "ImplicitReceiver" - }, { "name": "Inject" }, @@ -887,144 +182,12 @@ { "name": "Injector" }, - { - "name": "InjectorRefTokenKey" - }, - { - "name": "InjectorRefTokenKey$1" - }, - { - "name": "Injector_" - }, { "name": "InnerSubscriber" }, - { - "name": "InstantiateExpr" - }, - { - "name": "Interpolation" - }, - { - "name": "InterpolationConfig" - }, - { - "name": "InvokeFunctionExpr" - }, - { - "name": "InvokeMethodExpr" - }, - { - "name": "JSDocCommentStmt" - }, - { - "name": "JS_B64_PREFIX" - }, - { - "name": "JitCompiler" - }, - { - "name": "JitEmitterVisitor" - }, - { - "name": "JitReflector" - }, - { - "name": "JitSummaryResolver" - }, - { - "name": "KEYWORDS" - }, - { - "name": "KEY_CONTEXT" - }, - { - "name": "KW_AT_IDX$1" - }, - { - "name": "KW_BINDON_IDX$1" - }, - { - "name": "KW_BIND_IDX$1" - }, - { - "name": "KW_LET_IDX$1" - }, - { - "name": "KW_ON_IDX$1" - }, - { - "name": "KW_REF_IDX$1" - }, - { - "name": "KeyVisitor" - }, - { - "name": "KeyedRead" - }, - { - "name": "KeyedWrite" - }, - { - "name": "LIFECYCLE_HOOKS_VALUES" - }, - { - "name": "LINK_ELEMENT" - }, - { - "name": "LINK_STYLE_HREF_ATTR" - }, - { - "name": "LINK_STYLE_REL_ATTR" - }, - { - "name": "LINK_STYLE_REL_VALUE" - }, - { - "name": "LOCALE_ID" - }, - { - "name": "LOG_VAR" - }, - { - "name": "LOG_VAR$1" - }, - { - "name": "Lexer" - }, - { - "name": "LifecycleHooks" - }, { "name": "LifecycleHooksFeature" }, - { - "name": "LiteralArray" - }, - { - "name": "LiteralArrayExpr" - }, - { - "name": "LiteralExpr" - }, - { - "name": "LiteralMap" - }, - { - "name": "LiteralMapEntry" - }, - { - "name": "LiteralMapExpr" - }, - { - "name": "LiteralPrimitive" - }, - { - "name": "MEANING_SEPARATOR" - }, - { - "name": "MODULE_SUFFIX" - }, { "name": "MONKEY_PATCH_KEY_NAME" }, @@ -1037,33 +200,15 @@ { "name": "MapSubscriber" }, - { - "name": "MapType" - }, { "name": "MergeMapOperator" }, { "name": "MergeMapSubscriber" }, - { - "name": "Message" - }, - { - "name": "MethodCall" - }, - { - "name": "MissingTranslationStrategy" - }, - { - "name": "MissingTranslationStrategy$1" - }, { "name": "MulticastOperator" }, - { - "name": "NAMED_ENTITIES" - }, { "name": "NATIVE" }, @@ -1073,15 +218,9 @@ { "name": "NEXT" }, - { - "name": "NGSP_UNICODE" - }, { "name": "NG_COMPONENT_DEF" }, - { - "name": "NG_CONTENT_SELECT_ATTR" - }, { "name": "NG_DIRECTIVE_DEF" }, @@ -1097,15 +236,9 @@ { "name": "NG_MODULE_DEF" }, - { - "name": "NG_NON_BINDABLE_ATTR" - }, { "name": "NG_PIPE_DEF" }, - { - "name": "NG_PROJECT_AS" - }, { "name": "NG_PROJECT_AS_ATTR_NAME" }, @@ -1115,120 +248,54 @@ { "name": "NG_TOKEN_PATH" }, - { - "name": "NON_BINDABLE_VISITOR$1" - }, - { - "name": "NOOP" - }, { "name": "NOT_FOUND" }, - { - "name": "NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR" - }, { "name": "NOT_YET" }, { "name": "NO_CHANGE" }, - { - "name": "NO_ERRORS_SCHEMA$1" - }, { "name": "NO_NEW_LINE" }, { "name": "NO_PARENT_INJECTOR" }, - { - "name": "NO_WS_REGEXP" - }, - { - "name": "NS_PREFIX_RE" - }, - { - "name": "NULL_EXPR" - }, { "name": "NULL_INJECTOR" }, { "name": "NULL_INJECTOR$2" }, - { - "name": "NUMBER" - }, - { - "name": "NgContentAst" - }, - { - "name": "NgModuleCompileResult" - }, - { - "name": "NgModuleCompiler" - }, { "name": "NgModuleFactory" }, { "name": "NgModuleFactory$1" }, - { - "name": "NgModuleFactory_" - }, - { - "name": "NgModuleProviderAnalyzer" - }, { "name": "NgModuleRef" }, { "name": "NgModuleRef$1" }, - { - "name": "NgModuleRefTokenKey" - }, - { - "name": "NgModuleRef_" - }, - { - "name": "NgModuleResolver" - }, { "name": "NgZone" }, { "name": "NodeInjector" }, - { - "name": "NodeInjector$1" - }, { "name": "NodeInjectorFactory" }, - { - "name": "NonBindableVisitor$1" - }, - { - "name": "NonNullAssert" - }, { "name": "NoopNgZone" }, - { - "name": "NotExpr" - }, { "name": "NullInjector" }, - { - "name": "OBJECT" - }, - { - "name": "OPEN_CURLY" - }, { "name": "ObjectUnsubscribedError" }, @@ -1244,9 +311,6 @@ { "name": "OuterSubscriber" }, - { - "name": "PACKAGE_ROOT_URL" - }, { "name": "PARAMETERS" }, @@ -1265,126 +329,15 @@ { "name": "PLATFORM_INITIALIZER" }, - { - "name": "PLURAL_CASES" - }, - { - "name": "PRESERVE_WS_ATTR_NAME" - }, - { - "name": "PROPERTY_PARTS_SEPARATOR" - }, - { - "name": "PROP_METADATA" - }, - { - "name": "ParseError" - }, - { - "name": "ParseErrorLevel" - }, - { - "name": "ParseLocation" - }, - { - "name": "ParseSourceFile" - }, - { - "name": "ParseSourceSpan" - }, - { - "name": "ParseSpan" - }, - { - "name": "ParseTreeResult" - }, - { - "name": "ParsedEvent" - }, - { - "name": "ParsedProperty" - }, - { - "name": "ParsedPropertyType" - }, - { - "name": "ParsedVariable" - }, - { - "name": "Parser" - }, - { - "name": "Parser$1" - }, - { - "name": "ParserError" - }, - { - "name": "PipeCollector" - }, - { - "name": "PipeResolver" - }, - { - "name": "Placeholder" - }, - { - "name": "PlaceholderRegistry" - }, { "name": "PlatformLocation" }, { "name": "PlatformRef" }, - { - "name": "PrefixNot" - }, - { - "name": "PreparsedElement" - }, - { - "name": "PreparsedElementType" - }, - { - "name": "PropertyRead" - }, - { - "name": "PropertyWrite" - }, - { - "name": "ProviderAst" - }, - { - "name": "ProviderAstType" - }, - { - "name": "ProviderElementContext" - }, - { - "name": "ProviderError" - }, - { - "name": "ProviderMeta" - }, - { - "name": "ProviderViewContext" - }, { "name": "QUERIES" }, - { - "name": "QUERY_METADATA_IDENTIFIERS" - }, - { - "name": "QUOTED_KEYS" - }, - { - "name": "QueryList$1" - }, - { - "name": "Quote" - }, { "name": "R3Injector" }, @@ -1397,63 +350,15 @@ { "name": "ROOT_CONTEXT" }, - { - "name": "ReadKeyExpr" - }, - { - "name": "ReadPropExpr" - }, - { - "name": "ReadVarExpr" - }, - { - "name": "RecurseVisitor" - }, - { - "name": "RecursiveAstVisitor$1" - }, { "name": "RefCountOperator" }, { "name": "RefCountSubscriber" }, - { - "name": "ReferenceAst" - }, - { - "name": "ReflectionCapabilities" - }, - { - "name": "Renderer" - }, - { - "name": "Renderer2" - }, - { - "name": "Renderer2TokenKey" - }, - { - "name": "RendererAdapter" - }, { "name": "RendererFactory2" }, - { - "name": "RendererV1TokenKey" - }, - { - "name": "ResourceLoader" - }, - { - "name": "ResourceLoaderImpl" - }, - { - "name": "ReturnStatement" - }, - { - "name": "ReturnValue" - }, { "name": "RootViewRef" }, @@ -1463,144 +368,27 @@ { "name": "SCHEDULER" }, - { - "name": "SCHEMA" - }, - { - "name": "SCRIPT_ELEMENT" - }, - { - "name": "SECURITY_SCHEMA" - }, - { - "name": "SKIP_WS_TRIM_TAGS" - }, { "name": "SOURCE" }, - { - "name": "STRING" - }, - { - "name": "STRING_MAP_PROTO" - }, - { - "name": "STYLE_ATTR" - }, - { - "name": "STYLE_ELEMENT" - }, - { - "name": "STYLE_PREFIX" - }, - { - "name": "SWITCH_CHANGE_DETECTOR_REF_FACTORY" - }, { "name": "SWITCH_ELEMENT_REF_FACTORY" }, { "name": "SWITCH_INJECTOR_FACTORY" }, - { - "name": "SWITCH_RENDERER2_FACTORY" - }, - { - "name": "SWITCH_TEMPLATE_REF_FACTORY" - }, - { - "name": "SWITCH_VIEW_CONTAINER_REF_FACTORY" - }, - { - "name": "SafeMethodCall" - }, - { - "name": "SafePropertyRead" - }, - { - "name": "SafeSelector" - }, { "name": "SafeSubscriber" }, - { - "name": "Sanitizer" - }, - { - "name": "SecurityContext" - }, - { - "name": "SecurityContext$1" - }, - { - "name": "SelectorContext" - }, - { - "name": "SelectorListContext" - }, - { - "name": "SelectorMatcher" - }, { "name": "Self" }, - { - "name": "Serializer" - }, - { - "name": "Services" - }, - { - "name": "ShadowCss" - }, - { - "name": "SimpleChange" - }, - { - "name": "SimpleExpressionChecker" - }, - { - "name": "SimplePlaceholderMapper" - }, { "name": "SkipSelf" }, - { - "name": "SourceMapGenerator" - }, - { - "name": "SplitInterpolation" - }, - { - "name": "Statement" - }, - { - "name": "StatementInterpreter" - }, { "name": "StaticInjector" }, - { - "name": "StaticSymbol" - }, - { - "name": "StaticSymbolCache" - }, - { - "name": "StmtModifier" - }, - { - "name": "StringWithEscapedBlocks" - }, - { - "name": "StyleCompiler" - }, - { - "name": "StyleWithImports" - }, - { - "name": "StylesCompileDependency" - }, { "name": "Subject" }, @@ -1616,159 +404,21 @@ { "name": "Subscription" }, - { - "name": "SummaryResolver" - }, - { - "name": "SyncAsync" - }, - { - "name": "TAG_TO_PLACEHOLDER_NAMES" - }, - { - "name": "TAIL" - }, - { - "name": "TEMPLATE_ATTR_PREFIX$1" - }, - { - "name": "TEXT_CSS_SELECTOR" - }, { "name": "THROW_IF_NOT_FOUND" }, { "name": "TNODE" }, - { - "name": "TRANSLATIONS" - }, - { - "name": "TRANSLATIONS_FORMAT" - }, - { - "name": "TRANSLATION_PREFIX" - }, { "name": "TVIEW" }, - { - "name": "TYPED_NULL_EXPR" - }, - { - "name": "Tag" - }, - { - "name": "TagContentType" - }, - { - "name": "TagPlaceholder" - }, - { - "name": "TemplateBinding" - }, - { - "name": "TemplateBindingParseResult" - }, - { - "name": "TemplateParseError" - }, - { - "name": "TemplateParseResult" - }, - { - "name": "TemplateParseVisitor" - }, - { - "name": "TemplateParser" - }, - { - "name": "TemplatePreparseVisitor" - }, - { - "name": "TemplateRef" - }, - { - "name": "TemplateRefTokenKey" - }, - { - "name": "TemplateRef_" - }, { "name": "Testability" }, { "name": "TestabilityRegistry" }, - { - "name": "Text" - }, - { - "name": "Text$2" - }, - { - "name": "Text$3" - }, - { - "name": "TextAst" - }, - { - "name": "ThrowStmt" - }, - { - "name": "Token" - }, - { - "name": "Token$1" - }, - { - "name": "TokenError" - }, - { - "name": "TokenType" - }, - { - "name": "TokenType$1" - }, - { - "name": "TokenizeResult" - }, - { - "name": "TransitiveCompileNgModuleMetadata" - }, - { - "name": "TranslationBundle" - }, - { - "name": "TreeError" - }, - { - "name": "TryCatchStmt" - }, - { - "name": "Type" - }, - { - "name": "Type$1" - }, - { - "name": "Type$2" - }, - { - "name": "TypeModifier" - }, - { - "name": "TypeofExpr" - }, - { - "name": "UNDEFINED_RENDERER_TYPE_ID" - }, - { - "name": "UNDEFINED_VALUE" - }, - { - "name": "URL_WITH_SCHEMA_REGEXP" - }, { "name": "USE_VALUE" }, @@ -1778,339 +428,30 @@ { "name": "UnsubscriptionErrorImpl" }, - { - "name": "UrlResolver" - }, - { - "name": "VERSION" - }, - { - "name": "VERSION$1" - }, { "name": "VIEWS" }, - { - "name": "VIEW_VAR" - }, - { - "name": "ValueTransformer" - }, - { - "name": "VariableAst" - }, { "name": "Version" }, - { - "name": "ViewAction" - }, - { - "name": "ViewBuilder$1" - }, - { - "name": "ViewCompileResult" - }, - { - "name": "ViewCompiler" - }, - { - "name": "ViewContainerRef" - }, - { - "name": "ViewContainerRefTokenKey" - }, - { - "name": "ViewContainerRef_" - }, { "name": "ViewEncapsulation" }, - { - "name": "ViewEncapsulation$1" - }, - { - "name": "ViewRef" - }, - { - "name": "ViewRef_" - }, { "name": "WRAP_RENDERER_FACTORY2" }, - { - "name": "WS_CHARS" - }, - { - "name": "WS_REPLACE_REGEXP" - }, - { - "name": "WhitespaceVisitor" - }, - { - "name": "WrappedValue" - }, - { - "name": "WriteKeyExpr" - }, - { - "name": "WritePropExpr" - }, - { - "name": "WriteVarExpr" - }, - { - "name": "Xliff" - }, - { - "name": "Xliff2" - }, - { - "name": "Xliff2Parser" - }, - { - "name": "XliffParser" - }, - { - "name": "Xmb" - }, - { - "name": "XmlParser" - }, - { - "name": "XmlToI18n" - }, - { - "name": "XmlToI18n$1" - }, - { - "name": "XmlToI18n$2" - }, - { - "name": "Xtb" - }, - { - "name": "XtbParser" - }, - { - "name": "_ATTR_TO_PROP" - }, - { - "name": "_ApplySourceSpanTransformer" - }, - { - "name": "_AstToIrVisitor" - }, - { - "name": "_BuiltinAstConverter" - }, { "name": "_CLEAN_PROMISE" }, - { - "name": "_CONTEXT_GROUP_TAG" - }, - { - "name": "_CONTEXT_TAG" - }, - { - "name": "_CR_OR_CRLF_REGEXP" - }, - { - "name": "_CUSTOM_PH_EXP" - }, - { - "name": "_CompileValueConverter" - }, - { - "name": "_ComponentIndex" - }, - { - "name": "_ControlFlowError" - }, - { - "name": "_DEFAULT_SOURCE_LANG" - }, - { - "name": "_DEFAULT_SOURCE_LANG$1" - }, - { - "name": "_DOCTYPE" - }, { "name": "_DOM" }, - { - "name": "_ESCAPED_CHARS" - }, - { - "name": "_EXAMPLE_TAG" - }, - { - "name": "_EmittedLine" - }, - { - "name": "_ExecutionContext" - }, - { - "name": "_Expander" - }, - { - "name": "_FILE_TAG" - }, - { - "name": "_I18N_ATTR" - }, - { - "name": "_I18N_ATTR_PREFIX" - }, - { - "name": "_I18N_COMMENT_PREFIX_REGEXP" - }, - { - "name": "_I18nVisitor" - }, - { - "name": "_INDENT_WITH" - }, - { - "name": "_LEGAL_IDENTIFIER_RE" - }, - { - "name": "_MARKER_TAG" - }, - { - "name": "_MARKER_TAG$1" - }, - { - "name": "_MESSAGES_TAG" - }, - { - "name": "_MESSAGE_TAG" - }, - { - "name": "_Mode" - }, - { - "name": "_NO_RESOURCE_LOADER" - }, { "name": "_NullComponentFactoryResolver" }, - { - "name": "_PLACEHOLDER_SPANNING_TAG" - }, - { - "name": "_PLACEHOLDER_TAG" - }, - { - "name": "_PLACEHOLDER_TAG$1" - }, - { - "name": "_PLACEHOLDER_TAG$2" - }, - { - "name": "_PLACEHOLDER_TAG$3" - }, - { - "name": "_ParseAST" - }, - { - "name": "_ReadVarVisitor" - }, - { - "name": "_SEGMENT_SOURCE_TAG" - }, - { - "name": "_SELECTOR_REGEXP" - }, - { - "name": "_SINGLE_QUOTE_ESCAPE_STRING_RE" - }, - { - "name": "_SOURCE_TAG" - }, - { - "name": "_SOURCE_TAG$1" - }, - { - "name": "_SOURCE_TAG$2" - }, - { - "name": "_Scanner" - }, - { - "name": "_SerializerIgnoreIcuExpVisitor" - }, - { - "name": "_SerializerVisitor" - }, - { - "name": "_TAG_DEFINITION" - }, - { - "name": "_TARGET_TAG" - }, - { - "name": "_TARGET_TAG$1" - }, { "name": "_THROW_IF_NOT_FOUND" }, - { - "name": "_TRANSLATIONS_TAG" - }, - { - "name": "_TRANSLATION_TAG" - }, - { - "name": "_Tokenizer" - }, - { - "name": "_TreeBuilder" - }, - { - "name": "_TsEmitterVisitor" - }, - { - "name": "_UNIT_TAG" - }, - { - "name": "_UNIT_TAG$1" - }, - { - "name": "_VERSION" - }, - { - "name": "_VERSION$1" - }, - { - "name": "_ValueOutputAstTransformer" - }, - { - "name": "_Visitor" - }, - { - "name": "_Visitor$2" - }, - { - "name": "_VisitorMode" - }, - { - "name": "_WriteVisitor" - }, - { - "name": "_WriteVisitor$1" - }, - { - "name": "_XLIFF_TAG" - }, - { - "name": "_XMLNS" - }, - { - "name": "_XMLNS$1" - }, { "name": "__assign" }, @@ -2165,90 +506,21 @@ { "name": "__window" }, - { - "name": "_addDebugContext" - }, - { - "name": "_addInterpolationPart" - }, - { - "name": "_addQueryToTokenMap" - }, - { - "name": "_anonymousTypeIndex" - }, { "name": "_attrToPropMap" }, - { - "name": "_buildFromEncodedParts" - }, { "name": "_callAndReportToErrorHandler" }, - { - "name": "_callFactory" - }, { "name": "_chromeNumKeyPadMap" }, - { - "name": "_colonHostContextRe" - }, - { - "name": "_colonHostRe" - }, - { - "name": "_commentRe" - }, - { - "name": "_commentWithHashRe" - }, - { - "name": "_createClass" - }, - { - "name": "_createIndent" - }, - { - "name": "_createInterpolateRegExp" - }, - { - "name": "_createProviderInstance" - }, - { - "name": "_createProviderInstance$1" - }, - { - "name": "_cssColonHostContextRe" - }, - { - "name": "_cssColonHostRe" - }, - { - "name": "_cssContentNextSelectorRe" - }, - { - "name": "_cssContentRuleRe" - }, - { - "name": "_cssContentUnscopedRuleRe" - }, - { - "name": "_curlyRe" - }, { "name": "_currentInjector" }, { "name": "_currentNamespace" }, - { - "name": "_declareFn" - }, - { - "name": "_def" - }, { "name": "_devMode" }, @@ -2258,258 +530,30 @@ { "name": "_enable_super_gross_mode_that_will_cause_bad_things" }, - { - "name": "_executeFunctionStatements" - }, - { - "name": "_expParser" - }, - { - "name": "_expandDefaultForm" - }, - { - "name": "_expandPluralForm" - }, - { - "name": "_extractPlaceholderName" - }, - { - "name": "_getContentQueries" - }, - { - "name": "_getI18nAttr" - }, - { - "name": "_getViewQueries" - }, { "name": "_global" }, - { - "name": "_isClosingComment" - }, - { - "name": "_isEmptyTextNode" - }, - { - "name": "_isOpeningComment" - }, - { - "name": "_isPixelDimensionStyle" - }, - { - "name": "_joinAndCanonicalizePath" - }, { "name": "_keyMap" }, - { - "name": "_lastDefined" - }, - { - "name": "_mergeArrays" - }, - { - "name": "_mergeOptions" - }, - { - "name": "_nativeNodeToDebugNode" - }, - { - "name": "_normalizeArray" - }, - { - "name": "_parenSuffix" - }, - { - "name": "_parseMessageMeta" - }, - { - "name": "_polyfillHost" - }, - { - "name": "_polyfillHostContext" - }, - { - "name": "_polyfillHostNoCombinator" - }, - { - "name": "_polyfillHostNoCombinatorRe" - }, - { - "name": "_polyfillHostRe" - }, - { - "name": "_pureExpressionDef" - }, - { - "name": "_queryElementChildren" - }, - { - "name": "_queryNodeChildren" - }, - { - "name": "_removeDotSegments" - }, { "name": "_renderCompCount" }, - { - "name": "_renderCompCount$1" - }, - { - "name": "_resolveProviders" - }, - { - "name": "_resolveProvidersFromDirectives" - }, - { - "name": "_resolveUrl" - }, - { - "name": "_ruleRe" - }, - { - "name": "_selectorReSuffix" - }, - { - "name": "_shadowDOMSelectorsRe" - }, - { - "name": "_shadowDeepSelectors" - }, - { - "name": "_split" - }, - { - "name": "_splitAt" - }, - { - "name": "_splitRe" - }, - { - "name": "_symbolIterator" - }, { "name": "_testabilityGetter" }, - { - "name": "_throwError" - }, - { - "name": "_toStringWithNull" - }, - { - "name": "_tokenKeyCache" - }, - { - "name": "_transformProvider" - }, - { - "name": "_transformProviderAst" - }, - { - "name": "_unexpectedCharacterErrorMsg" - }, - { - "name": "_unknownEntityErrorMsg" - }, - { - "name": "_visitor" - }, - { - "name": "add32" - }, - { - "name": "add32to64" - }, - { - "name": "add64" - }, - { - "name": "addBigInt" - }, - { - "name": "addRemoveViewFromContainer" - }, - { - "name": "addToArray" - }, - { - "name": "addToViewTree" - }, - { - "name": "anchorDef" - }, { "name": "appendChild" }, - { - "name": "appendNgContent" - }, - { - "name": "applyProviderOverridesToNgModule" - }, - { - "name": "applyProviderOverridesToView" - }, - { - "name": "applySourceSpanToExpressionIfNeeded" - }, - { - "name": "applySourceSpanToStatementIfNeeded" - }, - { - "name": "areAllEquivalent" - }, - { - "name": "areIterablesEqual" - }, - { - "name": "asElementData" - }, - { - "name": "asProviderData" - }, - { - "name": "asPureExpressionData" - }, - { - "name": "asQueryList" - }, - { - "name": "asTextData" - }, - { - "name": "assertArrayOfStrings" - }, - { - "name": "assertComponent" - }, - { - "name": "assertInterpolationSymbols" - }, - { - "name": "assertNotNull" - }, { "name": "assertPlatform" }, - { - "name": "attachEmbeddedView" - }, { "name": "attachPatchData" }, - { - "name": "attachProjectedView" - }, { "name": "baseElement" }, - { - "name": "baseHtmlParser" - }, { "name": "baseResolveDirective" }, @@ -2525,63 +569,9 @@ { "name": "bloomHashBitOrFactory" }, - { - "name": "builtinExternalReferences" - }, - { - "name": "byteAt" - }, - { - "name": "byteStringToDecString" - }, - { - "name": "byteStringToHexString" - }, - { - "name": "calcBindingFlags" - }, - { - "name": "calcPossibleSecurityContexts" - }, - { - "name": "calcQueryValues" - }, - { - "name": "calcStaticDynamicQueryFlags" - }, - { - "name": "callCheckStmt" - }, - { - "name": "callElementProvidersLifecycles" - }, - { - "name": "callFactory" - }, { "name": "callHooks" }, - { - "name": "callLifecycleHooksChildrenFirst" - }, - { - "name": "callNgModuleLifecycle" - }, - { - "name": "callProviderLifecycles" - }, - { - "name": "callUnwrapValue" - }, - { - "name": "callViewAction" - }, - { - "name": "callWithDebugContext" - }, - { - "name": "camelCaseToDashCase" - }, { "name": "canInsertNativeChildOfElement" }, @@ -2594,57 +584,6 @@ { "name": "canReportError" }, - { - "name": "checkAndUpdateBinding" - }, - { - "name": "checkAndUpdateDirectiveDynamic" - }, - { - "name": "checkAndUpdateDirectiveInline" - }, - { - "name": "checkAndUpdateElementDynamic" - }, - { - "name": "checkAndUpdateElementInline" - }, - { - "name": "checkAndUpdateElementValue" - }, - { - "name": "checkAndUpdateNode" - }, - { - "name": "checkAndUpdateNodeDynamic" - }, - { - "name": "checkAndUpdateNodeInline" - }, - { - "name": "checkAndUpdatePureExpressionDynamic" - }, - { - "name": "checkAndUpdatePureExpressionInline" - }, - { - "name": "checkAndUpdateQuery" - }, - { - "name": "checkAndUpdateTextDynamic" - }, - { - "name": "checkAndUpdateTextInline" - }, - { - "name": "checkAndUpdateView" - }, - { - "name": "checkBinding" - }, - { - "name": "checkBindingNoChanges" - }, { "name": "checkNoChanges" }, @@ -2654,60 +593,24 @@ { "name": "checkNoChangesMode" }, - { - "name": "checkNoChangesNode" - }, - { - "name": "checkNoChangesNodeDynamic" - }, - { - "name": "checkNoChangesNodeInline" - }, - { - "name": "checkNoChangesQuery" - }, - { - "name": "checkNoChangesView" - }, { "name": "checkStable" }, { "name": "cleanUpView" }, - { - "name": "cloneNgModuleDefinition" - }, - { - "name": "collectReferences" - }, - { - "name": "compareCharCodeCaseInsensitive" - }, { "name": "compileNgModuleFactory" }, { "name": "compileNgModuleFactory__POST_R3__" }, - { - "name": "componentFactoryName" - }, - { - "name": "componentFactoryResolverProviderDef" - }, { "name": "componentRefresh" }, - { - "name": "componentStillLoadingError" - }, { "name": "computeDeps" }, - { - "name": "computeMsgId" - }, { "name": "config" }, @@ -2717,192 +620,30 @@ { "name": "connectableProto" }, - { - "name": "convertActionBinding" - }, - { - "name": "convertBuiltins" - }, - { - "name": "convertPropertyBinding" - }, - { - "name": "convertPropertyBindingBuiltins" - }, - { - "name": "convertStmtIntoExpression" - }, - { - "name": "convertToStatementIfNeeded" - }, - { - "name": "convertTsickleDecoratorIntoMetadata" - }, - { - "name": "convertValueToOutputAst" - }, { "name": "couldBeInjectableType" }, - { - "name": "createAttribute" - }, - { - "name": "createBuiltinExternalReferencesMap" - }, - { - "name": "createChangeDetectorRef" - }, - { - "name": "createClass" - }, - { - "name": "createComponent" - }, - { - "name": "createComponentFactory" - }, - { - "name": "createComponentView" - }, - { - "name": "createContainerRef" - }, - { - "name": "createContentChild" - }, - { - "name": "createContentChildren" - }, - { - "name": "createCurrValueExpr" - }, - { - "name": "createDebugServices" - }, - { - "name": "createDirective" - }, - { - "name": "createDirectiveInstance" - }, - { - "name": "createDynamicClass" - }, - { - "name": "createElement" - }, - { - "name": "createElementCssSelector" - }, { "name": "createElementRef" }, - { - "name": "createEmbeddedView" - }, - { - "name": "createEmbeddedViewAndNode" - }, - { - "name": "createHost" - }, - { - "name": "createHostBinding" - }, - { - "name": "createHostListener" - }, - { - "name": "createI18nMessageFactory" - }, - { - "name": "createInject" - }, - { - "name": "createInjectable" - }, - { - "name": "createInjectionToken" - }, { "name": "createInjector" }, - { - "name": "createInjector$1" - }, - { - "name": "createInput" - }, - { - "name": "createLContainer" - }, { "name": "createLContext" }, { "name": "createLViewData" }, - { - "name": "createLazyProperty" - }, - { - "name": "createNgModule" - }, - { - "name": "createNgModuleFactory" - }, - { - "name": "createNgModuleRef" - }, { "name": "createNodeAtIndex" }, - { - "name": "createOptional" - }, - { - "name": "createOutput$1" - }, - { - "name": "createOutputContext" - }, - { - "name": "createPipe" - }, - { - "name": "createPipeInstance" - }, { "name": "createPlatform" }, { "name": "createPlatformFactory" }, - { - "name": "createPreventDefaultVar" - }, - { - "name": "createProdRootView" - }, - { - "name": "createProdServices" - }, - { - "name": "createProviderInstance" - }, - { - "name": "createPureExpression" - }, - { - "name": "createQuery$1" - }, - { - "name": "createRendererType2" - }, - { - "name": "createRendererV1" - }, { "name": "createRootComponent" }, @@ -2912,138 +653,27 @@ { "name": "createRootContext" }, - { - "name": "createRootData" - }, - { - "name": "createRootView" - }, { "name": "createScope" }, - { - "name": "createSelf" - }, - { - "name": "createSerializer" - }, - { - "name": "createSkipSelf" - }, { "name": "createTNode" }, { "name": "createTView" }, - { - "name": "createTemplateData" - }, - { - "name": "createTemplateRef" - }, - { - "name": "createText" - }, { "name": "createTextNode" }, - { - "name": "createTokenForExternalReference" - }, - { - "name": "createTokenForReference" - }, - { - "name": "createView" - }, { "name": "createViewBlueprint" }, - { - "name": "createViewChild" - }, - { - "name": "createViewChildren" - }, - { - "name": "createViewContainerData" - }, { "name": "createViewNode" }, - { - "name": "createViewNodes" - }, { "name": "createViewQuery" }, - { - "name": "createViewRef" - }, - { - "name": "dashCaseToCamelCase" - }, - { - "name": "debugCheckAndUpdateNode" - }, - { - "name": "debugCheckAndUpdateView" - }, - { - "name": "debugCheckNoChangesNode" - }, - { - "name": "debugCheckNoChangesView" - }, - { - "name": "debugClearOverrides" - }, - { - "name": "debugCreateComponentView" - }, - { - "name": "debugCreateEmbeddedView" - }, - { - "name": "debugCreateNgModuleRef" - }, - { - "name": "debugCreateRootView" - }, - { - "name": "debugDestroyView" - }, - { - "name": "debugHandleEvent" - }, - { - "name": "debugOutputAstAsTypeScript" - }, - { - "name": "debugOverrideComponentView" - }, - { - "name": "debugOverrideProvider" - }, - { - "name": "debugSetCurrentNode" - }, - { - "name": "debugUpdateDirectives" - }, - { - "name": "debugUpdateRenderer" - }, - { - "name": "decimalDigest" - }, - { - "name": "declaredViewContainer" - }, - { - "name": "dedupeArray" - }, { "name": "deepForEach" }, @@ -3062,30 +692,12 @@ { "name": "defineNgModule" }, - { - "name": "depDef" - }, { "name": "destroyLView" }, - { - "name": "destroyView" - }, - { - "name": "destroyViewNodes" - }, { "name": "destroyViewTree" }, - { - "name": "detachEmbeddedView" - }, - { - "name": "detachProjectedView" - }, - { - "name": "detachView" - }, { "name": "detectChanges" }, @@ -3098,99 +710,24 @@ { "name": "detectWTF" }, - { - "name": "devModeEqual" - }, { "name": "diPublicInInjector" }, - { - "name": "digest" - }, - { - "name": "digest$1" - }, - { - "name": "directiveDef" - }, - { - "name": "dirtyParentQueries" - }, - { - "name": "dispatchEvent" - }, { "name": "domRendererFactory3" }, - { - "name": "elementBindingDef" - }, { "name": "elementCreate" }, - { - "name": "elementDef" - }, - { - "name": "elementEventFullName" - }, - { - "name": "elementEventFullName$1" - }, - { - "name": "elementEventNameAndTarget" - }, { "name": "empty" }, - { - "name": "ensureExpressionMode" - }, - { - "name": "ensureStatementMode" - }, { "name": "enterView" }, - { - "name": "error" - }, { "name": "errorObject" }, - { - "name": "escapeBlocks" - }, - { - "name": "escapeIdentifier" - }, - { - "name": "escapeRegExp" - }, - { - "name": "escapeXml" - }, - { - "name": "evalExpression" - }, - { - "name": "eventHandlerClosure" - }, - { - "name": "execComponentViewsAction" - }, - { - "name": "execEmbeddedViewsAction" - }, - { - "name": "execProjectedViewsAction" - }, - { - "name": "execQueriesAction" - }, - { - "name": "execRenderNodeAction" - }, { "name": "executeHooks" }, @@ -3206,90 +743,27 @@ { "name": "executePipeOnDestroys" }, - { - "name": "expandNodes" - }, - { - "name": "expressionChangedAfterItHasBeenCheckedError" - }, - { - "name": "expressionType" - }, { "name": "extendStatics" }, - { - "name": "extractCommentsWithHash" - }, { "name": "extractDirectiveDef" }, - { - "name": "extractIdentifiers" - }, { "name": "extractPipeDef" }, - { - "name": "extractStyleUrls" - }, - { - "name": "filterQueryId" - }, - { - "name": "findCompView" - }, { "name": "findComponentView" }, - { - "name": "findHostElement" - }, - { - "name": "findLast" - }, - { - "name": "findReadVarNames" - }, - { - "name": "findStaticQueryIds" - }, { "name": "findViaComponent" }, - { - "name": "fingerprint" - }, { "name": "firstTemplatePass" }, - { - "name": "fixedAttrsDef" - }, - { - "name": "fk" - }, - { - "name": "flatten$2" - }, - { - "name": "flatten$3" - }, - { - "name": "flattenAndDedupeArray" - }, - { - "name": "flattenArray" - }, - { - "name": "flattenStatements" - }, { "name": "flattenUnsubscriptionErrors" }, - { - "name": "fn" - }, { "name": "forkInnerZoneWithAngularBehavior" }, @@ -3317,9 +791,6 @@ { "name": "generateExpandoInstructionBlock" }, - { - "name": "getAllLifecycleHooks" - }, { "name": "getBaseElementHref" }, @@ -3344,60 +815,33 @@ { "name": "getComponentViewByInstance" }, - { - "name": "getComponentViewDefinitionFactory" - }, { "name": "getContainerRenderParent" }, { "name": "getCreationMode" }, - { - "name": "getCtypeForTag" - }, - { - "name": "getCurrentDebugContext" - }, - { - "name": "getCurrentSanitizer" - }, { "name": "getDOM" }, { "name": "getDebugContext" }, - { - "name": "getDebugNode" - }, { "name": "getDirectiveDef" }, { "name": "getErrorLogger" }, - { - "name": "getFactoryOf" - }, { "name": "getFirstTemplatePass" }, { "name": "getHighestElementContainer" }, - { - "name": "getHookName" - }, { "name": "getHostNative" }, - { - "name": "getHtmlTagDefinition" - }, - { - "name": "getInheritedFactory" - }, { "name": "getInjectableDef" }, @@ -3428,9 +872,6 @@ { "name": "getNodeInjectable" }, - { - "name": "getNsPrefix" - }, { "name": "getNullInjector" }, @@ -3440,27 +881,18 @@ { "name": "getOrCreateNodeInjectorForNode" }, - { - "name": "getOrCreateRenderer2" - }, { "name": "getOrCreateTView" }, { "name": "getOriginalError" }, - { - "name": "getParentCtor" - }, { "name": "getParentInjectorIndex" }, { "name": "getParentInjectorLocation" }, - { - "name": "getParentInjectorTNode" - }, { "name": "getParentInjectorView" }, @@ -3470,9 +902,6 @@ { "name": "getParentNative" }, - { - "name": "getParentRenderElement" - }, { "name": "getParentState" }, @@ -3488,15 +917,9 @@ { "name": "getPromiseCtor" }, - { - "name": "getQueryValue" - }, { "name": "getRenderFlags" }, - { - "name": "getRenderNodeIndex" - }, { "name": "getRenderParent" }, @@ -3506,12 +929,6 @@ { "name": "getRendererFactory" }, - { - "name": "getStylesVarName" - }, - { - "name": "getSymbolIterator" - }, { "name": "getSymbolIterator$1" }, @@ -3524,96 +941,39 @@ { "name": "getTViewCleanup" }, - { - "name": "getTypeForTag" - }, - { - "name": "getUrlScheme" - }, { "name": "getViewData" }, - { - "name": "getXmlTagDefinition" - }, { "name": "hasDeps" }, - { - "name": "hasLifecycleHook" - }, { "name": "hasOnDestroy" }, { "name": "hasParentInjector" }, - { - "name": "hasPreserveWhitespacesAttr" - }, - { - "name": "hash32" - }, { "name": "hostReportError" }, - { - "name": "hostViewClassName" - }, - { - "name": "i18nCommentsWarned" - }, - { - "name": "i18nMetaToDocStmt" - }, - { - "name": "identifierModuleUrl" - }, - { - "name": "identifierName" - }, { "name": "identity" }, - { - "name": "importExpr" - }, - { - "name": "importType" - }, { "name": "includeViewProviders" }, - { - "name": "indexDebugNode" - }, { "name": "initDomAdapter" }, - { - "name": "initNgModule" - }, { "name": "initNodeFlags" }, - { - "name": "initServicesIfNeeded" - }, - { - "name": "initView" - }, - { - "name": "initialized" - }, { "name": "inject" }, { "name": "injectArgs" }, - { - "name": "injectChangeDetectorRef" - }, { "name": "injectElementRef" }, @@ -3623,105 +983,39 @@ { "name": "injectInjectorOnly" }, - { - "name": "injectRenderer2" - }, { "name": "injectRootLimpMode" }, - { - "name": "injectTemplateRef" - }, - { - "name": "injectViewContainerRef" - }, { "name": "injectableDefFactory" }, - { - "name": "inlineInterpolate" - }, { "name": "insertBloom" }, - { - "name": "insertView" - }, { "name": "instantiateRootComponent" }, - { - "name": "interpolate" - }, - { - "name": "interpretStatements" - }, - { - "name": "invalid" - }, { "name": "invertObject" }, - { - "name": "isAnimationLabel" - }, { "name": "isArray" }, { "name": "isArrayLike" }, - { - "name": "isAsciiHexDigit" - }, - { - "name": "isAsciiLetter" - }, { "name": "isComponent" }, { "name": "isComponentDef" }, - { - "name": "isComponentView" - }, - { - "name": "isDefined" - }, { "name": "isDevMode" }, - { - "name": "isDigit" - }, - { - "name": "isDigitEntityEnd" - }, - { - "name": "isDirectiveMetadata" - }, - { - "name": "isEmbeddedView" - }, - { - "name": "isEmptyExpression" - }, { "name": "isExistingProvider" }, - { - "name": "isExpansionCaseStart" - }, - { - "name": "isExpansionFormStart" - }, - { - "name": "isExponentSign" - }, - { - "name": "isExponentStart" - }, { "name": "isFactory" }, @@ -3731,60 +1025,18 @@ { "name": "isFunction" }, - { - "name": "isIdentifier" - }, - { - "name": "isIdentifierPart" - }, - { - "name": "isIdentifierStart" - }, { "name": "isInteropObservable" }, { "name": "isIterable" }, - { - "name": "isJsObject" - }, { "name": "isLContainer" }, - { - "name": "isListLikeIterable" - }, - { - "name": "isNameEnd" - }, - { - "name": "isNamedEntityEnd" - }, - { - "name": "isNgContainer" - }, - { - "name": "isNgContainer$1" - }, - { - "name": "isNgContent" - }, - { - "name": "isNgTemplate" - }, - { - "name": "isNotWhitespace" - }, { "name": "isObject" }, - { - "name": "isObservable$1" - }, - { - "name": "isPrefixEnd" - }, { "name": "isProceduralRenderer" }, @@ -3794,90 +1046,33 @@ { "name": "isPromise$1" }, - { - "name": "isPromise$2" - }, - { - "name": "isQuote" - }, { "name": "isRootView" }, { "name": "isScheduler" }, - { - "name": "isStrictStringMap" - }, - { - "name": "isStyleUrlResolvable" - }, - { - "name": "isType" - }, { "name": "isTypeProvider" }, - { - "name": "isValidType" - }, { "name": "isValueProvider" }, - { - "name": "isVariable" - }, - { - "name": "isViewDebugError" - }, - { - "name": "isWhitespace" - }, { "name": "iterator" }, - { - "name": "jitSourceUrl" - }, - { - "name": "jitStatements" - }, - { - "name": "lastOnStack" - }, { "name": "leave" }, { "name": "leaveView" }, - { - "name": "lifecycleHookToNodeFlag" - }, - { - "name": "listenToElementOutputs" - }, - { - "name": "literal" - }, - { - "name": "literalArr" - }, - { - "name": "literalMap" - }, { "name": "locateHostElement" }, - { - "name": "looseIdentical" - }, { "name": "makeMetadataCtor" }, - { - "name": "makeMetadataFactory" - }, { "name": "makeParamDecorator" }, @@ -3887,18 +1082,6 @@ { "name": "map" }, - { - "name": "markNodeAsProjectedTemplate" - }, - { - "name": "markParentViewsForCheck" - }, - { - "name": "markParentViewsForCheckProjectedViews" - }, - { - "name": "markProjectedViewsForCheck" - }, { "name": "markViewDirty" }, @@ -3908,42 +1091,9 @@ { "name": "mergeAll" }, - { - "name": "mergeAttributeValue" - }, { "name": "mergeMap" }, - { - "name": "mergeNsAndName" - }, - { - "name": "mergeTextTokens" - }, - { - "name": "mergeTranslations" - }, - { - "name": "mix" - }, - { - "name": "moduleDef" - }, - { - "name": "moduleFactories" - }, - { - "name": "moduleProvideDef" - }, - { - "name": "moduleTransitivelyPresent" - }, - { - "name": "moveEmbeddedView" - }, - { - "name": "multiProviderDef" - }, { "name": "multiProviderMixError" }, @@ -3956,66 +1106,18 @@ { "name": "nativeInsertBefore" }, - { - "name": "nativeNextSibling" - }, { "name": "nativeParentNode" }, - { - "name": "needsAdditionalRootNode" - }, - { - "name": "newCharacterToken" - }, - { - "name": "newErrorToken" - }, - { - "name": "newIdentifierToken" - }, - { - "name": "newKeywordToken" - }, - { - "name": "newNumberToken" - }, - { - "name": "newOperatorToken" - }, - { - "name": "newStringToken" - }, - { - "name": "nextDirectiveWithBinding" - }, { "name": "nextNgElementId" }, - { - "name": "nextRenderNodeWithBinding" - }, - { - "name": "ngContentDef" - }, - { - "name": "ngModuleJitUrl" - }, - { - "name": "ngfactoryFilePath" - }, { "name": "noComponentFactoryError" }, { "name": "noSideEffects" }, - { - "name": "noUndefined" - }, - { - "name": "nodeValue" - }, { "name": "noop" }, @@ -4028,27 +1130,6 @@ { "name": "noopScope" }, - { - "name": "normalizeDebugBindingName" - }, - { - "name": "normalizeDebugBindingValue" - }, - { - "name": "normalizeGenFileSuffix" - }, - { - "name": "normalizeNgContentSelect" - }, - { - "name": "not$1" - }, - { - "name": "nullSafeIsEquivalent" - }, - { - "name": "numberTimesBigInt" - }, { "name": "observable" }, @@ -4064,87 +1145,33 @@ { "name": "parseCookieValue" }, - { - "name": "parseI18nMeta" - }, - { - "name": "parseIntAutoRadix" - }, - { - "name": "pipeDef" - }, { "name": "pipeFromArray" }, { - "name": "platformBrowserDynamic" + "name": "platformBrowser" }, { "name": "platformCore" }, - { - "name": "platformCoreDynamic" - }, { "name": "postProcessBaseDirective" }, { "name": "prefillHostVars" }, - { - "name": "preparseElement" - }, - { - "name": "prependTemporaryDecls" - }, - { - "name": "preserveWhitespacesDefault" - }, - { - "name": "processRules" - }, - { - "name": "prodCheckAndUpdateNode" - }, - { - "name": "prodCheckNoChangesNode" - }, { "name": "projectionNodeStack" }, { "name": "promise" }, - { - "name": "providerDef" - }, - { - "name": "providerDef$1" - }, - { - "name": "providerOverrides" - }, - { - "name": "providerOverridesWithScope" - }, { "name": "providerToFactory" }, { "name": "providerToRecord" }, - { - "name": "pureArrayDef" - }, - { - "name": "pureObjectDef" - }, - { - "name": "purePipeDef" - }, - { - "name": "queryDef" - }, { "name": "queueComponentIndexForCheck" }, @@ -4193,102 +1220,36 @@ { "name": "refreshDynamicEmbeddedViews" }, - { - "name": "registerContext" - }, - { - "name": "registerModuleFactory" - }, { "name": "relativePath" }, { "name": "remove" }, - { - "name": "removeDebugNodeFromIndex" - }, - { - "name": "removeFromArray" - }, { "name": "removeListeners" }, - { - "name": "removeSummaryDuplicates" - }, - { - "name": "removeView" - }, - { - "name": "removeWhitespaces" - }, - { - "name": "renderAttachEmbeddedView" - }, { "name": "renderComponentOrTemplate" }, - { - "name": "renderDetachView" - }, { "name": "renderEmbeddedTemplate" }, - { - "name": "renderEventHandlerClosure" - }, - { - "name": "renderNode" - }, - { - "name": "rendererTypeName" - }, - { - "name": "replaceNgsp" - }, { "name": "resetComponentState" }, - { - "name": "resolveDefinition" - }, - { - "name": "resolveDep" - }, { "name": "resolveForwardRef" }, - { - "name": "resolveForwardRef$1" - }, - { - "name": "resolveNgModuleDep" - }, { "name": "resolveProvider" }, - { - "name": "resolveRendererType2" - }, { "name": "resolveToken" }, - { - "name": "rol32" - }, - { - "name": "rol64" - }, - { - "name": "rootRenderNodes" - }, { "name": "rxSubscriber" }, - { - "name": "sanitizeIdentifier" - }, { "name": "scheduleMicroTask" }, @@ -4298,18 +1259,6 @@ { "name": "searchTokensOnInjector" }, - { - "name": "serialize" - }, - { - "name": "serializeNodes" - }, - { - "name": "serializeTags" - }, - { - "name": "serializerVisitor" - }, { "name": "setBindingRoot" }, @@ -4319,18 +1268,6 @@ { "name": "setCurrentInjector" }, - { - "name": "setElementAttribute" - }, - { - "name": "setElementClass" - }, - { - "name": "setElementProperty" - }, - { - "name": "setElementStyle" - }, { "name": "setFirstTemplatePass" }, @@ -4364,87 +1301,27 @@ { "name": "setUpAttributes" }, - { - "name": "sha1" - }, { "name": "share" }, { "name": "shareSubjectFactory" }, - { - "name": "sharedStylesheetJitUrl" - }, - { - "name": "shiftInitState" - }, - { - "name": "shouldCallLifecycleInitHook" - }, { "name": "shouldSearchParent" }, - { - "name": "singleProviderDef" - }, - { - "name": "splitAtColon" - }, - { - "name": "splitAtPeriod" - }, - { - "name": "splitClasses" - }, - { - "name": "splitDepsDsl" - }, - { - "name": "splitExportAs" - }, - { - "name": "splitMatchedQueriesDsl" - }, - { - "name": "splitNamespace" - }, - { - "name": "splitNsName" - }, - { - "name": "splitTypescriptSuffix" - }, { "name": "staticError" }, - { - "name": "staticViewQueryIds" - }, { "name": "storeCleanupFn" }, - { - "name": "stringToWords32" - }, { "name": "stringify" }, { "name": "stringify$1" }, - { - "name": "stringify$2" - }, - { - "name": "stringifyType" - }, - { - "name": "stripComments" - }, - { - "name": "sub32" - }, { "name": "subscribeTo" }, @@ -4469,75 +1346,18 @@ { "name": "syncViewWithBlueprint" }, - { - "name": "syntaxError" - }, - { - "name": "tagToString" - }, - { - "name": "targetsModule" - }, - { - "name": "templateJitUrl" - }, - { - "name": "templateSourceUrl" - }, - { - "name": "templateVisitAll" - }, - { - "name": "temporaryDeclaration" - }, - { - "name": "temporaryName" - }, { "name": "text" }, - { - "name": "textDef" - }, { "name": "tickRootContext" }, - { - "name": "toBase64Digit" - }, - { - "name": "toBase64String" - }, - { - "name": "toBase64VLQ" - }, - { - "name": "toPublicName" - }, { "name": "toRefArray" }, { "name": "toSubscriber" }, - { - "name": "toUpperCaseCharCode" - }, - { - "name": "tokenExpr" - }, - { - "name": "tokenKey" - }, - { - "name": "tokenName" - }, - { - "name": "tokenReference" - }, - { - "name": "tokenize" - }, { "name": "tryCatch" }, @@ -4547,84 +1367,15 @@ { "name": "tryResolveToken" }, - { - "name": "typeSourceSpan" - }, - { - "name": "unescape" - }, - { - "name": "unwrapValue" - }, - { - "name": "updateProp" - }, { "name": "updateViewQuery" }, - { - "name": "utf8Encode" - }, - { - "name": "validateNode" - }, - { - "name": "variable" - }, { "name": "viewAttached" }, - { - "name": "viewClassName" - }, - { - "name": "viewDebugError" - }, - { - "name": "viewDef" - }, - { - "name": "viewDefOverrides" - }, - { - "name": "viewDestroyedError" - }, - { - "name": "viewParentEl" - }, - { - "name": "viewWrappedDebugError" - }, - { - "name": "visitAll" - }, - { - "name": "visitProjectedRenderNodes" - }, - { - "name": "visitRenderNode" - }, - { - "name": "visitRootRenderNodes" - }, - { - "name": "visitSiblingRenderNodes" - }, - { - "name": "visitValue" - }, { "name": "walkTNodeTree" }, - { - "name": "word32ToByteString" - }, - { - "name": "wordAt" - }, - { - "name": "words32ToByteString" - }, { "name": "wtfCreateScope" }, @@ -4634,9 +1385,6 @@ { "name": "wtfLeave" }, - { - "name": "ɵResourceLoaderImpl_BaseFactory" - }, { "name": "ɵdefineNgModule" } diff --git a/packages/core/test/bundling/hello_world_r2/index.ts b/packages/core/test/bundling/hello_world_r2/index.ts index eec4cbbee8..ef99f6dba0 100644 --- a/packages/core/test/bundling/hello_world_r2/index.ts +++ b/packages/core/test/bundling/hello_world_r2/index.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ import {Component, NgModule} from '@angular/core'; -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; +import {platformBrowser} from '@angular/platform-browser'; @Component({selector: 'hello-world', template: 'Hello World!'}) export class HelloWorldComponent { @@ -16,4 +16,4 @@ export class HelloWorldComponent { export class HelloWorldModule { } -platformBrowserDynamic().bootstrapModule(HelloWorldModule); +platformBrowser().bootstrapModule(HelloWorldModule); diff --git a/packages/core/test/render3/BUILD.bazel b/packages/core/test/render3/BUILD.bazel index 797e87702e..faa0e0698e 100644 --- a/packages/core/test/render3/BUILD.bazel +++ b/packages/core/test/render3/BUILD.bazel @@ -61,7 +61,6 @@ jasmine_node_test( "angular/packages/core/test/render3/load_domino", ], tags = [ - "fixme-ivy-aot", "fixme-ivy-jit", ], deps = [ @@ -73,7 +72,6 @@ jasmine_node_test( ts_web_test_suite( name = "render3_web", tags = [ - "fixme-ivy-aot", "fixme-ivy-jit", ], deps = [ diff --git a/packages/core/test/render3/compiler_canonical/component_directives_spec.ts b/packages/core/test/render3/compiler_canonical/component_directives_spec.ts deleted file mode 100644 index 9e3fcbadcf..0000000000 --- a/packages/core/test/render3/compiler_canonical/component_directives_spec.ts +++ /dev/null @@ -1,961 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentDef} from '../../../src/render3/interfaces/definition'; -import {renderComponent, toHtml} from '../render_util'; - - - -/// See: `normative.md` -describe('components & directives', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - type $any$ = any; - type $number$ = number; - - it('should instantiate directives', () => { - type $ChildComponent$ = ChildComponent; - type $MyComponent$ = MyComponent; - - const log: string[] = []; - @Component({selector: 'child', template: 'child-view'}) - class ChildComponent { - constructor() { log.push('ChildComponent'); } - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ChildComponent, - selectors: [['child']], - factory: function ChildComponent_Factory(t) { return new (t || ChildComponent)(); }, - consts: 1, - vars: 0, - template: function ChildComponent_Template(rf: $RenderFlags$, ctx: $ChildComponent$) { - if (rf & 1) { - $r3$.ɵtext(0, 'child-view'); - } - } - }); - // /NORMATIVE - } - - @Directive({ - selector: '[some-directive]', - }) - class SomeDirective { - constructor() { log.push('SomeDirective'); } - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: SomeDirective, - selectors: [['', 'some-directive', '']], - factory: function SomeDirective_Factory(t) { return new (t || SomeDirective)(); }, - }); - // /NORMATIVE - } - - // Important: keep arrays outside of function to not create new instances. - // NORMATIVE - const $e0_attrs$ = ['some-directive', '']; - // /NORMATIVE - - @Component({selector: 'my-component', template: `!`}) - class MyComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 2, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelement(0, 'child', $e0_attrs$); - $r3$.ɵtext(1, '!'); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyComponent.ngComponentDef as ComponentDef).directiveDefs = - [(ChildComponent.ngComponentDef as ComponentDef), SomeDirective.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(renderComp(MyComponent)).toEqual('child-view!'); - expect(log).toEqual(['ChildComponent', 'SomeDirective']); - }); - - it('should support host bindings', () => { - type $MyApp$ = MyApp; - - @Directive({selector: '[hostBindingDir]'}) - class HostBindingDir { - @HostBinding('id') dirId = 'some id'; - - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: HostBindingDir, - selectors: [['', 'hostBindingDir', '']], - factory: function HostBindingDir_Factory(t) { return new (t || HostBindingDir)(); }, - hostVars: 1, - hostBindings: function HostBindingDir_HostBindings(dirIndex: $number$, elIndex: $number$) { - $r3$.ɵelementProperty( - elIndex, 'id', $r3$.ɵbind($r3$.ɵload(dirIndex).dirId)); - } - }); - // /NORMATIVE - } - - const $e0_attrs$ = ['hostBindingDir', '']; - - @Component({ - selector: 'my-app', - template: ` -
- ` - }) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div', $e0_attrs$); - } - } - }); - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = [HostBindingDir.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`
`); - }); - - it('should support host listeners', () => { - type $MyApp$ = MyApp; - - @Directive({selector: '[hostlistenerDir]'}) - class HostListenerDir { - @HostListener('click') - onClick() {} - - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - selectors: [['', 'hostListenerDir', '']], - type: HostListenerDir, - factory: function HostListenerDir_Factory() { - const $dir$ = new HostListenerDir(); - $r3$.ɵlistener( - 'click', function HostListenerDir_click_Handler(event: any) { $dir$.onClick(); }); - return $dir$; - }, - }); - // /NORMATIVE - } - - const $e0_attrs$ = ['hostListenerDir', '']; - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'button', $e0_attrs$); - $r3$.ɵtext(1, 'Click'); - $r3$.ɵelementEnd(); - } - } - }); - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = [HostListenerDir.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(``); - }); - - - it('should support setting of host attributes', () => { - type $MyApp$ = MyApp; - - @Directive({selector: '[hostAttributeDir]', host: {'role': 'listbox'}}) - class HostAttributeDir { - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - selectors: [['', 'hostAttributeDir', '']], - type: HostAttributeDir, - factory: function HostAttributeDir_Factory(t) { return new (t || HostAttributeDir)(); }, - attributes: ['role', 'listbox'] - }); - // /NORMATIVE - } - - const $e0_attrs$ = ['hostAttributeDir', '']; - - @Component({ - selector: 'my-app', - template: ` -
- ` - }) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div', $e0_attrs$); - } - } - }); - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = [HostAttributeDir.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`
`); - }); - - it('should support bindings of host attributes', () => { - type $MyApp$ = MyApp; - - @Directive({selector: '[hostBindingDir]'}) - class HostBindingDir { - @HostBinding('attr.aria-label') label = 'some label'; - - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: HostBindingDir, - selectors: [['', 'hostBindingDir', '']], - factory: function HostBindingDir_Factory(t) { return new (t || HostBindingDir)(); }, - hostVars: 1, - hostBindings: function HostBindingDir_HostBindings(dirIndex: $number$, elIndex: $number$) { - $r3$.ɵelementAttribute( - elIndex, 'aria-label', $r3$.ɵbind($r3$.ɵload(dirIndex).label)); - } - }); - // /NORMATIVE - } - - const $e0_attrs$ = ['hostBindingDir', '']; - - @Component({ - selector: 'my-app', - template: ` -
- ` - }) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div', $e0_attrs$); - } - } - }); - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = [HostBindingDir.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`
`); - }); - - it('should support onPush components', () => { - type $MyApp$ = MyApp; - type $MyComp$ = MyComp; - - @Component({ - selector: 'my-comp', - template: ` - {{ name }} - `, - changeDetection: ChangeDetectionStrategy.OnPush - }) - class MyComp { - // TODO(issue/24571): remove '!'. - @Input() name !: string; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComp, - selectors: [['my-comp']], - factory: function MyComp_Factory(t) { return new (t || MyComp)(); }, - consts: 1, - vars: 1, - template: function MyComp_Template(rf: $RenderFlags$, ctx: $MyComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - } - if (rf & 2) { - $r3$.ɵtextBinding(0, $r3$.ɵbind(ctx.name)); - } - }, - inputs: {name: 'name'}, - changeDetection: ChangeDetectionStrategy.OnPush - }); - // /NORMATIVE - } - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - name = 'some name'; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 1, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'name', $r3$.ɵbind(ctx.name)); - } - } - }); - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`some name`); - }); - - xit('should support structural directives', () => { - type $MyComponent$ = MyComponent; - - function C1(rf1: $RenderFlags$, ctx1: $any$) { - if (rf1 & 1) { - $r3$.ɵelementStart(0, 'li'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - } - if (rf1 & 2) { - const $comp$ = $r3$.ɵnextContext(); - const $foo$ = $r3$.ɵreference(1); - $r3$.ɵtextBinding(1, $r3$.ɵinterpolation2('', $comp$.salutation, ' ', $foo$, '')); - } - } - - const log: string[] = []; - @Directive({ - selector: '[if]', - }) - class IfDirective { - constructor(template: TemplateRef) { log.push('ifDirective'); } - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: IfDirective, - selectors: [['', 'if', '']], - factory: function IfDirective_Factory(t) { - return new (t || IfDirective)($r3$.ɵdirectiveInject(TemplateRef as any)); - }, - }); - // /NORMATIVE - } - - // Important: keep arrays outside of function to not create new instances. - // NORMATIVE - const $e0_locals$ = ['foo', '']; - // /NORMATIVE - - @Component( - {selector: 'my-component', template: `
  • {{salutation}} {{foo}}
`}) - class MyComponent { - salutation = 'Hello'; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 3, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'ul', null, $e0_locals$); - $r3$.ɵtemplate(2, C1, 2, 1, '', ['if', '']); - $r3$.ɵelementEnd(); - } - } - }); - // /NORMATIVE - } - - expect(renderComp(MyComponent)).toEqual('child-view!'); - expect(log).toEqual(['ChildComponent', 'SomeDirective']); - }); - - describe('value composition', () => { - type $MyArrayComp$ = MyArrayComp; - - @Component({ - selector: 'my-array-comp', - template: ` - {{ names[0] }} {{ names[1] }} - ` - }) - class MyArrayComp { - // TODO(issue/24571): remove '!'. - @Input() names !: string[]; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyArrayComp, - selectors: [['my-array-comp']], - factory: function MyArrayComp_Factory(t) { return new (t || MyArrayComp)(); }, - consts: 1, - vars: 2, - template: function MyArrayComp_Template(rf: $RenderFlags$, ctx: $MyArrayComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - } - if (rf & 2) { - $r3$.ɵtextBinding(0, $r3$.ɵinterpolation2('', ctx.names[0], ' ', ctx.names[1], '')); - } - }, - inputs: {names: 'names'} - }); - } - - it('should support array literals of constants', () => { - type $MyApp$ = MyApp; - - // NORMATIVE - const $e0_arr$ = ['Nancy', 'Bess']; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-array-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'names', rf & 1 ? $e0_arr$ : $r3$.ɵNO_CHANGE); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyArrayComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`Nancy Bess`); - }); - - it('should support array literals of constants inside function calls', () => { - type $MyApp$ = MyApp; - - // NORMATIVE - const $e0_ff$ = () => ['Nancy', 'Bess']; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - someFn(arr: string[]): string[] { - arr[0] = arr[0].toUpperCase(); - return arr; - } - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 2, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-array-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'names', $r3$.ɵbind(ctx.someFn($r3$.ɵpureFunction0(1, $e0_ff$)))); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyArrayComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`NANCY Bess`); - }); - - it('should support array literals of constants inside expressions', () => { - type $MyApp$ = MyApp; - type $MyComp$ = MyComp; - - @Component({selector: 'my-comp', template: `{{ num }}`}) - class MyComp { - // TODO(issue/24571): remove '!'. - num !: number; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComp, - selectors: [['my-comp']], - factory: function MyComp_Factory(t) { return new (t || MyComp)(); }, - consts: 1, - vars: 1, - template: function MyComp_Template(rf: $RenderFlags$, ctx: $MyComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - } - if (rf & 2) { - // clang-format wants to break this line by changing the second 'ɵ' to an invalid - // unicode sequence. - // clang-format off - $r3$.ɵtextBinding(0, $r3$.ɵbind(ctx.num)); - // clang-format on - } - }, - inputs: {num: 'num'} - }); - } - - // NORMATIVE - const $e0_ff$ = () => ['Nancy', 'Bess']; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 2, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'num', $r3$.ɵbind($r3$.ɵpureFunction0(1, $e0_ff$).length + 1)); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`3`); - }); - - - it('should support array literals', () => { - type $MyApp$ = MyApp; - - // NORMATIVE - const $e0_ff$ = (v: any) => ['Nancy', v]; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - customName = 'Bess'; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 3, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-array-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'names', $r3$.ɵbind($r3$.ɵpureFunction1(1, $e0_ff$, ctx.customName))); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyArrayComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`Nancy Bess`); - }); - - it('should support 9+ bindings in array literals', () => { - type $MyComp$ = MyComp; - - @Component({ - selector: 'my-comp', - template: ` - {{ names[0] }} - {{ names[1] }} - {{ names[3] }} - {{ names[4] }} - {{ names[5] }} - {{ names[6] }} - {{ names[7] }} - {{ names[8] }} - {{ names[9] }} - {{ names[10] }} - {{ names[11] }} - ` - }) - class MyComp { - // TODO(issue/24571): remove '!'. - @Input() names !: string[]; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComp, - selectors: [['my-comp']], - factory: function MyComp_Factory(t) { return new (t || MyComp)(); }, - consts: 12, - vars: 12, - template: function MyComp_Template(rf: $RenderFlags$, ctx: $MyComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - $r3$.ɵtext(1); - $r3$.ɵtext(2); - $r3$.ɵtext(3); - $r3$.ɵtext(4); - $r3$.ɵtext(5); - $r3$.ɵtext(6); - $r3$.ɵtext(7); - $r3$.ɵtext(8); - $r3$.ɵtext(9); - $r3$.ɵtext(10); - $r3$.ɵtext(11); - } - if (rf & 2) { - $r3$.ɵtextBinding(0, $r3$.ɵbind(ctx.names[0])); - $r3$.ɵtextBinding(1, $r3$.ɵbind(ctx.names[1])); - $r3$.ɵtextBinding(2, $r3$.ɵbind(ctx.names[2])); - $r3$.ɵtextBinding(3, $r3$.ɵbind(ctx.names[3])); - $r3$.ɵtextBinding(4, $r3$.ɵbind(ctx.names[4])); - $r3$.ɵtextBinding(5, $r3$.ɵbind(ctx.names[5])); - $r3$.ɵtextBinding(6, $r3$.ɵbind(ctx.names[6])); - $r3$.ɵtextBinding(7, $r3$.ɵbind(ctx.names[7])); - $r3$.ɵtextBinding(8, $r3$.ɵbind(ctx.names[8])); - $r3$.ɵtextBinding(9, $r3$.ɵbind(ctx.names[9])); - $r3$.ɵtextBinding(10, $r3$.ɵbind(ctx.names[10])); - $r3$.ɵtextBinding(11, $r3$.ɵbind(ctx.names[11])); - } - }, - inputs: {names: 'names'} - }); - } - - // NORMATIVE - const $e0_ff$ = - (v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, - v8: any) => ['start-', v0, v1, v2, v3, v4, '-middle-', v5, v6, v7, v8, '-end']; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - - ` - }) - class MyApp { - n0 = 'a'; - n1 = 'b'; - n2 = 'c'; - n3 = 'd'; - n4 = 'e'; - n5 = 'f'; - n6 = 'g'; - n7 = 'h'; - n8 = 'i'; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 11, - template: function MyApp_Template(rf: $RenderFlags$, c: $any$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'names', - $r3$.ɵbind($r3$.ɵpureFunctionV( - 1, $e0_ff$, [c.n0, c.n1, c.n2, c.n3, c.n4, c.n5, c.n6, c.n7, c.n8]))); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(MyComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`start-abcde-middle-fghi-end`); - }); - - it('should support object literals', () => { - type $ObjectComp$ = ObjectComp; - type $MyApp$ = MyApp; - - @Component({ - selector: 'object-comp', - template: ` -

{{ config['duration'] }}

-

{{ config.animation }}

- ` - }) - class ObjectComp { - // TODO(issue/24571): remove '!'. - config !: {[key: string]: any}; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ObjectComp, - selectors: [['object-comp']], - factory: function ObjectComp_Factory(t) { return new (t || ObjectComp)(); }, - consts: 4, - vars: 2, - template: function ObjectComp_Template(rf: $RenderFlags$, ctx: $ObjectComp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'p'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - $r3$.ɵelementStart(2, 'p'); - $r3$.ɵtext(3); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵtextBinding(1, $r3$.ɵbind(ctx.config['duration'])); - $r3$.ɵtextBinding(3, $r3$.ɵbind(ctx.config.animation)); - } - }, - inputs: {config: 'config'} - }); - } - - // NORMATIVE - const $e0_ff$ = (v: any) => { return {'duration': 500, animation: v}; }; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - ` - }) - class MyApp { - name = 'slide'; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 3, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'object-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'config', $r3$.ɵbind($r3$.ɵpureFunction1(1, $e0_ff$, ctx.name))); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(ObjectComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)).toEqual(`

500

slide

`); - }); - - it('should support expressions nested deeply in object/array literals', () => { - type $NestedComp$ = NestedComp; - type $MyApp$ = MyApp; - - @Component({ - selector: 'nested-comp', - template: ` -

{{ config.animation }}

-

{{config.actions[0].opacity }}

-

{{config.actions[1].duration }}

- ` - }) - class NestedComp { - // TODO(issue/24571): remove '!'. - config !: {[key: string]: any}; - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: NestedComp, - selectors: [['nested-comp']], - factory: function NestedComp_Factory(t) { return new (t || NestedComp)(); }, - consts: 6, - vars: 3, - template: function NestedComp_Template(rf: $RenderFlags$, ctx: $NestedComp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'p'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - $r3$.ɵelementStart(2, 'p'); - $r3$.ɵtext(3); - $r3$.ɵelementEnd(); - $r3$.ɵelementStart(4, 'p'); - $r3$.ɵtext(5); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵtextBinding(1, $r3$.ɵbind(ctx.config.animation)); - $r3$.ɵtextBinding(3, $r3$.ɵbind(ctx.config.actions[0].opacity)); - $r3$.ɵtextBinding(5, $r3$.ɵbind(ctx.config.actions[1].duration)); - } - }, - inputs: {config: 'config'} - }); - } - - // NORMATIVE - const $e0_ff$ = (v: any) => { return {opacity: 1, duration: v}; }; - const $c0$ = {opacity: 0, duration: 0}; - const $e0_ff_1$ = (v: any) => [$c0$, v]; - const $e0_ff_2$ = (v1: any, v2: any) => { return {animation: v1, actions: v2}; }; - // /NORMATIVE - - @Component({ - selector: 'my-app', - template: ` - - - ` - }) - class MyApp { - name = 'slide'; - duration = 100; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 8, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'nested-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty( - 0, 'config', - $r3$.ɵbind($r3$.ɵpureFunction2( - 5, $e0_ff_2$, ctx.name, - $r3$.ɵpureFunction1( - 3, $e0_ff_1$, $r3$.ɵpureFunction1(1, $e0_ff$, ctx.duration))))); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE (done by defineNgModule) - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [(NestedComp.ngComponentDef as ComponentDef)]; - // /NON-NORMATIVE - - expect(renderComp(MyApp)) - .toEqual(`

slide

0

100

`); - }); - - }); - -}); - -function renderComp(type: $r3$.ɵComponentType): string { - return toHtml(renderComponent(type)); -} diff --git a/packages/core/test/render3/compiler_canonical/content_projection_spec.ts b/packages/core/test/render3/compiler_canonical/content_projection_spec.ts deleted file mode 100644 index 246b3adfb3..0000000000 --- a/packages/core/test/render3/compiler_canonical/content_projection_spec.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; - -/// See: `normative.md` -describe('content projection', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - - it('should support content projection', () => { - type $SimpleComponent$ = SimpleComponent; - type $ComplexComponent$ = ComplexComponent; - type $MyApp$ = MyApp; - - @Component({selector: 'simple', template: `
`}) - class SimpleComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: SimpleComponent, - selectors: [['simple']], - factory: function SimpleComponent_Factory(t) { return new (t || SimpleComponent)(); }, - consts: 1, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $SimpleComponent$) { - if (rf & 1) { - $r3$.ɵprojectionDef(); - $r3$.ɵelement(0, 'div'); - $r3$.ɵprojection(1); - } - } - }); - // /NORMATIVE - } - - // NORMATIVE - const $pD_0P$: $r3$.ɵCssSelectorList[] = - [[['span', 'title', 'toFirst']], [['span', 'title', 'toSecond']]]; - const $pD_0R$: string[] = ['span[title=toFirst]', 'span[title=toSecond]']; - // /NORMATIVE - - @Component({ - selector: 'complex', - template: ` -
-
` - }) - class ComplexComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ComplexComponent, - selectors: [['complex']], - factory: function ComplexComponent_Factory(t) { return new (t || ComplexComponent)(); }, - consts: 4, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $ComplexComponent$) { - if (rf & 1) { - $r3$.ɵprojectionDef($pD_0P$, $pD_0R$); - $r3$.ɵelement(0, 'div', ['id', 'first']); - $r3$.ɵprojection(1, 1); - $r3$.ɵelement(2, 'div', ['id', 'second']); - $r3$.ɵprojection(3, 2); - } - } - }); - // /NORMATIVE - } - - @Component({ - selector: 'my-app', - template: `content - ` - }) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'simple'); - $r3$.ɵtext(1, 'content'); - $r3$.ɵelementEnd(); - } - }, - directives: () => [SimpleComponent] - }); - } - }); - -}); diff --git a/packages/core/test/render3/compiler_canonical/elements_spec.ts b/packages/core/test/render3/compiler_canonical/elements_spec.ts deleted file mode 100644 index cc83d43664..0000000000 --- a/packages/core/test/render3/compiler_canonical/elements_spec.ts +++ /dev/null @@ -1,445 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Component} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {AttributeMarker} from '../../../src/render3'; -import {ComponentDef, InitialStylingFlags} from '../../../src/render3/interfaces/definition'; -import {ComponentFixture, renderComponent, toHtml} from '../render_util'; - - -/// See: `normative.md` -describe('elements', () => { - // Saving type as $any$, etc to simplify testing for compiler, as types aren't saved - type $any$ = any; - type $RenderFlags$ = $r3$.ɵRenderFlags; - - it('should translate DOM structure', () => { - type $MyComponent$ = MyComponent; - - // Important: keep arrays outside of function to not create new instances. - const $e0_attrs$ = ['class', 'my-app', 'title', 'Hello']; - - @Component({ - selector: 'my-component', - template: `
Hello World!
` - }) - class MyComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 5, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div', $e0_attrs$); - $r3$.ɵtext(1, 'Hello '); - $r3$.ɵelementStart(2, 'b'); - $r3$.ɵtext(3, 'World'); - $r3$.ɵelementEnd(); - $r3$.ɵtext(4, '!'); - $r3$.ɵelementEnd(); - } - } - }); - // /NORMATIVE - } - - expect(toHtml(renderComponent(MyComponent))) - .toEqual('
Hello World!
'); - }); - - it('should support local refs', () => { - type $LocalRefComp$ = LocalRefComp; - - class Dir { - value = 'one'; - - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: Dir, - selectors: [['', 'dir', '']], - factory: function DirA_Factory(t) { return new (t || Dir)(); }, - exportAs: 'dir' - }); - } - - // NORMATIVE - const $e0_attrs$ = ['dir', '']; - const $e0_locals$ = ['dir', 'dir', 'foo', '']; - // /NORMATIVE - - @Component({ - selector: 'local-ref-comp', - template: ` -
- {{ dir.value }} - {{ foo.tagName }} - ` - }) - class LocalRefComp { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: LocalRefComp, - selectors: [['local-ref-comp']], - factory: function LocalRefComp_Factory(t) { return new (t || LocalRefComp)(); }, - consts: 4, - vars: 2, - template: function LocalRefComp_Template(rf: $RenderFlags$, ctx: $LocalRefComp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div', $e0_attrs$, $e0_locals$); - $r3$.ɵtext(3); - } - if (rf & 2) { - const $tmp$ = $r3$.ɵreference(1) as any; - const $tmp_2$ = $r3$.ɵreference(2) as any; - $r3$.ɵtextBinding( - 3, $r3$.ɵinterpolation2(' ', $tmp$.value, ' - ', $tmp_2$.tagName, '')); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (LocalRefComp.ngComponentDef as ComponentDef).directiveDefs = () => [Dir.ngDirectiveDef]; - // /NON-NORMATIVE - - const fixture = new ComponentFixture(LocalRefComp); - expect(fixture.html).toEqual(`
one - DIV`); - }); - - it('should support listeners', () => { - type $ListenerComp$ = ListenerComp; - - @Component({ - selector: 'listener-comp', - template: - `` - }) - class ListenerComp { - onClick() {} - onPress(e: Event) {} - onPress2(e: Event) {} - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ListenerComp, - selectors: [['listener-comp']], - factory: function ListenerComp_Factory(t) { return new (t || ListenerComp)(); }, - consts: 2, - vars: 0, - template: function ListenerComp_Template(rf: $RenderFlags$, ctx: $ListenerComp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'button'); - $r3$.ɵlistener( - 'click', function ListenerComp_click_Handler() { return ctx.onClick(); }); - $r3$.ɵlistener('keypress', function ListenerComp_keypress_Handler($event: $any$) { - ctx.onPress($event); - return ctx.onPress2($event); - }); - $r3$.ɵtext(1, 'Click'); - $r3$.ɵelementEnd(); - } - } - }); - // /NORMATIVE - } - - const listenerComp = renderComponent(ListenerComp); - expect(toHtml(listenerComp)).toEqual(''); - }); - - it('should support namespaced attributes', () => { - type $MyComponent$ = MyComponent; - - // Important: keep arrays outside of function to not create new instances. - const $e0_attrs$ = [ - // class="my-app" - 'class', - 'my-app', - // foo:bar="baz" - AttributeMarker.NamespaceURI, - 'http://someuri/foo', - 'foo:bar', - 'baz', - // title="Hello" - 'title', - 'Hello', - // foo:qux="quacks" - AttributeMarker.NamespaceURI, - 'http://someuri/foo', - 'foo:qux', - 'quacks', - ]; - - @Component({ - selector: 'my-component', - template: - `
Hello World!
` - }) - class MyComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 5, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div', $e0_attrs$); - $r3$.ɵtext(1, 'Hello '); - $r3$.ɵelementStart(2, 'b'); - $r3$.ɵtext(3, 'World'); - $r3$.ɵelementEnd(); - $r3$.ɵtext(4, '!'); - $r3$.ɵelementEnd(); - } - } - }); - // /NORMATIVE - } - - expect(toHtml(renderComponent(MyComponent))) - .toEqual( - '
Hello World!
'); - }); - - describe('bindings', () => { - it('should bind to property', () => { - type $MyComponent$ = MyComponent; - - @Component({selector: 'my-component', template: `
`}) - class MyComponent { - someProperty: string = 'initial'; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 1, - vars: 1, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div'); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'id', $r3$.ɵbind(ctx.someProperty)); - } - } - }); - // /NORMATIVE - } - - const comp = renderComponent(MyComponent); - expect(toHtml(comp)).toEqual('
'); - - comp.someProperty = 'changed'; - $r3$.ɵdetectChanges(comp); - expect(toHtml(comp)).toEqual('
'); - }); - - it('should bind to attribute', () => { - type $MyComponent$ = MyComponent; - - @Component({selector: 'my-component', template: `
`}) - class MyComponent { - someAttribute: string = 'initial'; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 1, - vars: 1, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelement(0, 'div'); - } - if (rf & 2) { - $r3$.ɵelementAttribute(0, 'title', $r3$.ɵbind(ctx.someAttribute)); - } - } - }); - // /NORMATIVE - } - - const comp = renderComponent(MyComponent); - expect(toHtml(comp)).toEqual('
'); - - comp.someAttribute = 'changed'; - $r3$.ɵdetectChanges(comp); - expect(toHtml(comp)).toEqual('
'); - }); - - it('should bind to a specific class', () => { - const c1: (string | InitialStylingFlags | boolean)[] = ['foo']; - type $MyComponent$ = MyComponent; - - @Component({selector: 'my-component', template: `
`}) - class MyComponent { - someFlag: boolean = false; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 1, - vars: 0, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStyling(c1); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementClassProp(0, 0, ctx.someFlag); - $r3$.ɵelementStylingApply(0); - } - } - }); - // /NORMATIVE - } - - const comp = renderComponent(MyComponent); - - // This is a fix for a change in how Domino renders this on the server in v2.1.0 - const source = toHtml(comp); - const matches = source === '
' || source === '
'; - expect(matches).toBeTruthy(); - - comp.someFlag = true; - $r3$.ɵdetectChanges(comp); - expect(toHtml(comp)).toEqual('
'); - }); - - it('should bind to a specific style', () => { - type $MyComponent$ = MyComponent; - - const c0 = ['color', 'width']; - @Component({ - selector: 'my-component', - template: `
` - }) - class MyComponent { - someColor: string = 'red'; - someWidth: number = 50; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 1, - vars: 0, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStyling(null, c0); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementStyleProp(0, 0, ctx.someColor); - $r3$.ɵelementStyleProp(0, 1, ctx.someWidth, 'px'); - $r3$.ɵelementStylingApply(0); - } - } - }); - // /NORMATIVE - } - - const comp = renderComponent(MyComponent); - expect(toHtml(comp)).toEqual('
'); - - comp.someColor = 'blue'; - comp.someWidth = 100; - $r3$.ɵdetectChanges(comp); - expect(toHtml(comp)).toEqual('
'); - }); - - it('should bind to many and keep order', () => { - type $MyComponent$ = MyComponent; - - const c0 = ['foo']; - const c1 = ['color', InitialStylingFlags.VALUES_MODE, 'color', 'red']; - - @Component({ - selector: 'my-component', - template: - `
` - }) - class MyComponent { - someString: string = 'initial'; - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 1, - vars: 1, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStyling(c0, c1); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'id', $r3$.ɵbind(ctx.someString + 1)); - $r3$.ɵelementClassProp(0, 0, ctx.someString == 'initial'); - $r3$.ɵelementStylingApply(0); - } - } - }); - // /NORMATIVE - } - - const comp = renderComponent(MyComponent); - expect(toHtml(comp)).toEqual('
'); - - comp.someString = 'changed'; - $r3$.ɵdetectChanges(comp); - expect(toHtml(comp)).toEqual('
'); - }); - - it('should bind [class] and [style] to the element', () => { - type $StyleComponent$ = StyleComponent; - - @Component( - {selector: 'style-comp', template: `
`}) - class StyleComponent { - classExp: string[]|string = 'some-name'; - styleExp: {[name: string]: string} = {'background-color': 'red'}; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: StyleComponent, - selectors: [['style-comp']], - factory: function StyleComponent_Factory(t) { return new (t || StyleComponent)(); }, - consts: 1, - vars: 0, - template: function StyleComponent_Template(rf: $RenderFlags$, ctx: $StyleComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStyling(); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementStylingMap(0, ctx.classExp, ctx.styleExp); - $r3$.ɵelementStylingApply(0); - } - } - }); - // /NORMATIVE - } - - const styleFixture = new ComponentFixture(StyleComponent); - expect(styleFixture.html) - .toEqual(`
`); - }); - }); -}); diff --git a/packages/core/test/render3/compiler_canonical/i18n_spec.ts b/packages/core/test/render3/compiler_canonical/i18n_spec.ts deleted file mode 100644 index b912642430..0000000000 --- a/packages/core/test/render3/compiler_canonical/i18n_spec.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgForOfContext} from '@angular/common'; -import {Component} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {NgForOf} from '../common_with_def'; - -/// See: `normative.md` -describe('i18n', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - - it('should support html', () => { - type $MyApp$ = MyApp; - const $msg_1$ = `{$START_P}contenu{$END_P}`; - const $i18n_1$ = $r3$.ɵi18nMapping($msg_1$, [{START_P: 1}]); - - @Component({selector: 'my-app', template: `

content

`}) - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 0, - template: function(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStart(1, 'p'); - $r3$.ɵelementEnd(); - $r3$.ɵelementEnd(); - $r3$.ɵi18nApply(1, $i18n_1$[0]); - } - } - }); - } - }); - - it('should support expressions', () => { - type $MyApp$ = MyApp; - const $msg_1$ = `contenu: {$EXP_1}`; - const $i18n_1$ = $r3$.ɵi18nMapping($msg_1$, null, [{EXP_1: 1}]); - - @Component({selector: 'my-app', template: `
content: {{exp1}}
`}) - class MyApp { - exp1 = '1'; - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 1, - template: function(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - $r3$.ɵi18nApply(1, $i18n_1$[0]); - } - if (rf & 2) { - $r3$.ɵtextBinding(3, $r3$.ɵbind(ctx.exp1)); - } - } - }); - } - }); - - it('should support expressions in attributes', () => { - type $MyApp$ = MyApp; - const $msg_1$ = `titre: {$EXP_1}`; - const $i18n_1$ = $r3$.ɵi18nExpMapping($msg_1$, {EXP_1: 1}); - - @Component({selector: 'my-app', template: `

`}) - class MyApp { - exp1 = '1'; - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 1, - template: function(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStart(1, 'p'); - $r3$.ɵelementEnd(); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'title', $r3$.ɵi18nInterpolation1($i18n_1$, ctx.exp1)); - } - } - }); - } - }); - - it('should support embedded templates', () => { - type $MyApp$ = MyApp; - const $msg_1$ = `{$START_LI}valeur: {$EXP_1}!{$END_LI}`; - const $i18n_1$ = $r3$.ɵi18nMapping( - $msg_1$, [{START_LI: 1}, {START_LI: 0}], [null, {EXP_1: 1}], ['START_LI']); - - function liTemplate(rf1: $RenderFlags$, row: NgForOfContext) { - if (rf1 & 1) { - $r3$.ɵelementStart(0, 'li'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - $r3$.ɵi18nApply(0, $i18n_1$[1]); - } - if (rf1 & 2) { - $r3$.ɵtextBinding(1, $r3$.ɵbind(row.$implicit)); - } - } - - @Component({ - selector: 'my-app', - template: `
  • value: {{item}}
` - }) - class MyApp { - items: string[] = ['1', '2']; - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - selectors: [['my-app']], - consts: 2, - vars: 1, - template: (rf: $RenderFlags$, myApp: $MyApp$) => { - if (rf & 1) { - $r3$.ɵelementStart(0, 'ul'); - $r3$.ɵtemplate(1, liTemplate, 2, 1, null, ['ngForOf', '']); - $r3$.ɵelementEnd(); - $r3$.ɵi18nApply(1, $i18n_1$[0]); - } - if (rf & 2) { - $r3$.ɵelementProperty(1, 'ngForOf', $r3$.ɵbind(myApp.items)); - } - }, - directives: () => [NgForOf] - }); - } - }); -}); diff --git a/packages/core/test/render3/compiler_canonical/injection_spec.ts b/packages/core/test/render3/compiler_canonical/injection_spec.ts deleted file mode 100644 index 0dadc8e9ec..0000000000 --- a/packages/core/test/render3/compiler_canonical/injection_spec.ts +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Attribute, ChangeDetectorRef, Component, INJECTOR, Inject, InjectFlags, Injectable, Injector, SkipSelf, defineInjectable, inject} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ProvidersFeature} from '../../../src/render3/features/providers_feature'; -import {renderComponent, toHtml} from '../render_util'; - - - -/// See: `normative.md` -describe('injection', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - - describe('directives', () => { - // Directives (and Components) should use `directiveInject` - it('should inject ChangeDetectorRef', () => { - type $MyComp$ = MyComp; - type $MyApp$ = MyApp; - - @Component({selector: 'my-comp', template: `{{ value }}`}) - class MyComp { - value: string; - constructor(public cdr: ChangeDetectorRef) { this.value = (cdr.constructor as any).name; } - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComp, - selectors: [['my-comp']], - factory: function MyComp_Factory(t) { - return new (t || MyComp)($r3$.ɵdirectiveInject(ChangeDetectorRef as any)); - }, - consts: 1, - vars: 1, - template: function MyComp_Template(rf: $RenderFlags$, ctx: $MyComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - } - if (rf & 2) { - $r3$.ɵtextBinding(0, $r3$.ɵbind(ctx.value)); - } - } - }); - // /NORMATIVE - } - - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - /** */ - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-comp'); - } - }, - directives: () => [MyComp] - }); - } - - - const app = renderComponent(MyApp); - // ChangeDetectorRef is the token, ViewRef is historically the constructor - expect(toHtml(app)).toEqual('ViewRef'); - }); - - it('should inject attributes', () => { - type $MyComp$ = MyComp; - type $MyApp$ = MyApp; - - @Component({selector: 'my-comp', template: `{{ title }}`}) - class MyComp { - constructor(@Attribute('title') public title: string|undefined) {} - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComp, - selectors: [['my-comp']], - factory: function MyComp_Factory(t) { - return new (t || MyComp)($r3$.ɵinjectAttribute('title')); - }, - consts: 1, - vars: 1, - template: function MyComp_Template(rf: $RenderFlags$, ctx: $MyComp$) { - if (rf & 1) { - $r3$.ɵtext(0); - } - if (rf & 2) { - $r3$.ɵtextBinding(0, $r3$.ɵbind(ctx.title)); - } - } - }); - // /NORMATIVE - } - - class MyApp { - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 1, - vars: 0, - /** */ - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelement(0, 'my-comp', e0_attrs); - } - }, - directives: () => [MyComp] - }); - } - const e0_attrs = ['title', 'WORKS']; - const app = renderComponent(MyApp); - // ChangeDetectorRef is the token, ViewRef is historically the constructor - expect(toHtml(app)).toEqual('WORKS'); - }); - - // TODO(misko): enable once `providers` and `viewProvdires` are implemented. - xit('should inject into an injectable', () => { - type $MyApp$ = MyApp; - - @Injectable() - class ServiceA { - // NORMATIVE - static ngInjectableDef = defineInjectable({ - factory: function ServiceA_Factory() { return new ServiceA(); }, - }); - // /NORMATIVE - } - - @Injectable() - class ServiceB { - // NORMATIVE - static ngInjectableDef = defineInjectable({ - factory: function ServiceA_Factory() { return new ServiceB(); }, - }); - // /NORMATIVE - } - - @Component({ - template: '', - providers: [ServiceA], - viewProviders: [ServiceB], - }) - class MyApp { - constructor(serviceA: ServiceA, serviceB: ServiceB, injector: Injector) {} - - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { - return new (t || MyApp)( - $r3$.ɵdirectiveInject(ServiceA), $r3$.ɵdirectiveInject(ServiceB), inject(INJECTOR)); - }, - consts: 0, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) {}, - features: [ProvidersFeature([ServiceA], [ServiceB])] - }); - } - const e0_attrs = ['title', 'WORKS']; - const app = renderComponent(MyApp); - // ChangeDetectorRef is the token, ViewRef is historically the constructor - expect(toHtml(app)).toEqual('WORKS'); - }); - }); - - describe('services', () => { - // Services should use `inject` - @Injectable() - class ServiceA { - constructor(@Inject(String) name: String, injector: Injector) {} - - // NORMATIVE - static ngInjectableDef = defineInjectable({ - factory: function ServiceA_Factory() { - return new ServiceA(inject(String), inject(INJECTOR)); - }, - }); - // /NORMATIVE - } - - @Injectable() - class ServiceB { - constructor(serviceA: ServiceA, @SkipSelf() injector: Injector) {} - // NORMATIVE - static ngInjectableDef = defineInjectable({ - factory: function ServiceA_Factory() { - return new ServiceB(inject(ServiceA), inject(INJECTOR, InjectFlags.SkipSelf) !); - }, - }); - // /NORMATIVE - } - - }); - -}); diff --git a/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts b/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts deleted file mode 100644 index 7361b9431f..0000000000 --- a/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentDef} from '../../../src/render3/interfaces/definition'; -import {renderComponent, toHtml} from '../render_util'; - - -/// See: `normative.md` -describe('lifecycle hooks', () => { - let events: string[] = []; - let simpleLayout: SimpleLayout; - - type $RenderFlags$ = $r3$.ɵRenderFlags; - type $LifecycleComp$ = LifecycleComp; - type $SimpleLayout$ = SimpleLayout; - - beforeEach(() => { events = []; }); - - @Component({selector: 'lifecycle-comp', template: ``}) - class LifecycleComp { - // TODO(issue/24571): remove '!'. - @Input('name') nameMin !: string; - - ngOnChanges() { events.push('changes' + this.nameMin); } - - ngOnInit() { events.push('init' + this.nameMin); } - ngDoCheck() { events.push('check' + this.nameMin); } - - ngAfterContentInit() { events.push('content init' + this.nameMin); } - ngAfterContentChecked() { events.push('content check' + this.nameMin); } - - ngAfterViewInit() { events.push('view init' + this.nameMin); } - ngAfterViewChecked() { events.push('view check' + this.nameMin); } - - ngOnDestroy() { events.push(this.nameMin); } - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: LifecycleComp, - selectors: [['lifecycle-comp']], - factory: function LifecycleComp_Factory(t) { return new (t || LifecycleComp)(); }, - consts: 0, - vars: 0, - template: function LifecycleComp_Template(rf: $RenderFlags$, ctx: $LifecycleComp$) {}, - inputs: {nameMin: ['name', 'nameMin']}, - features: [$r3$.ɵNgOnChangesFeature] - }); - // /NORMATIVE - } - - @Component({ - selector: 'simple-layout', - template: ` - - - ` - }) - class SimpleLayout { - name1 = '1'; - name2 = '2'; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: SimpleLayout, - selectors: [['simple-layout']], - factory: function SimpleLayout_Factory(t) { - return simpleLayout = new (t || SimpleLayout)(); - }, - consts: 2, - vars: 2, - template: function SimpleLayout_Template(rf: $RenderFlags$, ctx: $SimpleLayout$) { - if (rf & 1) { - $r3$.ɵelement(0, 'lifecycle-comp'); - $r3$.ɵelement(1, 'lifecycle-comp'); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'name', $r3$.ɵbind(ctx.name1)); - $r3$.ɵelementProperty(1, 'name', $r3$.ɵbind(ctx.name2)); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (SimpleLayout.ngComponentDef as ComponentDef).directiveDefs = [LifecycleComp.ngComponentDef]; - // /NON-NORMATIVE - - it('should gen hooks with a few simple components', () => { - expect(toHtml(renderComponent(SimpleLayout))) - .toEqual(``); - expect(events).toEqual([ - 'changes1', 'init1', 'check1', 'changes2', 'init2', 'check2', 'content init1', - 'content check1', 'content init2', 'content check2', 'view init1', 'view check1', - 'view init2', 'view check2' - ]); - - events = []; - simpleLayout.name1 = '-one'; - simpleLayout.name2 = '-two'; - $r3$.ɵdetectChanges(simpleLayout); - expect(events).toEqual([ - 'changes-one', 'check-one', 'changes-two', 'check-two', 'content check-one', - 'content check-two', 'view check-one', 'view check-two' - ]); - }); - -}); diff --git a/packages/core/test/render3/compiler_canonical/local_reference_spec.ts b/packages/core/test/render3/compiler_canonical/local_reference_spec.ts deleted file mode 100644 index 56ba752412..0000000000 --- a/packages/core/test/render3/compiler_canonical/local_reference_spec.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ElementRef, TemplateRef} from '@angular/core'; - -import {Component} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentFixture} from '../render_util'; - - -/// See: `normative.md` -describe('local references', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - - it('should translate DOM structure', () => { - type $MyComponent$ = MyComponent; - - @Component( - {selector: 'my-component', template: `Hello, {{user.value}}!`}) - class MyComponent { - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 3, - vars: 1, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - let l1_user: any; - if (rf & 1) { - $r3$.ɵelement(0, 'input', ['value', 'World'], ['user', '']); - $r3$.ɵtext(2); - } - if (rf & 2) { - l1_user = $r3$.ɵreference(1); - $r3$.ɵtextBinding(2, $r3$.ɵinterpolation1('Hello, ', l1_user.value, '!')); - } - } - }); - // NORMATIVE - } - - const fixture = new ComponentFixture(MyComponent); - expect(fixture.html).toEqual(`Hello, World!`); - }); - - it('should expose TemplateRef when a local ref is placed on ng-template', () => { - type $MyComponent$ = MyComponent; - type $any$ = any; - - @Component({ - selector: 'my-component', - template: `{{isTemplateRef(tpl)}}` - }) - class MyComponent { - isTemplateRef(tplRef: any): boolean { return tplRef.createEmbeddedView != null; } - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 3, - vars: 1, - template: function(rf: $RenderFlags$, ctx: $MyComponent$) { - let l1_tpl: any; - if (rf & 1) { - $r3$.ɵtemplate( - 0, MyComponent_Template_0, 0, 0, null, null, ['tpl', ''], - $r3$.ɵtemplateRefExtractor); - $r3$.ɵtext(2); - } - if (rf & 2) { - l1_tpl = $r3$.ɵreference(1); - $r3$.ɵtextBinding(2, $r3$.ɵinterpolation1('', ctx.isTemplateRef(l1_tpl), '')); - } - - function MyComponent_Template_0(rf1: $RenderFlags$, ctx1: $any$) {} - } - }); - // NORMATIVE - } - - const fixture = new ComponentFixture(MyComponent); - expect(fixture.html).toEqual(`true`); - }); -}); diff --git a/packages/core/test/render3/compiler_canonical/ng_module_spec.ts b/packages/core/test/render3/compiler_canonical/ng_module_spec.ts deleted file mode 100644 index 32bf7427f8..0000000000 --- a/packages/core/test/render3/compiler_canonical/ng_module_spec.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import * as $core$ from '../../../index'; -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {renderComponent, toHtml} from '../render_util'; - - -/// See: `normative.md` -xdescribe('NgModule', () => { - - interface Injectable { - providedIn?: /*InjectorDefType*/ any; - factory: Function; - } - - function defineInjectable(opts: Injectable): Injectable { - // This class should be imported from https://github.com/angular/angular/pull/20850 - return opts; - } - function defineInjector(opts: any): any { - // This class should be imported from https://github.com/angular/angular/pull/20850 - return opts; - } - it('should convert module', () => { - @Injectable() - class Toast { - constructor(name: String) {} - // NORMATIVE - static ngInjectableDef = defineInjectable({ - factory: function Toast_Factory() { return new Toast($r3$.ɵdirectiveInject(String)); }, - }); - // /NORMATIVE - } - - class CommonModule { - // NORMATIVE - static ngInjectorDef = defineInjector({}); - // /NORMATIVE - } - - @NgModule({ - providers: [Toast, {provide: String, useValue: 'Hello'}], - imports: [CommonModule], - }) - class MyModule { - constructor(toast: Toast) {} - // NORMATIVE - static ngInjectorDef = defineInjector({ - factory: function MyModule_Factory() { return new MyModule($r3$.ɵdirectiveInject(Toast)); }, - provider: [ - {provide: Toast, deps: [String]}, // If Toast has metadata generate this line - Toast, // If Toast has no metadata generate this line. - {provide: String, useValue: 'Hello'} - ], - imports: [CommonModule] - }); - // /NORMATIVE - } - - @Injectable(/*{MyModule}*/) - class BurntToast { - constructor(@Optional() toast: Toast|null, name: String) {} - // NORMATIVE - static ngInjectableDef = defineInjectable({ - providedIn: MyModule, - factory: function BurntToast_Factory() { - return new BurntToast( - $r3$.ɵdirectiveInject(Toast, $core$.InjectFlags.Optional), - $r3$.ɵdirectiveInject(String)); - }, - }); - // /NORMATIVE - } - - }); -}); diff --git a/packages/core/test/render3/compiler_canonical/normative.md b/packages/core/test/render3/compiler_canonical/normative.md deleted file mode 100644 index 992bf86d3f..0000000000 --- a/packages/core/test/render3/compiler_canonical/normative.md +++ /dev/null @@ -1,11 +0,0 @@ -This folder contains canonical examples of how the Ivy compiler translates annotations into code - -- The specs are marked with `NORMATIVE` => `/NORMATIVE` comments which designates what the compiler is expected to generate. -- All local variable names are considered non-normative (informative). They should be wrapped in `$` on each end to simplify testing on the compiler side. - -A common trick in spec files is to map types to `$x$` (such as `boolean` => `$boolean$`, etc) to simplify testing for compiler, as types aren't saved. (See bullet above). -``` -type $boolean$ = boolean; -type $any$ = any; -type $number$ = number; -``` \ No newline at end of file diff --git a/packages/core/test/render3/compiler_canonical/pipes_spec.ts b/packages/core/test/render3/compiler_canonical/pipes_spec.ts deleted file mode 100644 index 7d16d938e9..0000000000 --- a/packages/core/test/render3/compiler_canonical/pipes_spec.ts +++ /dev/null @@ -1,219 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Component, Directive, Input, OnDestroy, Pipe, PipeTransform, TemplateRef, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentDef} from '../../../src/render3/interfaces/definition'; -import {containerEl, renderComponent, toHtml} from '../render_util'; - - - -/// See: `normative.md` -describe('pipes', () => { - type $any$ = any; - type $RenderFlags$ = $r3$.ɵRenderFlags; - - let myPipeTransformCalls = 0; - let myPurePipeTransformCalls = 0; - - @Pipe({ - name: 'myPipe', - pure: false, - }) - class MyPipe implements PipeTransform, - OnDestroy { - private numberOfBang = 1; - - transform(value: string, size: number): string { - let result = value.substring(size); - for (let i = 0; i < this.numberOfBang; i++) result += '!'; - this.numberOfBang++; - myPipeTransformCalls++; - return result; - } - - ngOnDestroy() { this.numberOfBang = 1; } - - // NORMATIVE - static ngPipeDef = $r3$.ɵdefinePipe({ - name: 'myPipe', - type: MyPipe, - factory: function MyPipe_Factory(t) { return new (t || MyPipe)(); }, - pure: false, - }); - // /NORMATIVE - } - - @Pipe({ - name: 'myPurePipe', - pure: true, - }) - class MyPurePipe implements PipeTransform { - transform(value: string, size: number): string { - myPurePipeTransformCalls++; - return value.substring(size); - } - - // NORMATIVE - static ngPipeDef = $r3$.ɵdefinePipe({ - name: 'myPurePipe', - type: MyPurePipe, - factory: function MyPurePipe_Factory(t) { return new (t || MyPurePipe)(); }, - pure: true, - }); - // /NORMATIVE - } - - it('should render pipes', () => { - type $MyApp$ = MyApp; - myPipeTransformCalls = 0; - myPurePipeTransformCalls = 0; - - @Component({template: `{{name | myPipe:size | myPurePipe:size }}`}) - class MyApp { - name = '12World'; - size = 1; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 3, - vars: 7, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵtext(0); - $r3$.ɵpipe(1, 'myPipe'); - $r3$.ɵpipe(2, 'myPurePipe'); - } - if (rf & 2) { - $r3$.ɵtextBinding( - 0, - $r3$.ɵinterpolation1( - '', $r3$.ɵpipeBind2(1, 4, $r3$.ɵpipeBind2(2, 1, ctx.name, ctx.size), ctx.size), - '')); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (MyApp.ngComponentDef as ComponentDef).pipeDefs = - () => [MyPurePipe.ngPipeDef, MyPipe.ngPipeDef]; - // /NON-NORMATIVE - - let myApp: MyApp = renderComponent(MyApp); - expect(toHtml(containerEl)).toEqual('World!'); - expect(myPurePipeTransformCalls).toEqual(1); - expect(myPipeTransformCalls).toEqual(1); - - $r3$.ɵdetectChanges(myApp); - expect(toHtml(containerEl)).toEqual('World!!'); - expect(myPurePipeTransformCalls).toEqual(1); - expect(myPipeTransformCalls).toEqual(2); - - myApp.name = '34WORLD'; - $r3$.ɵdetectChanges(myApp); - expect(toHtml(containerEl)).toEqual('WORLD!!!'); - expect(myPurePipeTransformCalls).toEqual(2); - expect(myPipeTransformCalls).toEqual(3); - }); - - it('should render many pipes and forward the first instance (pure or impure pipe)', () => { - type $MyApp$ = MyApp; - myPipeTransformCalls = 0; - myPurePipeTransformCalls = 0; - - @Directive({ - selector: '[oneTimeIf]', - }) - class OneTimeIf { - @Input() oneTimeIf: any; - constructor(private view: ViewContainerRef, private template: TemplateRef) {} - ngDoCheck(): void { - if (this.oneTimeIf) { - this.view.createEmbeddedView(this.template); - } - } - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: OneTimeIf, - selectors: [['', 'oneTimeIf', '']], - factory: function OneTimeIf_Factory(t) { - return new (t || OneTimeIf)( - $r3$.ɵdirectiveInject(ViewContainerRef as any), - $r3$.ɵdirectiveInject(TemplateRef as any)); - }, - inputs: {oneTimeIf: 'oneTimeIf'} - }); - // /NORMATIVE - } - - function MyApp_div_Template_4(rf: $RenderFlags$, ctx: any) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵtext(1); - $r3$.ɵpipe(2, 'myPurePipe'); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - const $comp$ = $r3$.ɵnextContext(); - $r3$.ɵtextBinding( - 1, $r3$.ɵinterpolation1('', $r3$.ɵpipeBind2(2, 1, $comp$.name, $comp$.size), '')); - } - } - - @Component({ - template: `{{name | myPurePipe:size}}{{name | myPurePipe:size}} -
{{name | myPurePipe:size}}
` - }) - class MyApp { - name = '1World'; - size = 1; - more = true; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 5, - vars: 9, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵtext(0); - $r3$.ɵpipe(1, 'myPurePipe'); - $r3$.ɵtext(2); - $r3$.ɵpipe(3, 'myPurePipe'); - $r3$.ɵtemplate(4, MyApp_div_Template_4, 3, 4, '', ['oneTimeIf', '']); - } - if (rf & 2) { - $r3$.ɵtextBinding( - 0, $r3$.ɵinterpolation1('', $r3$.ɵpipeBind2(1, 3, ctx.name, ctx.size), '')); - $r3$.ɵtextBinding( - 2, $r3$.ɵinterpolation1('', $r3$.ɵpipeBind2(3, 6, ctx.name, ctx.size), '')); - $r3$.ɵelementProperty(4, 'oneTimeIf', $r3$.ɵbind(ctx.more)); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (MyApp.ngComponentDef as ComponentDef).directiveDefs = [OneTimeIf.ngDirectiveDef]; - (MyApp.ngComponentDef as ComponentDef).pipeDefs = [MyPurePipe.ngPipeDef]; - // /NON-NORMATIVE - - let myApp: MyApp = renderComponent(MyApp); - expect(toHtml(containerEl)).toEqual('WorldWorld
World
'); - expect(myPurePipeTransformCalls).toEqual(3); - expect(myPipeTransformCalls).toEqual(0); - }); -}); diff --git a/packages/core/test/render3/compiler_canonical/query_spec.ts b/packages/core/test/render3/compiler_canonical/query_spec.ts deleted file mode 100644 index f30b6df537..0000000000 --- a/packages/core/test/render3/compiler_canonical/query_spec.ts +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentDef} from '../../../src/render3/interfaces/definition'; -import {getDirectiveOnNode, renderComponent, toHtml} from '../render_util'; - - -/// See: `normative.md` -describe('queries', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - type $number$ = number; - let someDir: SomeDirective; - - @Directive({ - selector: '[someDir]', - }) - class SomeDirective { - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: SomeDirective, - selectors: [['', 'someDir', '']], - factory: function SomeDirective_Factory(t) { return someDir = new (t || SomeDirective)(); } - }); - } - - it('should support view queries', () => { - type $ViewQueryComponent$ = ViewQueryComponent; - - // NORMATIVE - const $e1_attrs$ = ['someDir', '']; - // /NORMATIVE - - @Component({ - selector: 'view-query-component', - template: ` -
- ` - }) - class ViewQueryComponent { - // TODO(issue/24571): remove '!'. - @ViewChild(SomeDirective) someDir !: SomeDirective; - // TODO(issue/24571): remove '!'. - @ViewChildren(SomeDirective) someDirList !: QueryList; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ViewQueryComponent, - selectors: [['view-query-component']], - factory: function ViewQueryComponent_Factory(t) { return new (t || ViewQueryComponent)(); }, - consts: 3, - vars: 0, - template: function ViewQueryComponent_Template( - rf: $RenderFlags$, ctx: $ViewQueryComponent$) { - if (rf & 1) { - $r3$.ɵelement(2, 'div', $e1_attrs$); - } - }, - viewQuery: function ViewQueryComponent_Query(rf: $RenderFlags$, ctx: $ViewQueryComponent$) { - if (rf & 1) { - $r3$.ɵquery(0, SomeDirective, false); - $r3$.ɵquery(1, SomeDirective, false); - } - if (rf & 2) { - let $tmp$: any; - $r3$.ɵqueryRefresh($tmp$ = $r3$.ɵload>(0)) && - (ctx.someDir = $tmp$.first); - $r3$.ɵqueryRefresh($tmp$ = $r3$.ɵload>(1)) && - (ctx.someDirList = $tmp$ as QueryList); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (ViewQueryComponent.ngComponentDef as ComponentDef).directiveDefs = - [SomeDirective.ngDirectiveDef]; - // /NON-NORMATIVE - - const viewQueryComp = renderComponent(ViewQueryComponent); - expect(viewQueryComp.someDir).toEqual(someDir); - expect((viewQueryComp.someDirList as QueryList).toArray()).toEqual([someDir !]); - }); - - it('should support content queries', () => { - type $MyApp$ = MyApp; - type $ContentQueryComponent$ = ContentQueryComponent; - - let contentQueryComp: ContentQueryComponent; - - @Component({ - selector: 'content-query-component', - template: ` -
- ` - }) - class ContentQueryComponent { - // TODO(issue/24571): remove '!'. - @ContentChild(SomeDirective) someDir !: SomeDirective; - // TODO(issue/24571): remove '!'. - @ContentChildren(SomeDirective) someDirList !: QueryList; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: ContentQueryComponent, - selectors: [['content-query-component']], - factory: function ContentQueryComponent_Factory(t) { - return new (t || ContentQueryComponent)(); - }, - consts: 2, - vars: 0, - contentQueries: function ContentQueryComponent_ContentQueries(dirIndex: $number$) { - $r3$.ɵregisterContentQuery($r3$.ɵquery(null, SomeDirective, false), dirIndex); - $r3$.ɵregisterContentQuery($r3$.ɵquery(null, SomeDirective, false), dirIndex); - }, - contentQueriesRefresh: function ContentQueryComponent_ContentQueriesRefresh( - dirIndex: $number$, queryStartIndex: $number$) { - let $tmp$: any; - const $instance$ = $r3$.ɵload(dirIndex); - $r3$.ɵqueryRefresh($tmp$ = $r3$.ɵloadQueryList(queryStartIndex)) && - ($instance$.someDir = $tmp$.first); - $r3$.ɵqueryRefresh($tmp$ = $r3$.ɵloadQueryList(queryStartIndex + 1)) && - ($instance$.someDirList = $tmp$); - }, - template: function ContentQueryComponent_Template( - rf: $number$, ctx: $ContentQueryComponent$) { - if (rf & 1) { - $r3$.ɵprojectionDef(); - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵprojection(1); - $r3$.ɵelementEnd(); - } - } - }); - // /NORMATIVE - } - - const $e2_attrs$ = ['someDir', '']; - - @Component({ - selector: 'my-app', - template: ` - -
-
- ` - }) - class MyApp { - // NON-NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyApp, - selectors: [['my-app']], - factory: function MyApp_Factory(t) { return new (t || MyApp)(); }, - consts: 2, - vars: 0, - template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'content-query-component'); - contentQueryComp = getDirectiveOnNode(0); - $r3$.ɵelement(1, 'div', $e2_attrs$); - $r3$.ɵelementEnd(); - } - } - }); - // /NON-NORMATIVE - } - - // NON-NORMATIVE - (MyApp.ngComponentDef as ComponentDef).directiveDefs = - [ContentQueryComponent.ngComponentDef, SomeDirective.ngDirectiveDef]; - // /NON-NORMATIVE - - expect(toHtml(renderComponent(MyApp))) - .toEqual( - `
`); - expect(contentQueryComp !.someDir).toEqual(someDir !); - expect((contentQueryComp !.someDirList as QueryList).toArray()).toEqual([ - someDir ! - ]); - }); - -}); diff --git a/packages/core/test/render3/compiler_canonical/sanitize_spec.ts b/packages/core/test/render3/compiler_canonical/sanitize_spec.ts deleted file mode 100644 index 314cb9678b..0000000000 --- a/packages/core/test/render3/compiler_canonical/sanitize_spec.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {getHostElement} from '../../../src/render3/index'; -import {renderComponent, toHtml} from '../render_util'; - -/** - * NORMATIVE => /NORMATIVE: Designates what the compiler is expected to generate. - * - * All local variable names are considered non-normative (informative). They should be - * wrapped in $ on each end to simplify testing on the compiler side. - */ - -describe('compiler sanitization', () => { - type $RenderFlags$ = $r3$.ɵRenderFlags; - - it('should translate DOM structure', () => { - type $MyComponent$ = MyComponent; - - @Component({ - selector: 'my-component', - template: `
` + - `` + - `` - }) - class MyComponent { - innerHTML: string = ''; - hidden: boolean = true; - style: string = `url("http://evil")`; - url: string = 'javascript:evil()'; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 2, - vars: 4, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'div'); - $r3$.ɵelementStyling(['background-image']); - $r3$.ɵelementEnd(); - $r3$.ɵelement(1, 'img'); - } - if (rf & 2) { - $r3$.ɵelementProperty(0, 'innerHTML', $r3$.ɵbind(ctx.innerHTML), $r3$.ɵsanitizeHtml); - $r3$.ɵelementProperty(0, 'hidden', $r3$.ɵbind(ctx.hidden)); - $r3$.ɵelementStyleProp(0, 0, ctx.style); - $r3$.ɵelementStylingApply(0); - $r3$.ɵelementProperty(1, 'src', $r3$.ɵbind(ctx.url), $r3$.ɵsanitizeUrl); - $r3$.ɵelementAttribute(1, 'srcset', $r3$.ɵbind(ctx.url), $r3$.ɵsanitizeUrl); - } - } - }); - // /NORMATIVE - } - - const myComponent = renderComponent(MyComponent); - const div = getHostElement(myComponent).querySelector('div') !; - // because sanitizer removed it is working. - expect(div.innerHTML).toEqual(''); - expect(div.hidden).toEqual(true); - - const img = getHostElement(myComponent).querySelector('img') !; - // because sanitizer removed it is working. - expect(img.getAttribute('src')).toEqual('unsafe:javascript:evil()'); - // because sanitizer removed it is working. - expect(img.style.getPropertyValue('background-image')).toEqual(''); - // because sanitizer removed it is working. - expect(img.getAttribute('srcset')).toEqual('unsafe:javascript:evil()'); - }); - -}); diff --git a/packages/core/test/render3/compiler_canonical/template_variables_spec.ts b/packages/core/test/render3/compiler_canonical/template_variables_spec.ts deleted file mode 100644 index 81b522260b..0000000000 --- a/packages/core/test/render3/compiler_canonical/template_variables_spec.ts +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Component, Directive, Input, SimpleChanges, TemplateRef, ViewContainerRef, inject} from '../../../src/core'; -import * as $r3$ from '../../../src/core_render3_private_export'; -import {ComponentDef} from '../../../src/render3/interfaces/definition'; -import {renderComponent, toHtml} from '../render_util'; - - - -/// See: `normative.md` -describe('template variables', () => { - type $any$ = any; - type $number$ = number; - type $RenderFlags$ = $r3$.ɵRenderFlags; - - interface ForOfContext { - $implicit: any; - index: number; - even: boolean; - odd: boolean; - } - - @Directive({selector: '[forOf]'}) - class ForOfDirective { - // TODO(issue/24571): remove '!'. - private previous !: any[]; - - constructor(private view: ViewContainerRef, private template: TemplateRef) {} - - // TODO(issue/24571): remove '!'. - @Input() forOf !: any[]; - - ngOnChanges(simpleChanges: SimpleChanges) { - if ('forOf' in simpleChanges) { - this.update(); - } - } - - ngDoCheck(): void { - const previous = this.previous; - const current = this.forOf; - if (!previous || previous.length != current.length || - previous.some((value: any, index: number) => current[index] !== previous[index])) { - this.update(); - } - } - - private update() { - // TODO(chuckj): Not implemented yet - // this.view.clear(); - if (this.forOf) { - const current = this.forOf; - for (let i = 0; i < current.length; i++) { - const context = {$implicit: current[i], index: i, even: i % 2 == 0, odd: i % 2 == 1}; - // TODO(chuckj): Not implemented yet - // this.view.createEmbeddedView(this.template, context); - } - this.previous = [...this.forOf]; - } - } - - // NORMATIVE - static ngDirectiveDef = $r3$.ɵdefineDirective({ - type: ForOfDirective, - selectors: [['', 'forOf', '']], - factory: function ForOfDirective_Factory(t) { - return new (t || ForOfDirective)( - $r3$.ɵdirectiveInject(ViewContainerRef as any), - $r3$.ɵdirectiveInject(TemplateRef as any)); - }, - // TODO(chuckj): Enable when ngForOf enabling lands. - // features: [NgOnChangesFeature], - inputs: {forOf: 'forOf'} - }); - // /NORMATIVE - } - - it('should support a let variable and reference', () => { - type $MyComponent$ = MyComponent; - - interface Item { - name: string; - } - - function MyComponent_ForOfDirective_Template_1(rf: $RenderFlags$, ctx1: $any$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'li'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - const $l0_item$ = ctx1.$implicit; - $r3$.ɵtextBinding(1, $r3$.ɵinterpolation1('', $l0_item$.name, '')); - } - } - - @Component({ - selector: 'my-component', - template: `
  • {{item.name}}
` - }) - class MyComponent { - items = [{name: 'one'}, {name: 'two'}]; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 2, - vars: 1, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'ul'); - $r3$.ɵtemplate(1, MyComponent_ForOfDirective_Template_1, 2, 1, '', ['forOf', '']); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementProperty(1, 'forOf', $r3$.ɵbind(ctx.items)); - } - } - }); - // /NORMATIVE - } - - // NON-NORMATIVE - (MyComponent.ngComponentDef as ComponentDef).directiveDefs = - [ForOfDirective.ngDirectiveDef]; - // /NON-NORMATIVE - - // TODO(chuckj): update when the changes to enable ngForOf lands. - expect(toHtml(renderComponent(MyComponent))).toEqual('
    '); - }); - - it('should support accessing parent template variables', () => { - type $MyComponent$ = MyComponent; - - interface Info { - description: string; - } - interface Item { - name: string; - infos: Info[]; - } - - function MyComponent_ForOfDirective_Template_1(rf: $RenderFlags$, ctx1: $any$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'li'); - $r3$.ɵelementStart(1, 'div'); - $r3$.ɵtext(2); - $r3$.ɵelementEnd(); - $r3$.ɵelementStart(3, 'ul'); - $r3$.ɵtemplate( - 4, MyComponent_ForOfDirective_ForOfDirective_Template_3, 2, 1, '', ['forOf', '']); - $r3$.ɵelementEnd(); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - const $l0_item$ = ctx1.$implicit; - $r3$.ɵelementProperty(4, 'forOf', $r3$.ɵbind($l0_item$.infos)); - $r3$.ɵtextBinding(2, $r3$.ɵinterpolation1('', $l0_item$.name, '')); - } - } - - function MyComponent_ForOfDirective_ForOfDirective_Template_3(rf: $number$, ctx2: $any$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'li'); - $r3$.ɵtext(1); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - const $l0_info$ = ctx2.$implicit; - const $l0_item$ = $r3$.ɵnextContext(); - $r3$.ɵtextBinding( - 1, $r3$.ɵinterpolation2(' ', $l0_item$.name, ': ', $l0_info$.description, ' ')); - } - } - - @Component({ - selector: 'my-component', - template: ` -
      -
    • -
      {{item.name}}
      -
        -
      • - {{item.name}}: {{info.description}} -
      • -
      -
    • -
    ` - }) - class MyComponent { - items: Item[] = [ - {name: 'one', infos: [{description: '11'}, {description: '12'}]}, - {name: 'two', infos: [{description: '21'}, {description: '22'}]} - ]; - - // NORMATIVE - static ngComponentDef = $r3$.ɵdefineComponent({ - type: MyComponent, - selectors: [['my-component']], - factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }, - consts: 2, - vars: 1, - template: function MyComponent_Template(rf: $RenderFlags$, ctx: $MyComponent$) { - if (rf & 1) { - $r3$.ɵelementStart(0, 'ul'); - $r3$.ɵtemplate(1, MyComponent_ForOfDirective_Template_1, 5, 2, '', ['forOf', '']); - $r3$.ɵelementEnd(); - } - if (rf & 2) { - $r3$.ɵelementProperty(1, 'forOf', $r3$.ɵbind(ctx.items)); - } - } - }); - // /NORMATIVE - } - }); -}); diff --git a/packages/core/test/render3/component_spec.ts b/packages/core/test/render3/component_spec.ts index aee02a6a05..14da37b3be 100644 --- a/packages/core/test/render3/component_spec.ts +++ b/packages/core/test/render3/component_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Component, ElementRef, InjectFlags, Injectable, InjectionToken, InjectorType, Provider, ViewEncapsulation, createInjector, defineInjectable, defineInjector, inject} from '../../src/core'; +import {Component as _Component, ElementRef, InjectFlags, Injectable as _Injectable, InjectionToken, InjectorType, Provider, ViewEncapsulation, createInjector, defineInjectable, defineInjector, inject} from '../../src/core'; import {forwardRef} from '../../src/di/forward_ref'; import {getRenderedText} from '../../src/render3/component'; @@ -18,6 +18,15 @@ import {NgIf} from './common_with_def'; import {getRendererFactory2} from './imported_renderer2'; import {ComponentFixture, containerEl, createComponent, renderComponent, renderToHtml, requestAnimationFrame, toHtml} from './render_util'; +const Component: typeof _Component = function(...args: any[]): any { + // In test we use @Component for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; +const Injectable: typeof _Injectable = function(...args: any[]): any { + // In test we use @Injectable for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; + describe('component', () => { class CounterComponent { count = 0; diff --git a/packages/core/test/render3/i18n_spec.ts b/packages/core/test/render3/i18n_spec.ts index 4038de3f17..610911c96d 100644 --- a/packages/core/test/render3/i18n_spec.ts +++ b/packages/core/test/render3/i18n_spec.ts @@ -7,7 +7,7 @@ */ import {NgForOfContext} from '@angular/common'; -import {Component} from '../../src/core'; +import {Component as _Component} from '../../src/core'; import {defineComponent} from '../../src/render3/definition'; import {I18nExpInstruction, I18nInstruction, i18nApply, i18nExpMapping, i18nInterpolation1, i18nInterpolation2, i18nInterpolation3, i18nInterpolation4, i18nInterpolation5, i18nInterpolation6, i18nInterpolation7, i18nInterpolation8, i18nInterpolationV, i18nMapping} from '../../src/render3/i18n'; import {bind, container, containerRefreshEnd, containerRefreshStart, element, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, nextContext, projection, projectionDef, template, text, textBinding} from '../../src/render3/instructions'; @@ -15,6 +15,11 @@ import {RenderFlags} from '../../src/render3/interfaces/definition'; import {NgForOf} from './common_with_def'; import {ComponentFixture, TemplateFixture} from './render_util'; +const Component: typeof _Component = function(...args: any[]): any { + // In test we use @Component for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; + describe('Runtime i18n', () => { it('should support html elements', () => { // Html tags are replaced by placeholders. diff --git a/packages/core/test/render3/pipe_spec.ts b/packages/core/test/render3/pipe_spec.ts index 293b44cae5..d0fb357702 100644 --- a/packages/core/test/render3/pipe_spec.ts +++ b/packages/core/test/render3/pipe_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Directive, InjectionToken, OnChanges, OnDestroy, Pipe, PipeTransform, createInjector, defineInjectable, defineInjector, ɵNgModuleDef as NgModuleDef, ɵdefineComponent as defineComponent, ɵdirectiveInject as directiveInject} from '@angular/core'; +import {Directive as _Directive, InjectionToken, OnChanges, OnDestroy, Pipe as _Pipe, PipeTransform, createInjector, defineInjectable, defineInjector, ɵNgModuleDef as NgModuleDef, ɵdefineComponent as defineComponent, ɵdirectiveInject as directiveInject} from '@angular/core'; import {expect} from '@angular/platform-browser/testing/src/matchers'; import {defineDirective, definePipe} from '../../src/render3/definition'; @@ -17,6 +17,14 @@ import {pipe, pipeBind1, pipeBind3, pipeBind4, pipeBindV} from '../../src/render import {RenderLog, getRendererFactory2, patchLoggingRenderer2} from './imported_renderer2'; import {ComponentFixture, createComponent, getDirectiveOnNode, renderToHtml} from './render_util'; +const Directive: typeof _Directive = function(...args: any[]): any { + // In test we use @Directive for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; +const Pipe: typeof _Pipe = function(...args: any[]): any { + // In test we use @Pipe for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; let log: string[] = []; let person: Person; diff --git a/packages/core/test/render3/view_container_ref_spec.ts b/packages/core/test/render3/view_container_ref_spec.ts index 2469dcc168..3f8653d8e8 100644 --- a/packages/core/test/render3/view_container_ref_spec.ts +++ b/packages/core/test/render3/view_container_ref_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Component, ComponentFactoryResolver, ElementRef, EmbeddedViewRef, NgModuleRef, Pipe, PipeTransform, QueryList, RendererFactory2, TemplateRef, ViewContainerRef, createInjector, defineInjector, ɵAPP_ROOT as APP_ROOT, ɵNgModuleDef as NgModuleDef} from '../../src/core'; +import {Component as _Component, ComponentFactoryResolver, ElementRef, EmbeddedViewRef, NgModuleRef, Pipe, PipeTransform, QueryList, RendererFactory2, TemplateRef, ViewContainerRef, createInjector, defineInjector, ɵAPP_ROOT as APP_ROOT, ɵNgModuleDef as NgModuleDef} from '../../src/core'; import {ViewEncapsulation} from '../../src/metadata'; import {AttributeMarker, NO_CHANGE, NgOnChangesFeature, defineComponent, defineDirective, definePipe, injectComponentFactoryResolver, load, query, queryRefresh} from '../../src/render3/index'; @@ -19,10 +19,17 @@ import {pipe, pipeBind1} from '../../src/render3/pipe'; import {getViewData} from '../../src/render3/state'; import {getNativeByIndex} from '../../src/render3/util'; import {NgForOf} from '../../test/render3/common_with_def'; +import {fixmeIvy} from '@angular/private/testing'; import {getRendererFactory2} from './imported_renderer2'; import {ComponentFixture, TemplateFixture, createComponent, getDirectiveOnNode} from './render_util'; +const Component: typeof _Component = function(...args: any[]): any { + // In test we use @Component for documentation only so it's safe to mock out the implementation. + return () => undefined; +} as any; + + describe('ViewContainerRef', () => { let directiveInstance: DirectiveWithVCRef|null; @@ -1465,7 +1472,7 @@ describe('ViewContainerRef', () => { }); }); - describe('life cycle hooks', () => { + fixmeIvy(`Hooks don't run`) && describe('life cycle hooks', () => { // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref const log: string[] = []; diff --git a/packages/private/testing/BUILD.bazel b/packages/private/testing/BUILD.bazel index df3ccca178..5485807146 100644 --- a/packages/private/testing/BUILD.bazel +++ b/packages/private/testing/BUILD.bazel @@ -15,3 +15,17 @@ ng_module( "//packages/core", ], ) + +## Controls if Ivy is enabled. (Temporary target until we permanently switch over to Ivy) +## +## This file generates `src/bazel_define_compile_value.ts` file which reexports +## `--define=compile` value as `bazelDefineCompileValue` symbols so that runtime can detect +## which mode it is running in. +## +## See: `//.bazelrc` where `--define=ivy=legacy` is defined as default. +## See: `./src/bazel_define_compile_value.ts` for more details. +genrule( + name = "bazel_define_compile_value", + outs = ["src/bazel_define_compile_value.ts"], + cmd = "echo export const bazelDefineCompileValue = \"'$(compile)'\"\; > $@", +) diff --git a/packages/private/testing/index.ts b/packages/private/testing/index.ts index c13a1acc3b..e8f3e5844c 100644 --- a/packages/private/testing/index.ts +++ b/packages/private/testing/index.ts @@ -7,3 +7,4 @@ */ export * from './src/render3'; +export * from './src/fixme';