refactor(ivy): move hostBindings calls out of template (#22833)

PR Close #22833
This commit is contained in:
Kara Erickson 2018-03-16 16:42:13 -07:00 committed by Misko Hevery
parent ce63dc6f95
commit 4f21d373b7
26 changed files with 139 additions and 324 deletions

View File

@ -58,7 +58,6 @@ export class TreeComponent {
e(); e();
} }
p(0, 'data', b(ctx.data.left)); p(0, 'data', b(ctx.data.left));
TreeComponent.ngComponentDef.h(1, 0);
} }
v(); v();
} }
@ -74,7 +73,6 @@ export class TreeComponent {
e(); e();
} }
p(0, 'data', b(ctx.data.right)); p(0, 'data', b(ctx.data.right));
TreeComponent.ngComponentDef.h(1, 0);
} }
v(); v();
} }

View File

@ -133,7 +133,7 @@ export function renderComponent<T>(
const elementNode = hostElement(hostNode, componentDef); const elementNode = hostElement(hostNode, componentDef);
// Create directive instance with n() and store at index 1 in data array (el is 0) // Create directive instance with n() and store at index 1 in data array (el is 0)
component = rootContext.component = component = rootContext.component =
getDirectiveInstance(directiveCreate(1, componentDef.n(), componentDef)); getDirectiveInstance(directiveCreate(1, componentDef.factory(), componentDef));
initChangeDetectorIfExisting(elementNode.nodeInjector, component); initChangeDetectorIfExisting(elementNode.nodeInjector, component);
} finally { } finally {
// We must not use leaveView here because it will set creationMode to false too early, // We must not use leaveView here because it will set creationMode to false too early,

View File

@ -39,10 +39,10 @@ export function defineComponent<T>(componentDefinition: ComponentDefArgs<T>): Co
const def = <ComponentDef<any>>{ const def = <ComponentDef<any>>{
type: type, type: type,
diPublic: null, diPublic: null,
n: componentDefinition.factory, factory: componentDefinition.factory,
tag: (componentDefinition as ComponentDefArgs<T>).tag || null !, tag: (componentDefinition as ComponentDefArgs<T>).tag || null !,
template: (componentDefinition as ComponentDefArgs<T>).template || null !, template: (componentDefinition as ComponentDefArgs<T>).template || null !,
h: componentDefinition.hostBindings || noop, hostBindings: componentDefinition.hostBindings || null,
attributes: componentDefinition.attributes || null, attributes: componentDefinition.attributes || null,
inputs: invertObject(componentDefinition.inputs), inputs: invertObject(componentDefinition.inputs),
outputs: invertObject(componentDefinition.outputs), outputs: invertObject(componentDefinition.outputs),
@ -158,8 +158,6 @@ export function PublicFeature<T>(definition: DirectiveDef<T>) {
const EMPTY = {}; const EMPTY = {};
function noop() {}
/** Swaps the keys and values of an object. */ /** Swaps the keys and values of an object. */
function invertObject(obj: any): any { function invertObject(obj: any): any {
if (obj == null) return EMPTY; if (obj == null) return EMPTY;

View File

@ -43,6 +43,13 @@ const _CLEAN_PROMISE = Promise.resolve(null);
*/ */
export type Sanitizer = (value: any) => string; export type Sanitizer = (value: any) => string;
/**
* Directive and element indices for top-level directive.
*
* Saved here to avoid re-instantiating an array on every change detection run.
*/
const rootDirectiveIndices = [1, 0];
/** /**
* This property gets set before entering a template. * This property gets set before entering a template.
@ -158,6 +165,9 @@ let cleanup: any[]|null;
*/ */
let checkNoChangesMode = false; let checkNoChangesMode = false;
/** Whether or not this is the first time the current view has been processed. */
let firstTemplatePass = true;
const enum BindingDirection { const enum BindingDirection {
Input, Input,
Output, Output,
@ -181,6 +191,7 @@ export function enterView(newView: LView, host: LElementNode | LViewNode | null)
bindingIndex = newView && newView.bindingStartIndex || 0; bindingIndex = newView && newView.bindingStartIndex || 0;
tData = newView && newView.tView.data; tData = newView && newView.tView.data;
creationMode = newView && (newView.flags & LViewFlags.CreationMode) === LViewFlags.CreationMode; creationMode = newView && (newView.flags & LViewFlags.CreationMode) === LViewFlags.CreationMode;
firstTemplatePass = newView && newView.tView.firstTemplatePass;
cleanup = newView && newView.cleanup; cleanup = newView && newView.cleanup;
renderer = newView && newView.renderer; renderer = newView && newView.renderer;
@ -212,13 +223,33 @@ export function leaveView(newView: LView): void {
enterView(newView, null); enterView(newView, null);
} }
/** Refreshes the views of child components, triggering any init/content hooks existing. */ /** Refreshes directives in this view and triggers any init/content hooks. */
function refreshChildComponents() { function refreshDirectives() {
executeInitAndContentHooks(); executeInitAndContentHooks();
// This needs to be set before children are processed to support recursive components
currentView.tView.firstTemplatePass = false;
const components = currentView.tView.components; const tView = currentView.tView;
// This needs to be set before children are processed to support recursive components
// so to refresh the component, refresh() needs to be called with (1, 0)
tView.firstTemplatePass = firstTemplatePass = false;
setHostBindings(tView.hostBindings);
refreshChildComponents(tView.components);
}
/** Sets the host bindings for the current view. */
function setHostBindings(bindings: number[] | null): void {
if (bindings != null) {
for (let i = 0; i < bindings.length; i += 2) {
const dirIndex = bindings[i];
const elementIndex = bindings[i | 1];
const def = tData[dirIndex] as DirectiveDef<any>;
def.hostBindings && def.hostBindings(dirIndex, elementIndex);
}
}
}
/** Refreshes child components in the current view. */
function refreshChildComponents(components: number[] | null): void {
if (components != null) { if (components != null) {
for (let i = 0; i < components.length; i++) { for (let i = 0; i < components.length; i++) {
componentRefresh(components[i] + 1, components[i]); componentRefresh(components[i] + 1, components[i]);
@ -398,7 +429,7 @@ export function renderEmbeddedTemplate<T>(
template(context, cm); template(context, cm);
refreshDynamicChildren(); refreshDynamicChildren();
refreshChildComponents(); refreshDirectives();
} finally { } finally {
leaveView(currentView !.parent !); leaveView(currentView !.parent !);
isParent = _isParent; isParent = _isParent;
@ -416,11 +447,12 @@ export function renderComponentOrTemplate<T>(
} }
if (template) { if (template) {
template(componentOrContext !, creationMode); template(componentOrContext !, creationMode);
refreshChildComponents(); refreshDirectives();
} else { } else {
executeInitAndContentHooks(); executeInitAndContentHooks();
// Element was stored at 0 and directive was stored at 1 in renderComponent // Element was stored at 0 and directive was stored at 1 in renderComponent
// so to refresh the component, refresh() needs to be called with (1, 0) setHostBindings(rootDirectiveIndices);
componentRefresh(1, 0); componentRefresh(1, 0);
} }
} finally { } finally {
@ -466,7 +498,7 @@ export function elementStart(
let hostComponentDef: ComponentDef<any>|null = null; let hostComponentDef: ComponentDef<any>|null = null;
let name = nameOrComponentType as string; let name = nameOrComponentType as string;
if (isHostElement) { if (isHostElement) {
hostComponentDef = currentView.tView.firstTemplatePass ? hostComponentDef = firstTemplatePass ?
(nameOrComponentType as ComponentType<any>).ngComponentDef : (nameOrComponentType as ComponentType<any>).ngComponentDef :
tData[index + 1] as ComponentDef<any>; tData[index + 1] as ComponentDef<any>;
name = hostComponentDef !.tag; name = hostComponentDef !.tag;
@ -501,24 +533,36 @@ export function elementStart(
if (attrs) setUpAttributes(native, attrs); if (attrs) setUpAttributes(native, attrs);
appendChild(node.parent !, native, currentView); appendChild(node.parent !, native, currentView);
const elementIndex = index;
if (hostComponentDef) { if (hostComponentDef) {
// TODO(mhevery): This assumes that the directives come in correct order, which // TODO(mhevery): This assumes that the directives come in correct order, which
// is not guaranteed. Must be refactored to take it into account. // is not guaranteed. Must be refactored to take it into account.
const instance = hostComponentDef.n(); const instance = hostComponentDef.factory();
storeComponentIndex(index);
directiveCreate(++index, instance, hostComponentDef, null); directiveCreate(++index, instance, hostComponentDef, null);
initChangeDetectorIfExisting(node.nodeInjector, instance); initChangeDetectorIfExisting(node.nodeInjector, instance);
queueComponentIndexForCheck(elementIndex);
if (hostComponentDef.hostBindings) queueHostBindingForCheck(index, elementIndex);
} }
hack_declareDirectives(index, directiveTypes, localRefs); hack_declareDirectives(index, elementIndex, directiveTypes, localRefs);
} }
} }
return native; return native;
} }
/** Stores index of component so it will be queued for refresh during change detection. */ /** Stores index of component's host element so it will be queued for view refresh during CD. */
function storeComponentIndex(index: number): void { function queueComponentIndexForCheck(elIndex: number): void {
if (currentView.tView.firstTemplatePass) { if (firstTemplatePass) {
(currentView.tView.components || (currentView.tView.components = [])).push(index); (currentView.tView.components || (currentView.tView.components = [])).push(elIndex);
}
}
/** Stores index of directive and host element so it will be queued for binding refresh during CD.
*/
function queueHostBindingForCheck(dirIndex: number, elIndex: number): void {
if (firstTemplatePass) {
(currentView.tView.hostBindings || (currentView.tView.hostBindings = [
])).push(dirIndex, elIndex);
} }
} }
@ -534,7 +578,7 @@ export function initChangeDetectorIfExisting(injector: LInjector | null, instanc
* come in the correct order for DI. * come in the correct order for DI.
*/ */
function hack_declareDirectives( function hack_declareDirectives(
index: number, directiveTypes: DirectiveType<any>[] | null | undefined, index: number, elIndex: number, directiveTypes: DirectiveType<any>[] | null | undefined,
localRefs: string[] | null | undefined, ) { localRefs: string[] | null | undefined, ) {
if (directiveTypes) { if (directiveTypes) {
// TODO(mhevery): This assumes that the directives come in correct order, which // TODO(mhevery): This assumes that the directives come in correct order, which
@ -542,13 +586,12 @@ function hack_declareDirectives(
for (let i = 0; i < directiveTypes.length; i++) { for (let i = 0; i < directiveTypes.length; i++) {
index++; index++;
const directiveType = directiveTypes[i]; const directiveType = directiveTypes[i];
const directiveDef = currentView.tView.firstTemplatePass ? directiveType.ngDirectiveDef : const directiveDef =
tData[index] as DirectiveDef<any>; firstTemplatePass ? directiveType.ngDirectiveDef : tData[index] as DirectiveDef<any>;
const localNames = currentView.tView.firstTemplatePass ? const localNames =
findMatchingLocalNames(directiveDef, localRefs, index) : firstTemplatePass ? findMatchingLocalNames(directiveDef, localRefs, index) : null;
null; directiveCreate(index, directiveDef.factory(), directiveDef, localNames);
if (directiveDef.hostBindings) queueHostBindingForCheck(index, elIndex);
directiveCreate(index, directiveDef.n(), directiveDef, localNames);
} }
} }
} }
@ -598,6 +641,7 @@ export function createTView(): TView {
viewHooks: null, viewHooks: null,
viewCheckHooks: null, viewCheckHooks: null,
destroyHooks: null, destroyHooks: null,
hostBindings: null,
components: null components: null
}; };
} }
@ -777,12 +821,12 @@ export function elementProperty<T>(
const tNode = node.tNode !; const tNode = node.tNode !;
// if tNode.inputs is undefined, a listener has created outputs, but inputs haven't // if tNode.inputs is undefined, a listener has created outputs, but inputs haven't
// yet been checked // yet been checked
if (tNode.inputs === undefined) { if (tNode && tNode.inputs === undefined) {
// mark inputs as checked // mark inputs as checked
tNode.inputs = generatePropertyAliases(node.flags, BindingDirection.Input); tNode.inputs = generatePropertyAliases(node.flags, BindingDirection.Input);
} }
const inputData = tNode.inputs; const inputData = tNode && tNode.inputs;
let dataValue: PropertyAliasValue|undefined; let dataValue: PropertyAliasValue|undefined;
if (inputData && (dataValue = inputData[propName])) { if (inputData && (dataValue = inputData[propName])) {
setInputsForProperty(dataValue, value); setInputsForProperty(dataValue, value);
@ -1209,7 +1253,7 @@ export function container(
// Containers are added to the current view tree instead of their embedded views // Containers are added to the current view tree instead of their embedded views
// because views can be removed and re-inserted. // because views can be removed and re-inserted.
addToViewTree(node.data); addToViewTree(node.data);
hack_declareDirectives(index, directiveTypes, localRefs); hack_declareDirectives(index, index, directiveTypes, localRefs);
isParent = false; isParent = false;
ngDevMode && assertNodeType(previousOrParentNode, LNodeFlags.Container); ngDevMode && assertNodeType(previousOrParentNode, LNodeFlags.Container);
@ -1366,7 +1410,7 @@ function getOrCreateEmbeddedTView(viewIndex: number, parent: LContainerNode): TV
/** Marks the end of an embedded view. */ /** Marks the end of an embedded view. */
export function embeddedViewEnd(): void { export function embeddedViewEnd(): void {
refreshChildComponents(); refreshDirectives();
isParent = false; isParent = false;
const viewNode = previousOrParentNode = currentView.node as LViewNode; const viewNode = previousOrParentNode = currentView.node as LViewNode;
const containerNode = previousOrParentNode.parent as LContainerNode; const containerNode = previousOrParentNode.parent as LContainerNode;
@ -1390,22 +1434,16 @@ export function embeddedViewEnd(): void {
///////////// /////////////
/** /**
* Refreshes the directive. * Refreshes components by entering the component view and processing its bindings, queries, etc.
*
* When it is a component, it also enters the component's view and processes it to update bindings,
* queries, etc.
* *
* @param directiveIndex * @param directiveIndex
* @param elementIndex * @param elementIndex
*/ */
export function componentRefresh<T>(directiveIndex: number, elementIndex: number): void { export function componentRefresh<T>(directiveIndex: number, elementIndex: number): void {
const template = (tData[directiveIndex] as ComponentDef<T>).template;
if (template != null) {
ngDevMode && assertDataInRange(elementIndex); ngDevMode && assertDataInRange(elementIndex);
const element = data ![elementIndex] as LElementNode; const element = data ![elementIndex] as LElementNode;
ngDevMode && assertNodeType(element, LNodeFlags.Element); ngDevMode && assertNodeType(element, LNodeFlags.Element);
ngDevMode && ngDevMode && assertNotNull(element.data, `Component's host node should have an LView attached.`);
assertNotNull(element.data, `Component's host node should have an LView attached.`);
const hostView = element.data !; const hostView = element.data !;
// Only attached CheckAlways components or attached, dirty OnPush components should be checked // Only attached CheckAlways components or attached, dirty OnPush components should be checked
@ -1413,7 +1451,6 @@ export function componentRefresh<T>(directiveIndex: number, elementIndex: number
ngDevMode && assertDataInRange(directiveIndex); ngDevMode && assertDataInRange(directiveIndex);
detectChangesInternal(hostView, element, getDirectiveInstance<T>(data[directiveIndex])); detectChangesInternal(hostView, element, getDirectiveInstance<T>(data[directiveIndex]));
} }
}
} }
/** Returns a boolean for whether the view is attached */ /** Returns a boolean for whether the view is attached */
@ -1756,17 +1793,15 @@ function throwErrorIfNoChangesMode(oldValue: any, currValue: any): never|void {
function detectChangesInternal<T>(hostView: LView, hostNode: LElementNode, component: T) { function detectChangesInternal<T>(hostView: LView, hostNode: LElementNode, component: T) {
const componentIndex = hostNode.flags >> LNodeFlags.INDX_SHIFT; const componentIndex = hostNode.flags >> LNodeFlags.INDX_SHIFT;
const template = (hostNode.view.tView.data[componentIndex] as ComponentDef<T>).template; const template = (hostNode.view.tView.data[componentIndex] as ComponentDef<T>).template;
const oldView = enterView(hostView, hostNode);
if (template != null) { const oldView = enterView(hostView, hostNode);
try { try {
template(component, creationMode); template(component, creationMode);
refreshDynamicChildren(); refreshDynamicChildren();
refreshChildComponents(); refreshDirectives();
} finally { } finally {
leaveView(oldView); leaveView(oldView);
} }
}
} }

View File

@ -85,17 +85,11 @@ export interface DirectiveDef<T> {
* *
* Usually returns the directive instance, but if the directive has a content query, * Usually returns the directive instance, but if the directive has a content query,
* it instead returns an array that contains the instance as well as content query data. * it instead returns an array that contains the instance as well as content query data.
*
* NOTE: this property is short (1 char) because it is used in
* component templates which is sensitive to size.
*/ */
n(): T|[T]; factory(): T|[T];
/** /** Refreshes host bindings on the associated directive. */
* Refreshes host bindings on the associated directive. Also calls lifecycle hooks hostBindings: ((directiveIndex: number, elementIndex: number) => void)|null;
* like ngOnInit and ngDoCheck, if they are defined on the directive.
*/
h(directiveIndex: number, elementIndex: number): void;
/** /**
* Static attributes to set on host element. * Static attributes to set on host element.

View File

@ -282,6 +282,14 @@ export interface TView {
* current view has finished its check. * current view has finished its check.
*/ */
components: number[]|null; components: number[]|null;
/**
* A list of indices for child directives that have host bindings.
*
* Even indices: Directive indices
* Odd indices: Element indices
*/
hostBindings: number[]|null;
} }
/** /**

View File

@ -152,15 +152,15 @@
{ {
"name": "locateHostElement" "name": "locateHostElement"
}, },
{
"name": "noop$2"
},
{ {
"name": "queueInitHooks" "name": "queueInitHooks"
}, },
{ {
"name": "refreshChildComponents" "name": "refreshChildComponents"
}, },
{
"name": "refreshDirectives"
},
{ {
"name": "refreshDynamicChildren" "name": "refreshDynamicChildren"
}, },
@ -179,6 +179,12 @@
{ {
"name": "resolveRendererType2" "name": "resolveRendererType2"
}, },
{
"name": "rootDirectiveIndices"
},
{
"name": "setHostBindings"
},
{ {
"name": "setInputsFromAttrs" "name": "setInputsFromAttrs"
}, },

View File

@ -132,7 +132,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'name', bind(ctx.name)); elementProperty(0, 'name', bind(ctx.name));
MyComponent.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -212,7 +211,6 @@ describe('change detection', () => {
{ listener('click', () => ctx.noop()); } { listener('click', () => ctx.noop()); }
elementEnd(); elementEnd();
} }
MyComponent.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -244,7 +242,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
textBinding(0, interpolation1('', ctx.doCheckCount, ' - ')); textBinding(0, interpolation1('', ctx.doCheckCount, ' - '));
MyComponent.ngComponentDef.h(2, 1);
}, },
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}); });
@ -261,7 +258,6 @@ describe('change detection', () => {
elementStart(0, ButtonParent); elementStart(0, ButtonParent);
elementEnd(); elementEnd();
} }
ButtonParent.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -337,7 +333,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
textBinding(0, interpolation1('', ctx.doCheckCount, ' - ')); textBinding(0, interpolation1('', ctx.doCheckCount, ' - '));
MyComp.ngComponentDef.h(2, 1);
} }
}); });
} }
@ -415,8 +410,6 @@ describe('change detection', () => {
elementStart(0, MyComp, ['dir', ''], [Dir]); elementStart(0, MyComp, ['dir', ''], [Dir]);
elementEnd(); elementEnd();
} }
MyComp.ngComponentDef.h(1, 0);
Dir.ngDirectiveDef.h(2, 0);
} }
}); });
} }
@ -448,7 +441,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
textBinding(1, bind(ctx.name)); textBinding(1, bind(ctx.name));
Dir.ngDirectiveDef.h(2, 1);
} }
}); });
} }
@ -491,7 +483,6 @@ describe('change detection', () => {
elementStart(0, 'div', ['dir', ''], [Dir]); elementStart(0, 'div', ['dir', ''], [Dir]);
elementEnd(); elementEnd();
} }
Dir.ngDirectiveDef.h(1, 0);
} }
embeddedViewEnd(); embeddedViewEnd();
} }
@ -584,7 +575,6 @@ describe('change detection', () => {
elementStart(0, DetachedComp); elementStart(0, DetachedComp);
elementEnd(); elementEnd();
} }
DetachedComp.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -723,7 +713,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'value', bind(ctx.value)); elementProperty(0, 'value', bind(ctx.value));
OnPushComp.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -790,7 +779,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
textBinding(0, interpolation1('', ctx.value, ' - ')); textBinding(0, interpolation1('', ctx.value, ' - '));
OnPushComp.ngComponentDef.h(2, 1);
}, },
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}); });
@ -865,7 +853,6 @@ describe('change detection', () => {
elementStart(0, OnPushComp); elementStart(0, OnPushComp);
elementEnd(); elementEnd();
} }
OnPushComp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -948,7 +935,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
textBinding(0, interpolation1('', ctx.value, ' - ')); textBinding(0, interpolation1('', ctx.value, ' - '));
NoChangesComp.ngComponentDef.h(2, 1);
} }
}); });
} }

View File

@ -71,8 +71,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
$r3$.ɵT(3, '!'); $r3$.ɵT(3, '!');
} }
ChildComponent.ngComponentDef.h(1, 0);
SomeDirective.ngDirectiveDef.h(2, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -119,7 +117,6 @@ describe('components & directives', () => {
$r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$); $r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$);
$r3$.ɵe(); $r3$.ɵe();
} }
HostBindingDir.ngDirectiveDef.h(1, 0);
} }
}); });
} }
@ -167,7 +164,6 @@ describe('components & directives', () => {
$r3$.ɵT(2, 'Click'); $r3$.ɵT(2, 'Click');
$r3$.ɵe(); $r3$.ɵe();
} }
HostListenerDir.ngDirectiveDef.h(1, 0);
} }
}); });
} }
@ -209,7 +205,6 @@ describe('components & directives', () => {
$r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$); $r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$);
$r3$.ɵe(); $r3$.ɵe();
} }
HostAttributeDir.ngDirectiveDef.h(1, 0);
} }
}); });
} }
@ -254,7 +249,6 @@ describe('components & directives', () => {
$r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$); $r3$.ɵE(0, 'div', $e0_attrs$, $e0_dirs$);
$r3$.ɵe(); $r3$.ɵe();
} }
HostBindingDir.ngDirectiveDef.h(1, 0);
} }
}); });
} }
@ -312,7 +306,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name)); $r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name));
MyComp.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -430,7 +423,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'names', cm ? $e0_arr$ : $r3$.ɵNC); $r3$.ɵp(0, 'names', cm ? $e0_arr$ : $r3$.ɵNC);
MyArrayComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -469,7 +461,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'names', $r3$.ɵb(ctx.someFn($r3$.ɵf0($e0_ff$)))); $r3$.ɵp(0, 'names', $r3$.ɵb(ctx.someFn($r3$.ɵf0($e0_ff$))));
MyArrayComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -522,7 +513,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'num', $r3$.ɵb($r3$.ɵf0($e0_ff$).length + 1)); $r3$.ɵp(0, 'num', $r3$.ɵb($r3$.ɵf0($e0_ff$).length + 1));
MyComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -559,7 +549,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'names', $r3$.ɵb($r3$.ɵf1($e0_ff$, ctx.customName))); $r3$.ɵp(0, 'names', $r3$.ɵb($r3$.ɵf1($e0_ff$, ctx.customName)));
MyArrayComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -663,7 +652,6 @@ describe('components & directives', () => {
$r3$.ɵp( $r3$.ɵp(
0, 'names', 0, 'names',
$r3$.ɵb($r3$.ɵfV($e0_ff$, [c.n0, c.n1, c.n2, c.n3, c.n4, c.n5, c.n6, c.n7, c.n8]))); $r3$.ɵb($r3$.ɵfV($e0_ff$, [c.n0, c.n1, c.n2, c.n3, c.n4, c.n5, c.n6, c.n7, c.n8])));
MyComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -730,7 +718,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
$r3$.ɵp(0, 'config', $r3$.ɵb($r3$.ɵf1($e0_ff$, ctx.name))); $r3$.ɵp(0, 'config', $r3$.ɵb($r3$.ɵf1($e0_ff$, ctx.name)));
ObjectComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -810,7 +797,6 @@ describe('components & directives', () => {
0, 'config', $r3$.ɵf2( 0, 'config', $r3$.ɵf2(
$e0_ff_2$, ctx.name, $e0_ff_2$, ctx.name,
$r3$.ɵb($r3$.ɵf1($e0_ff_1$, $r3$.ɵf1($e0_ff$, ctx.duration))))); $r3$.ɵb($r3$.ɵf1($e0_ff_1$, $r3$.ɵf1($e0_ff$, ctx.duration)))));
NestedComp.ngComponentDef.h(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE

View File

@ -55,7 +55,6 @@ describe('injection', () => {
$r3$.ɵE(0, MyComp); $r3$.ɵE(0, MyComp);
$r3$.ɵe(); $r3$.ɵe();
} }
MyComp.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -99,7 +98,6 @@ describe('injection', () => {
$r3$.ɵE(0, MyComp, e0_attrs); $r3$.ɵE(0, MyComp, e0_attrs);
$r3$.ɵe(); $r3$.ɵe();
} }
MyComp.ngComponentDef.h(1, 0);
} }
}); });
} }

View File

@ -75,8 +75,6 @@ describe('lifecycle hooks', () => {
} }
$r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name1)); $r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name1));
$r3$.ɵp(2, 'name', $r3$.ɵb(ctx.name2)); $r3$.ɵp(2, 'name', $r3$.ɵb(ctx.name2));
LifecycleComp.ngComponentDef.h(1, 0);
LifecycleComp.ngComponentDef.h(3, 2);
} }
}); });
// /NORMATIVE // /NORMATIVE

View File

@ -62,7 +62,6 @@ describe('queries', () => {
$r3$.ɵqR($tmp$ = $r3$.ɵld<QueryList<any>>(0)) && (ctx.someDir = $tmp$.first); $r3$.ɵqR($tmp$ = $r3$.ɵld<QueryList<any>>(0)) && (ctx.someDir = $tmp$.first);
$r3$.ɵqR($tmp$ = $r3$.ɵld<QueryList<any>>(1)) && $r3$.ɵqR($tmp$ = $r3$.ɵld<QueryList<any>>(1)) &&
(ctx.someDirList = $tmp$ as QueryList<any>); (ctx.someDirList = $tmp$ as QueryList<any>);
SomeDirective.ngDirectiveDef.h(3, 2);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -145,8 +144,6 @@ describe('queries', () => {
$r3$.ɵe(); $r3$.ɵe();
$r3$.ɵe(); $r3$.ɵe();
} }
ContentQueryComponent.ngComponentDef.h(1, 0);
SomeDirective.ngDirectiveDef.h(3, 2);
} }
}); });
// /NON-NORMATIVE // /NON-NORMATIVE

View File

@ -111,7 +111,6 @@ describe('component with a container', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'items', bind(ctx.items)); elementProperty(0, 'items', bind(ctx.items));
WrapperComponent.ngComponentDef.h(1, 0);
} }
it('should re-render on input change', () => { it('should re-render on input change', () => {
@ -136,7 +135,6 @@ describe('encapsulation', () => {
elementStart(0, EncapsulatedComponent); elementStart(0, EncapsulatedComponent);
elementEnd(); elementEnd();
} }
EncapsulatedComponent.ngComponentDef.h(1, 0);
}, },
factory: () => new WrapperComponent, factory: () => new WrapperComponent,
}); });
@ -152,7 +150,6 @@ describe('encapsulation', () => {
elementStart(1, LeafComponent); elementStart(1, LeafComponent);
elementEnd(); elementEnd();
} }
LeafComponent.ngComponentDef.h(2, 1);
}, },
factory: () => new EncapsulatedComponent, factory: () => new EncapsulatedComponent,
rendererType: rendererType:
@ -199,7 +196,6 @@ describe('encapsulation', () => {
elementStart(0, LeafComponentwith); elementStart(0, LeafComponentwith);
elementEnd(); elementEnd();
} }
LeafComponentwith.ngComponentDef.h(1, 0);
}, },
factory: () => new WrapperComponentWith, factory: () => new WrapperComponentWith,
rendererType: rendererType:
@ -266,7 +262,6 @@ describe('recursive components', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'data', bind(ctx.data.left)); elementProperty(0, 'data', bind(ctx.data.left));
TreeComponent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -279,7 +274,6 @@ describe('recursive components', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'data', bind(ctx.data.right)); elementProperty(0, 'data', bind(ctx.data.right));
TreeComponent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -35,7 +35,6 @@ describe('content projection', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>content</div></child>'); expect(toHtml(parent)).toEqual('<child><div>content</div></child>');
@ -54,7 +53,6 @@ describe('content projection', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child>content</child>'); expect(toHtml(parent)).toEqual('<child>content</child>');
@ -75,7 +73,6 @@ describe('content projection', () => {
elementStart(1, GrandChild); elementStart(1, GrandChild);
{ projection(3, 0); } { projection(3, 0); }
elementEnd(); elementEnd();
GrandChild.ngComponentDef.h(2, 1);
} }
}); });
const Parent = createComponent('parent', function(ctx: any, cm: boolean) { const Parent = createComponent('parent', function(ctx: any, cm: boolean) {
@ -89,7 +86,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)) expect(toHtml(parent))
@ -128,8 +124,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)) expect(toHtml(parent))
@ -165,7 +159,6 @@ describe('content projection', () => {
} }
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>()</div></child>'); expect(toHtml(parent)).toEqual('<child><div>()</div></child>');
@ -200,7 +193,6 @@ describe('content projection', () => {
} }
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child></child>'); expect(toHtml(parent)).toEqual('<child></child>');
@ -248,7 +240,6 @@ describe('content projection', () => {
} }
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>(else)</div></child>'); expect(toHtml(parent)).toEqual('<child><div>(else)</div></child>');
@ -305,7 +296,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div><span>content</span></div></child>'); expect(toHtml(parent)).toEqual('<child><div><span>content</span></div></child>');
@ -357,7 +347,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>content</div></child>'); expect(toHtml(parent)).toEqual('<child><div>content</div></child>');
@ -411,7 +400,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div>before-content-after</div></child>'); expect(toHtml(parent)).toEqual('<child><div>before-content-after</div></child>');
@ -447,7 +435,6 @@ describe('content projection', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><div></div><span>content</span></child>'); expect(toHtml(parent)).toEqual('<child><div></div><span>content</span></child>');
@ -504,7 +491,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child>content<div></div></child>'); expect(toHtml(parent)).toEqual('<child>content<div></div></child>');
@ -554,7 +540,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -601,7 +586,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -648,7 +632,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -695,7 +678,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -741,7 +723,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -788,7 +769,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -835,7 +815,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
elementEnd(); elementEnd();
GrandChild.ngComponentDef.h(2, 1);
} }
}); });
@ -856,7 +835,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -901,7 +879,6 @@ describe('content projection', () => {
projection(5, 0, 0, ['card-content', '']); projection(5, 0, 0, ['card-content', '']);
} }
elementEnd(); elementEnd();
Card.ngComponentDef.h(2, 1);
} }
}); });
@ -916,7 +893,6 @@ describe('content projection', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
CardWithTitle.ngComponentDef.h(1, 0);
}); });
const app = renderComponent(App); const app = renderComponent(App);
@ -962,7 +938,6 @@ describe('content projection', () => {
projection(5, 0, 0, ['ngProjectAs', '[card-content]']); projection(5, 0, 0, ['ngProjectAs', '[card-content]']);
} }
elementEnd(); elementEnd();
Card.ngComponentDef.h(2, 1);
} }
}); });
@ -977,7 +952,6 @@ describe('content projection', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
CardWithTitle.ngComponentDef.h(1, 0);
}); });
const app = renderComponent(App); const app = renderComponent(App);
@ -1017,7 +991,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -1063,7 +1036,6 @@ describe('content projection', () => {
} }
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child><span><div>content</div></span></child>'); expect(toHtml(parent)).toEqual('<child><span><div>content</div></span></child>');

View File

@ -35,7 +35,7 @@ describe('define', () => {
}); });
} }
const myDir = MyDirective.ngDirectiveDef.n() as MyDirective; const myDir = MyDirective.ngDirectiveDef.factory() as MyDirective;
myDir.valA = 'first'; myDir.valA = 'first';
expect(myDir.valA).toEqual('first'); expect(myDir.valA).toEqual('first');
myDir.valB = 'second'; myDir.valB = 'second';

View File

@ -258,9 +258,6 @@ describe('di', () => {
text(4); text(4);
} }
textBinding(4, bind(load<Directive>(2).value)); textBinding(4, bind(load<Directive>(2).value));
MyComp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
DirectiveSameInstance.ngDirectiveDef.h(3, 0);
} }
}); });
} }
@ -291,8 +288,6 @@ describe('di', () => {
elementEnd(); elementEnd();
} }
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0);
} }
}); });
} }
@ -330,9 +325,6 @@ describe('di', () => {
text(5); text(5);
} }
textBinding(5, bind(load<Directive>(3).value)); textBinding(5, bind(load<Directive>(3).value));
MyComp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(3, 2);
DirectiveSameInstance.ngDirectiveDef.h(4, 2);
} }
}); });
} }
@ -375,8 +367,6 @@ describe('di', () => {
elementEnd(); elementEnd();
} }
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0);
} }
embeddedViewEnd(); embeddedViewEnd();
} }
@ -438,8 +428,6 @@ describe('di', () => {
elementEnd(); elementEnd();
} }
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0);
} }
} }
}); });

View File

@ -34,7 +34,6 @@ describe('directive', () => {
elementStart(0, 'span', null, [Directive]); elementStart(0, 'span', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
} }
expect(renderToHtml(Template, {})).toEqual('<span class="foo"></span>'); expect(renderToHtml(Template, {})).toEqual('<span class="foo"></span>');

View File

@ -200,7 +200,6 @@ describe('render3 integration test', () => {
elementStart(0, TodoComponent); elementStart(0, TodoComponent);
elementEnd(); elementEnd();
} }
TodoComponent.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>'); expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>');
@ -213,7 +212,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
text(2, 'two'); text(2, 'two');
} }
TodoComponent.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>two'); expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>two');
}); });
@ -230,8 +228,6 @@ describe('render3 integration test', () => {
elementStart(2, TodoComponent); elementStart(2, TodoComponent);
elementEnd(); elementEnd();
} }
TodoComponent.ngComponentDef.h(1, 0);
TodoComponent.ngComponentDef.h(3, 2);
} }
expect(renderToHtml(Template, null)) expect(renderToHtml(Template, null))
.toEqual('<todo><p>Todo one</p></todo><todo><p>Todo one</p></todo>'); .toEqual('<todo><p>Todo one</p></todo><todo><p>Todo one</p></todo>');
@ -266,7 +262,6 @@ describe('render3 integration test', () => {
elementStart(0, TodoComponentHostBinding); elementStart(0, TodoComponentHostBinding);
elementEnd(); elementEnd();
} }
TodoComponentHostBinding.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, {})).toEqual('<todo title="one">one</todo>'); expect(renderToHtml(Template, {})).toEqual('<todo title="one">one</todo>');
@ -298,7 +293,6 @@ describe('render3 integration test', () => {
elementStart(0, MyComp); elementStart(0, MyComp);
elementEnd(); elementEnd();
} }
MyComp.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, null)).toEqual('<comp><p>Bess</p></comp>'); expect(renderToHtml(Template, null)).toEqual('<comp><p>Bess</p></comp>');
@ -344,7 +338,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'condition', bind(ctx.condition)); elementProperty(0, 'condition', bind(ctx.condition));
MyComp.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, {condition: true})).toEqual('<comp><div>text</div></comp>'); expect(renderToHtml(Template, {condition: true})).toEqual('<comp><div>text</div></comp>');
@ -464,7 +457,6 @@ describe('render3 integration test', () => {
embeddedViewEnd(); embeddedViewEnd();
} }
containerRefreshEnd(); containerRefreshEnd();
ChildComponent.ngComponentDef.h(1, 0);
} }
it('should work with a tree', () => { it('should work with a tree', () => {
@ -639,7 +631,6 @@ describe('render3 integration test', () => {
elementStart(0, 'div', ['hostBindingDir', ''], [HostBindingDir]); elementStart(0, 'div', ['hostBindingDir', ''], [HostBindingDir]);
elementEnd(); elementEnd();
} }
HostBindingDir.ngDirectiveDef.h(1, 0);
} }
expect(renderToHtml(Template, {})) expect(renderToHtml(Template, {}))

View File

@ -21,7 +21,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
type.ngComponentDef.h(1, 0);
}; };
} }
@ -74,7 +73,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {val: '1'}); renderToHtml(Template, {val: '1'});
@ -104,7 +102,6 @@ describe('lifecycles', () => {
elementStart(0, Parent); elementStart(0, Parent);
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -128,8 +125,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -155,7 +150,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -184,8 +178,6 @@ describe('lifecycles', () => {
{ elementStart(2, ProjectedComp); } { elementStart(2, ProjectedComp); }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -214,10 +206,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 1); elementProperty(2, 'val', 1);
elementProperty(4, 'val', 2); elementProperty(4, 'val', 2);
elementProperty(6, 'val', 2); elementProperty(6, 'val', 2);
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -231,8 +219,6 @@ describe('lifecycles', () => {
elementStart(0, Comp, null, [Directive]); elementStart(0, Comp, null, [Directive]);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -250,7 +236,6 @@ describe('lifecycles', () => {
elementStart(0, 'div', null, [Directive]); elementStart(0, 'div', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -279,8 +264,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 5); elementProperty(3, 'val', 5);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let j = 2; j < 5; j++) { for (let j = 2; j < 5; j++) {
@ -289,7 +272,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', j); elementProperty(0, 'val', j);
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -322,8 +304,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 5); elementProperty(3, 'val', 5);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let j = 2; j < 5; j++) { for (let j = 2; j < 5; j++) {
@ -332,7 +312,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', j); elementProperty(0, 'val', j);
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -390,7 +369,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -420,7 +398,6 @@ describe('lifecycles', () => {
elementStart(0, Parent); elementStart(0, Parent);
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -434,7 +411,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -451,8 +427,6 @@ describe('lifecycles', () => {
elementStart(0, Comp, null, [Directive]); elementStart(0, Comp, null, [Directive]);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -470,7 +444,6 @@ describe('lifecycles', () => {
elementStart(0, 'div', null, [Directive]); elementStart(0, 'div', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -506,7 +479,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(1, 'val', bind(ctx.val)); elementProperty(1, 'val', bind(ctx.val));
Comp.ngComponentDef.h(2, 1);
}); });
let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => { let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => {
@ -543,7 +515,6 @@ describe('lifecycles', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -580,7 +551,6 @@ describe('lifecycles', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -609,7 +579,6 @@ describe('lifecycles', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -634,8 +603,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 2); elementProperty(3, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -663,8 +630,6 @@ describe('lifecycles', () => {
} }
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -706,10 +671,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 1); elementProperty(2, 'val', 1);
elementProperty(5, 'val', 2); elementProperty(5, 'val', 2);
elementProperty(7, 'val', 2); elementProperty(7, 'val', 2);
Parent.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
Parent.ngComponentDef.h(6, 5);
ProjectedComp.ngComponentDef.h(8, 7);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -736,8 +697,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(4, 'val', 4); elementProperty(4, 'val', 4);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(5, 4);
containerRefreshStart(3); containerRefreshStart(3);
{ {
for (let i = 2; i < 4; i++) { for (let i = 2; i < 4; i++) {
@ -747,7 +706,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -770,8 +728,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(4, 'val', 4); elementProperty(4, 'val', 4);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(5, 4);
containerRefreshStart(3); containerRefreshStart(3);
{ {
for (let i = 2; i < 4; i++) { for (let i = 2; i < 4; i++) {
@ -781,7 +737,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -812,7 +767,6 @@ describe('lifecycles', () => {
{ text(2, 'content'); } { text(2, 'content'); }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -849,8 +803,6 @@ describe('lifecycles', () => {
elementStart(0, Comp, null, [Directive]); elementStart(0, Comp, null, [Directive]);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -864,7 +816,6 @@ describe('lifecycles', () => {
elementStart(0, 'div', null, [Directive]); elementStart(0, 'div', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -924,7 +875,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -960,7 +910,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -989,7 +938,6 @@ describe('lifecycles', () => {
elementStart(0, Parent); elementStart(0, Parent);
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1013,8 +961,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']); expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']);
@ -1036,8 +982,6 @@ describe('lifecycles', () => {
} }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1072,10 +1016,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 1); elementProperty(2, 'val', 1);
elementProperty(4, 'val', 2); elementProperty(4, 'val', 2);
elementProperty(6, 'val', 2); elementProperty(6, 'val', 2);
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1099,8 +1039,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
elementProperty(2, 'val', bind(ctx.val)); elementProperty(2, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
}); });
/** /**
@ -1116,8 +1054,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1142,8 +1078,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 4); elementProperty(3, 'val', 4);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let i = 2; i < 4; i++) { for (let i = 2; i < 4; i++) {
@ -1152,7 +1086,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1182,8 +1115,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 4); elementProperty(3, 'val', 4);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let i = 2; i < 4; i++) { for (let i = 2; i < 4; i++) {
@ -1192,7 +1123,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1214,7 +1144,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1241,7 +1170,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind(ctx.myVal)); elementProperty(0, 'val', bind(ctx.myVal));
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {myVal: 5}); renderToHtml(Template, {myVal: 5});
@ -1269,8 +1197,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(3, 'val', 4); elementProperty(3, 'val', 4);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let i = 2; i < 4; i++) { for (let i = 2; i < 4; i++) {
@ -1279,7 +1205,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1312,8 +1237,6 @@ describe('lifecycles', () => {
elementStart(0, Comp, null, [Directive]); elementStart(0, Comp, null, [Directive]);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1327,7 +1250,6 @@ describe('lifecycles', () => {
elementStart(0, 'div', null, [Directive]); elementStart(0, 'div', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1388,7 +1310,6 @@ describe('lifecycles', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1423,8 +1344,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind('1')); elementProperty(0, 'val', bind('1'));
elementProperty(2, 'val', bind('2')); elementProperty(2, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1456,7 +1375,6 @@ describe('lifecycles', () => {
elementStart(0, Parent); elementStart(0, Parent);
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1483,7 +1401,6 @@ describe('lifecycles', () => {
elementStart(0, Parent); elementStart(0, Parent);
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0);
}); });
function Template(ctx: any, cm: boolean) { function Template(ctx: any, cm: boolean) {
@ -1497,7 +1414,6 @@ describe('lifecycles', () => {
elementStart(0, Grandparent); elementStart(0, Grandparent);
elementEnd(); elementEnd();
} }
Grandparent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1547,10 +1463,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 1); elementProperty(2, 'val', 1);
elementProperty(4, 'val', 2); elementProperty(4, 'val', 2);
elementProperty(6, 'val', 2); elementProperty(6, 'val', 2);
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1591,8 +1503,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind('1')); elementProperty(0, 'val', bind('1'));
elementProperty(3, 'val', bind('3')); elementProperty(3, 'val', bind('3'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
if (ctx.condition2) { if (ctx.condition2) {
@ -1601,7 +1511,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind('2')); elementProperty(0, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1664,8 +1573,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind('1')); elementProperty(0, 'val', bind('1'));
elementProperty(3, 'val', bind('5')); elementProperty(3, 'val', bind('5'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let j = 2; j < ctx.len; j++) { for (let j = 2; j < ctx.len; j++) {
@ -1674,7 +1581,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind(j)); elementProperty(0, 'val', bind(j));
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1746,7 +1652,6 @@ describe('lifecycles', () => {
} }
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(3, 2);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1794,8 +1699,6 @@ describe('lifecycles', () => {
elementStart(0, Comp, null, [Directive]); elementStart(0, Comp, null, [Directive]);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1828,7 +1731,6 @@ describe('lifecycles', () => {
elementStart(0, 'div', null, [Directive]); elementStart(0, 'div', null, [Directive]);
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1864,7 +1766,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(ctx.a)); elementProperty(0, 'val1', bind(ctx.a));
elementProperty(0, 'publicName', bind(ctx.b)); elementProperty(0, 'publicName', bind(ctx.b));
Comp.ngComponentDef.h(1, 0);
}); });
const ProjectedComp = createOnChangesComponent('projected', (ctx: any, cm: boolean) => { const ProjectedComp = createOnChangesComponent('projected', (ctx: any, cm: boolean) => {
if (cm) { if (cm) {
@ -1921,7 +1822,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(ctx.val1)); elementProperty(0, 'val1', bind(ctx.val1));
elementProperty(0, 'publicName', bind(ctx.val2)); elementProperty(0, 'publicName', bind(ctx.val2));
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {val1: '1', val2: 'a'}); renderToHtml(Template, {val1: '1', val2: 'a'});
@ -1947,7 +1847,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(ctx.val1)); elementProperty(0, 'val1', bind(ctx.val1));
elementProperty(0, 'publicName', bind(ctx.val2)); elementProperty(0, 'publicName', bind(ctx.val2));
Parent.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {val1: '1', val2: 'a'}); renderToHtml(Template, {val1: '1', val2: 'a'});
@ -1976,8 +1875,6 @@ describe('lifecycles', () => {
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
elementProperty(2, 'val1', bind(2)); elementProperty(2, 'val1', bind(2));
elementProperty(2, 'publicName', bind(2)); elementProperty(2, 'publicName', bind(2));
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2010,7 +1907,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(1)); elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -2046,8 +1942,6 @@ describe('lifecycles', () => {
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
elementProperty(2, 'val1', bind(2)); elementProperty(2, 'val1', bind(2));
elementProperty(2, 'publicName', bind(2)); elementProperty(2, 'publicName', bind(2));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2083,10 +1977,6 @@ describe('lifecycles', () => {
elementProperty(4, 'publicName', bind(3)); elementProperty(4, 'publicName', bind(3));
elementProperty(6, 'val1', bind(4)); elementProperty(6, 'val1', bind(4));
elementProperty(6, 'publicName', bind(4)); elementProperty(6, 'publicName', bind(4));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2107,7 +1997,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(1)); elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
Comp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2131,7 +2020,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(1)); elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
Directive.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2162,8 +2050,6 @@ describe('lifecycles', () => {
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
elementProperty(3, 'val1', bind(5)); elementProperty(3, 'val1', bind(5));
elementProperty(3, 'publicName', bind(5)); elementProperty(3, 'publicName', bind(5));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let j = 2; j < 5; j++) { for (let j = 2; j < 5; j++) {
@ -2173,7 +2059,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(j)); elementProperty(0, 'val1', bind(j));
elementProperty(0, 'publicName', bind(j)); elementProperty(0, 'publicName', bind(j));
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -2214,8 +2099,6 @@ describe('lifecycles', () => {
elementProperty(0, 'publicName', bind(1)); elementProperty(0, 'publicName', bind(1));
elementProperty(3, 'val1', bind(5)); elementProperty(3, 'val1', bind(5));
elementProperty(3, 'publicName', bind(5)); elementProperty(3, 'publicName', bind(5));
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
containerRefreshStart(2); containerRefreshStart(2);
{ {
for (let j = 2; j < 5; j++) { for (let j = 2; j < 5; j++) {
@ -2225,7 +2108,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val1', bind(j)); elementProperty(0, 'val1', bind(j));
elementProperty(0, 'publicName', bind(j)); elementProperty(0, 'publicName', bind(j));
Parent.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -2299,8 +2181,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2328,7 +2208,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
}); });
/** /**
@ -2344,8 +2223,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', 1); elementProperty(0, 'val', 1);
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});

View File

@ -249,7 +249,6 @@ describe('event listeners', () => {
text(2, 'Click'); text(2, 'Click');
elementEnd(); elementEnd();
} }
HostListenerDir.ngDirectiveDef.h(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -343,8 +342,6 @@ describe('event listeners', () => {
elementStart(3, MyComp); elementStart(3, MyComp);
elementEnd(); elementEnd();
} }
MyComp.ngComponentDef.h(2, 1);
MyComp.ngComponentDef.h(4, 3);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -51,7 +51,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
} }
let counter = 0; let counter = 0;
@ -76,7 +75,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
} }
let counter = 0; let counter = 0;
@ -101,7 +99,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
} }
const ctx = {counter: 0}; const ctx = {counter: 0};
@ -136,7 +133,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -187,7 +183,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -256,8 +251,6 @@ describe('outputs', () => {
elementStart(4, DestroyComp); elementStart(4, DestroyComp);
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(3, 2);
DestroyComp.ngComponentDef.h(5, 4);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -333,7 +326,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
} }
let counter = 0; let counter = 0;
@ -366,7 +358,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'change', bind(ctx.change)); elementProperty(0, 'change', bind(ctx.change));
ButtonToggle.ngComponentDef.h(1, 0);
} }
let counter = 0; let counter = 0;
@ -410,7 +401,6 @@ describe('outputs', () => {
} }
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} else { } else {
if (embeddedViewStart(1)) { if (embeddedViewStart(1)) {

View File

@ -71,7 +71,6 @@ describe('pipe', () => {
pipe(2, DoublePipe.ngPipeDef); pipe(2, DoublePipe.ngPipeDef);
elementEnd(); elementEnd();
} }
MyDir.ngDirectiveDef.h(1, 0);
elementProperty(0, 'elprop', bind(pipeBind1(2, ctx))); elementProperty(0, 'elprop', bind(pipeBind1(2, ctx)));
directive = load(1); directive = load(1);
} }

View File

@ -8,10 +8,10 @@
import {EventEmitter} from '@angular/core'; import {EventEmitter} from '@angular/core';
import {defineComponent, defineDirective} from '../../src/render3/index'; import {defineComponent, defineDirective, tick} from '../../src/render3/index';
import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, listener, load, text, textBinding} from '../../src/render3/instructions'; import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, listener, load, text, textBinding} from '../../src/render3/instructions';
import {renderToHtml} from './render_util'; import {ComponentFixture, renderToHtml} from './render_util';
describe('elementProperty', () => { describe('elementProperty', () => {
@ -62,6 +62,30 @@ describe('elementProperty', () => {
expect(renderToHtml(Template, 'otherId')).toEqual('<span id="_otherId_"></span>'); expect(renderToHtml(Template, 'otherId')).toEqual('<span id="_otherId_"></span>');
}); });
it('should support host bindings on root component', () => {
class HostBindingComp {
id = 'my-id';
static ngComponentDef = defineComponent({
type: HostBindingComp,
tag: 'host-binding-comp',
factory: () => new HostBindingComp(),
hostBindings: (dirIndex: number, elIndex: number) => {
const instance = load(dirIndex) as HostBindingComp;
elementProperty(elIndex, 'id', bind(instance.id));
},
template: (ctx: HostBindingComp, cm: boolean) => {}
});
}
const fixture = new ComponentFixture(HostBindingComp);
expect(fixture.hostElement.id).toBe('my-id');
fixture.component.id = 'other-id';
tick(fixture.component);
expect(fixture.hostElement.id).toBe('other-id');
});
describe('input properties', () => { describe('input properties', () => {
let button: MyButton; let button: MyButton;
let otherDir: OtherDir; let otherDir: OtherDir;
@ -156,7 +180,6 @@ describe('elementProperty', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'id', bind(ctx.id)); elementProperty(0, 'id', bind(ctx.id));
Comp.ngComponentDef.h(1, 0);
} }
expect(renderToHtml(Template, {id: 1})).toEqual(`<comp></comp>`); expect(renderToHtml(Template, {id: 1})).toEqual(`<comp></comp>`);
@ -500,7 +523,6 @@ describe('elementProperty', () => {
elementStart(0, Comp); elementStart(0, Comp);
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -35,7 +35,6 @@ describe('array literals', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'names', bind(pureFunction1(e0_ff, ctx.customName))); elementProperty(0, 'names', bind(pureFunction1(e0_ff, ctx.customName)));
MyComp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {customName: 'Carson'}); renderToHtml(Template, {customName: 'Carson'});
@ -89,7 +88,6 @@ describe('array literals', () => {
} }
elementProperty(0, 'names1', bind(pureFunction1(e0_ff, ctx.customName))); elementProperty(0, 'names1', bind(pureFunction1(e0_ff, ctx.customName)));
elementProperty(0, 'names2', bind(pureFunction1(e0_ff_1, ctx.customName2))); elementProperty(0, 'names2', bind(pureFunction1(e0_ff_1, ctx.customName2)));
ManyPropComp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {customName: 'Carson', customName2: 'George'}); renderToHtml(Template, {customName: 'Carson', customName2: 'George'});
@ -126,7 +124,6 @@ describe('array literals', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'names', bind(ctx.someFn(pureFunction1(e0_ff, ctx.customName)))); elementProperty(0, 'names', bind(ctx.someFn(pureFunction1(e0_ff, ctx.customName))));
MyComp.ngComponentDef.h(1, 0);
} }
}); });
} }
@ -138,8 +135,6 @@ describe('array literals', () => {
elementStart(2, ParentComp); elementStart(2, ParentComp);
elementEnd(); elementEnd();
} }
ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -166,7 +161,6 @@ describe('array literals', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'names', bind(pureFunction2(e0_ff, ctx.customName, ctx.customName2))); elementProperty(0, 'names', bind(pureFunction2(e0_ff, ctx.customName, ctx.customName2)));
MyComp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {customName: 'Carson', customName2: 'Hannah'}); renderToHtml(Template, {customName: 'Carson', customName2: 'Hannah'});
@ -243,12 +237,6 @@ describe('array literals', () => {
8, 'names', bind(pureFunction7(e8_ff, c[1], c[2], c[3], c[4], c[5], c[6], c[7]))); 8, 'names', bind(pureFunction7(e8_ff, c[1], c[2], c[3], c[4], c[5], c[6], c[7])));
elementProperty( elementProperty(
10, 'names', bind(pureFunction8(e10_ff, c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]))); 10, 'names', bind(pureFunction8(e10_ff, c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7])));
MyComp.ngComponentDef.h(1, 0);
MyComp.ngComponentDef.h(3, 2);
MyComp.ngComponentDef.h(5, 4);
MyComp.ngComponentDef.h(7, 6);
MyComp.ngComponentDef.h(9, 8);
MyComp.ngComponentDef.h(11, 10);
} }
renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']); renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']);
@ -295,7 +283,6 @@ describe('array literals', () => {
elementProperty(0, 'names', bind(pureFunctionV(e0_ff, [ elementProperty(0, 'names', bind(pureFunctionV(e0_ff, [
c[0], c[1], c[2], c[3], pureFunction1(e0_ff_1, c[4]), c[5], c[6], c[7], c[8] c[0], c[1], c[2], c[3], pureFunction1(e0_ff_1, c[4]), c[5], c[6], c[7], c[8]
]))); ])));
MyComp.ngComponentDef.h(1, 0);
} }
expect(myComp !.names).toEqual([ expect(myComp !.names).toEqual([
@ -339,7 +326,6 @@ describe('object literals', () => {
elementEnd(); elementEnd();
} }
elementProperty(0, 'config', bind(pureFunction1(e0_ff, ctx.name))); elementProperty(0, 'config', bind(pureFunction1(e0_ff, ctx.name)));
ObjectComp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {name: 'slide'}); renderToHtml(Template, {name: 'slide'});
@ -376,7 +362,6 @@ describe('object literals', () => {
0, 'config', 0, 'config',
bind(pureFunction2( bind(pureFunction2(
e0_ff, ctx.name, pureFunction1(e0_ff_1, pureFunction1(e0_ff_2, ctx.duration))))); e0_ff, ctx.name, pureFunction1(e0_ff_1, pureFunction1(e0_ff_2, ctx.duration)))));
ObjectComp.ngComponentDef.h(1, 0);
} }
renderToHtml(Template, {name: 'slide', duration: 100}); renderToHtml(Template, {name: 'slide', duration: 100});
@ -443,7 +428,6 @@ describe('object literals', () => {
elementProperty( elementProperty(
0, 'config', 0, 'config',
bind(pureFunction2(e0_ff, ctx.configs[i].opacity, ctx.configs[i].duration))); bind(pureFunction2(e0_ff, ctx.configs[i].opacity, ctx.configs[i].duration)));
ObjectComp.ngComponentDef.h(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -67,7 +67,6 @@ describe('renderer factory lifecycle', () => {
elementStart(1, SomeComponent); elementStart(1, SomeComponent);
elementEnd(); elementEnd();
} }
SomeComponent.ngComponentDef.h(2, 1);
} }
beforeEach(() => { logs = []; }); beforeEach(() => { logs = []; });

View File

@ -41,7 +41,6 @@ describe('ViewContainerRef', () => {
} }
containerRefreshStart(0); containerRefreshStart(0);
cmp.testDir = load<TestDirective>(1); cmp.testDir = load<TestDirective>(1);
TestDirective.ngDirectiveDef.h(1, 0);
containerRefreshEnd(); containerRefreshEnd();
}, },
}); });