refactor(ivy): remove directiveRefresh instruction (#22745)

PR Close #22745
This commit is contained in:
Kara Erickson 2018-03-13 11:48:09 -07:00
parent 4ac606b419
commit b1365d1fa8
28 changed files with 157 additions and 313 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵi1 as i1, ɵp as p, ɵr as r, ɵs as s, ɵt as t, ɵv as v} from '@angular/core'; import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵi1 as i1, ɵp as p, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
import {ComponentDef} from '@angular/core/src/render3/interfaces/definition'; import {ComponentDef} from '@angular/core/src/render3/interfaces/definition';
import {TreeNode, buildTree, emptyTree} from '../util'; import {TreeNode, buildTree, emptyTree} from '../util';
@ -59,7 +59,6 @@ export class TreeComponent {
} }
p(0, 'data', b(ctx.data.left)); p(0, 'data', b(ctx.data.left));
TreeComponent.ngComponentDef.h(1, 0); TreeComponent.ngComponentDef.h(1, 0);
r(1, 0);
} }
v(); v();
} }
@ -76,7 +75,6 @@ export class TreeComponent {
} }
p(0, 'data', b(ctx.data.right)); p(0, 'data', b(ctx.data.right));
TreeComponent.ngComponentDef.h(1, 0); TreeComponent.ngComponentDef.h(1, 0);
r(1, 0);
} }
v(); v();
} }

View File

@ -67,7 +67,6 @@ export {
s as ɵs, s as ɵs,
t as ɵt, t as ɵt,
v as ɵv, v as ɵv,
r as ɵr,
st as ɵst, st as ɵst,
ld as ɵld, ld as ɵld,
Pp as ɵPp, Pp as ɵPp,

View File

@ -97,20 +97,7 @@ function queueDestroyHooks(def: DirectiveDef<any>, tView: TView, i: number): voi
export function executeInitHooks(currentView: LView, tView: TView, creationMode: boolean): void { export function executeInitHooks(currentView: LView, tView: TView, creationMode: boolean): void {
if (currentView.lifecycleStage === LifecycleStage.INIT) { if (currentView.lifecycleStage === LifecycleStage.INIT) {
executeHooks(currentView.data, tView.initHooks, tView.checkHooks, creationMode); executeHooks(currentView.data, tView.initHooks, tView.checkHooks, creationMode);
currentView.lifecycleStage = LifecycleStage.CONTENT_INIT; currentView.lifecycleStage = LifecycleStage.AFTER_INIT;
}
}
/**
* Calls all afterContentInit and afterContentChecked hooks for the view, then splices
* out afterContentInit hooks to prep for the next run in update mode.
*
* @param currentView The current view
*/
export function executeContentHooks(currentView: LView, tView: TView, creationMode: boolean): void {
if (currentView.lifecycleStage < LifecycleStage.VIEW_INIT) {
executeHooks(currentView.data, tView.contentHooks, tView.contentCheckHooks, creationMode);
currentView.lifecycleStage = LifecycleStage.VIEW_INIT;
} }
} }

View File

@ -40,8 +40,6 @@ export {
interpolation8 as i8, interpolation8 as i8,
interpolationV as iV, interpolationV as iV,
directiveRefresh as r,
container as C, container as C,
containerRefreshStart as cR, containerRefreshStart as cR,
containerRefreshEnd as cr, containerRefreshEnd as cr,

View File

@ -22,7 +22,7 @@ import {matchingSelectorIndex} from './node_selector_matcher';
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType} from './interfaces/definition'; import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType} from './interfaces/definition';
import {RElement, RText, Renderer3, RendererFactory3, ProceduralRenderer3, ObjectOrientedRenderer3, RendererStyleFlags3, isProceduralRenderer} from './interfaces/renderer'; import {RElement, RText, Renderer3, RendererFactory3, ProceduralRenderer3, ObjectOrientedRenderer3, RendererStyleFlags3, isProceduralRenderer} from './interfaces/renderer';
import {isDifferent, stringify} from './util'; import {isDifferent, stringify} from './util';
import {executeHooks, executeContentHooks, queueLifecycleHooks, queueInitHooks, executeInitHooks} from './hooks'; import {executeHooks, queueLifecycleHooks, queueInitHooks, executeInitHooks} from './hooks';
import {ViewRef} from './view_ref'; import {ViewRef} from './view_ref';
/** /**
@ -209,10 +209,31 @@ export function leaveView(newView: LView): void {
// Views should be clean and in update mode after being checked, so these bits are cleared // Views should be clean and in update mode after being checked, so these bits are cleared
currentView.flags &= ~(LViewFlags.CreationMode | LViewFlags.Dirty); currentView.flags &= ~(LViewFlags.CreationMode | LViewFlags.Dirty);
currentView.lifecycleStage = LifecycleStage.INIT; currentView.lifecycleStage = LifecycleStage.INIT;
currentView.tView.firstTemplatePass = false;
enterView(newView, null); enterView(newView, null);
} }
/** Refreshes the views of child components, triggering any init/content hooks existing. */
function refreshChildComponents() {
executeInitAndContentHooks();
// This needs to be set before children are processed to support recursive components
currentView.tView.firstTemplatePass = false;
const components = currentView.tView.components;
if (components != null) {
for (let i = 0; i < components.length; i++) {
componentRefresh(components[i] + 1, components[i]);
}
}
}
function executeInitAndContentHooks(): void {
if (!checkNoChangesMode) {
const tView = currentView.tView;
executeInitHooks(currentView, tView, creationMode);
executeHooks(currentView.data, tView.contentHooks, tView.contentCheckHooks, creationMode);
}
}
export function createLView( export function createLView(
viewId: number, renderer: Renderer3, tView: TView, template: ComponentTemplate<any>| null, viewId: number, renderer: Renderer3, tView: TView, template: ComponentTemplate<any>| null,
context: any | null, flags: LViewFlags): LView { context: any | null, flags: LViewFlags): LView {
@ -376,8 +397,9 @@ export function renderEmbeddedTemplate<T>(
enterView(viewNode.data, viewNode); enterView(viewNode.data, viewNode);
template(context, cm); template(context, cm);
} finally {
refreshDynamicChildren(); refreshDynamicChildren();
refreshChildComponents();
} finally {
leaveView(currentView !.parent !); leaveView(currentView !.parent !);
isParent = _isParent; isParent = _isParent;
previousOrParentNode = _previousOrParentNode; previousOrParentNode = _previousOrParentNode;
@ -394,10 +416,12 @@ export function renderComponentOrTemplate<T>(
} }
if (template) { if (template) {
template(componentOrContext !, creationMode); template(componentOrContext !, creationMode);
refreshChildComponents();
} else { } else {
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) // so to refresh the component, refresh() needs to be called with (1, 0)
directiveRefresh(1, 0); componentRefresh(1, 0);
} }
} finally { } finally {
if (rendererFactory.end) { if (rendererFactory.end) {
@ -482,6 +506,7 @@ export function elementStart(
// 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.n();
storeComponentIndex(index);
directiveCreate(++index, instance, hostComponentDef, queryName); directiveCreate(++index, instance, hostComponentDef, queryName);
initChangeDetectorIfExisting(node.nodeInjector, instance); initChangeDetectorIfExisting(node.nodeInjector, instance);
} }
@ -491,6 +516,13 @@ export function elementStart(
return native; return native;
} }
/** Stores index of component so it will be queued for refresh during change detection. */
function storeComponentIndex(index: number): void {
if (currentView.tView.firstTemplatePass) {
(currentView.tView.components || (currentView.tView.components = [])).push(index);
}
}
/** Sets the context for a ChangeDetectorRef to the given instance. */ /** Sets the context for a ChangeDetectorRef to the given instance. */
export function initChangeDetectorIfExisting(injector: LInjector | null, instance: any): void { export function initChangeDetectorIfExisting(injector: LInjector | null, instance: any): void {
if (injector && injector.changeDetectorRef != null) { if (injector && injector.changeDetectorRef != null) {
@ -565,7 +597,8 @@ export function createTView(): TView {
contentCheckHooks: null, contentCheckHooks: null,
viewHooks: null, viewHooks: null,
viewCheckHooks: null, viewCheckHooks: null,
destroyHooks: null destroyHooks: null,
components: null
}; };
} }
@ -1250,6 +1283,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();
isParent = false; isParent = false;
const viewNode = previousOrParentNode = currentView.node as LViewNode; const viewNode = previousOrParentNode = currentView.node as LViewNode;
const container = previousOrParentNode.parent as LContainerNode; const container = previousOrParentNode.parent as LContainerNode;
@ -1274,7 +1308,7 @@ export function embeddedViewEnd(): void {
///////////// /////////////
/** /**
* Refreshes the directive, triggering init and content hooks. * Refreshes the directive.
* *
* When it is a component, it also enters the component's view and processes it to update bindings, * When it is a component, it also enters the component's view and processes it to update bindings,
* queries, etc. * queries, etc.
@ -1282,11 +1316,7 @@ export function embeddedViewEnd(): void {
* @param directiveIndex * @param directiveIndex
* @param elementIndex * @param elementIndex
*/ */
export function directiveRefresh<T>(directiveIndex: number, elementIndex: number): void { export function componentRefresh<T>(directiveIndex: number, elementIndex: number): void {
if (!checkNoChangesMode) {
executeInitHooks(currentView, currentView.tView, creationMode);
executeContentHooks(currentView, currentView.tView, creationMode);
}
const template = (tData[directiveIndex] as ComponentDef<T>).template; const template = (tData[directiveIndex] as ComponentDef<T>).template;
if (template != null) { if (template != null) {
ngDevMode && assertDataInRange(elementIndex); ngDevMode && assertDataInRange(elementIndex);
@ -1649,8 +1679,9 @@ function detectChangesInternal<T>(hostView: LView, hostNode: LElementNode, compo
if (template != null) { if (template != null) {
try { try {
template(component, creationMode); template(component, creationMode);
} finally {
refreshDynamicChildren(); refreshDynamicChildren();
refreshChildComponents();
} finally {
leaveView(oldView); leaveView(oldView);
} }
} }

View File

@ -276,6 +276,12 @@ export interface TView {
* Odd indices: Hook function * Odd indices: Hook function
*/ */
destroyHooks: HookData|null; destroyHooks: HookData|null;
/**
* A list of element indices for child components that will need to be refreshed when the
* current view has finished its check.
*/
components: number[]|null;
} }
/** /**
@ -312,15 +318,14 @@ export interface RootContext {
export type HookData = (number | (() => void))[]; export type HookData = (number | (() => void))[];
/** Possible values of LView.lifecycleStage, used to determine which hooks to run. */ /** Possible values of LView.lifecycleStage, used to determine which hooks to run. */
// TODO: Remove this enum when containerRefresh instructions are removed
export const enum LifecycleStage { export const enum LifecycleStage {
/* Init hooks need to be run, if any. */ /* Init hooks need to be run, if any. */
INIT = 1, INIT = 1,
/* Content hooks need to be run, if any. Init hooks have already run. */ /* Content hooks need to be run, if any. Init hooks have already run. */
CONTENT_INIT = 2, AFTER_INIT = 2,
/* View hooks need to be run, if any. Any init hooks/content hooks have ran. */
VIEW_INIT = 3
} }
/** /**

View File

@ -56,6 +56,9 @@
{ {
"name": "checkNoChangesMode" "name": "checkNoChangesMode"
}, },
{
"name": "componentRefresh"
},
{ {
"name": "createLNode" "name": "createLNode"
}, },
@ -77,9 +80,6 @@
{ {
"name": "directiveCreate" "name": "directiveCreate"
}, },
{
"name": "directiveRefresh"
},
{ {
"name": "domRendererFactory3" "name": "domRendererFactory3"
}, },
@ -87,10 +87,10 @@
"name": "enterView" "name": "enterView"
}, },
{ {
"name": "executeContentHooks" "name": "executeHooks"
}, },
{ {
"name": "executeHooks" "name": "executeInitAndContentHooks"
}, },
{ {
"name": "executeInitHooks" "name": "executeInitHooks"
@ -158,6 +158,9 @@
{ {
"name": "queueInitHooks" "name": "queueInitHooks"
}, },
{
"name": "refreshChildComponents"
},
{ {
"name": "refreshDynamicChildren" "name": "refreshDynamicChildren"
}, },

View File

@ -8,12 +8,12 @@
import {withBody} from '@angular/core/testing'; import {withBody} from '@angular/core/testing';
import {ChangeDetectionStrategy, ChangeDetectorRef, DoCheck, EmbeddedViewRef, TemplateRef, ViewContainerRef} from '../../src/core'; import {ChangeDetectionStrategy, ChangeDetectorRef, DoCheck} from '../../src/core';
import {getRenderedText, whenRendered} from '../../src/render3/component'; import {getRenderedText, whenRendered} from '../../src/render3/component';
import {NgOnChangesFeature, PublicFeature, defineComponent, defineDirective, injectChangeDetectorRef, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index'; import {defineComponent, defineDirective, injectChangeDetectorRef} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, detectChanges, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, listener, markDirty, text, textBinding, tick} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, detectChanges, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, listener, markDirty, text, textBinding, tick} from '../../src/render3/instructions';
import {containerEl, renderComponent, requestAnimationFrame, toHtml} from './render_util'; import {containerEl, renderComponent, requestAnimationFrame} from './render_util';
describe('change detection', () => { describe('change detection', () => {
@ -133,7 +133,6 @@ describe('change detection', () => {
} }
elementProperty(0, 'name', bind(ctx.name)); elementProperty(0, 'name', bind(ctx.name));
MyComponent.ngComponentDef.h(1, 0); MyComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -214,7 +213,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
MyComponent.ngComponentDef.h(1, 0); MyComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -247,7 +245,6 @@ describe('change detection', () => {
} }
textBinding(0, interpolation1('', ctx.doCheckCount, ' - ')); textBinding(0, interpolation1('', ctx.doCheckCount, ' - '));
MyComponent.ngComponentDef.h(2, 1); MyComponent.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
}, },
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}); });
@ -265,7 +262,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
ButtonParent.ngComponentDef.h(1, 0); ButtonParent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -342,7 +338,6 @@ describe('change detection', () => {
} }
textBinding(0, interpolation1('', ctx.doCheckCount, ' - ')); textBinding(0, interpolation1('', ctx.doCheckCount, ' - '));
MyComp.ngComponentDef.h(2, 1); MyComp.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
} }
@ -422,8 +417,6 @@ describe('change detection', () => {
} }
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
Dir.ngDirectiveDef.h(2, 0); Dir.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
}); });
} }
@ -456,7 +449,6 @@ describe('change detection', () => {
} }
textBinding(1, bind(ctx.name)); textBinding(1, bind(ctx.name));
Dir.ngDirectiveDef.h(2, 1); Dir.ngDirectiveDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
} }
@ -500,7 +492,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
Dir.ngDirectiveDef.h(1, 0); Dir.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
embeddedViewEnd(); embeddedViewEnd();
} }
@ -594,7 +585,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
DetachedComp.ngComponentDef.h(1, 0); DetachedComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -734,7 +724,6 @@ describe('change detection', () => {
} }
elementProperty(0, 'value', bind(ctx.value)); elementProperty(0, 'value', bind(ctx.value));
OnPushComp.ngComponentDef.h(1, 0); OnPushComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -802,7 +791,6 @@ describe('change detection', () => {
} }
textBinding(0, interpolation1('', ctx.value, ' - ')); textBinding(0, interpolation1('', ctx.value, ' - '));
OnPushComp.ngComponentDef.h(2, 1); OnPushComp.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
}, },
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}); });
@ -878,7 +866,6 @@ describe('change detection', () => {
elementEnd(); elementEnd();
} }
OnPushComp.ngComponentDef.h(1, 0); OnPushComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -962,7 +949,6 @@ describe('change detection', () => {
} }
textBinding(0, interpolation1('', ctx.value, ' - ')); textBinding(0, interpolation1('', ctx.value, ' - '));
NoChangesComp.ngComponentDef.h(2, 1); NoChangesComp.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
} }

View File

@ -9,7 +9,7 @@
import {NgForOfContext} from '@angular/common'; import {NgForOfContext} from '@angular/common';
import {defineComponent} from '../../src/render3/index'; import {defineComponent} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, text, textBinding} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, text, textBinding} from '../../src/render3/instructions';
import {NgForOf} from './common_with_def'; import {NgForOf} from './common_with_def';
import {renderComponent, toHtml} from './render_util'; import {renderComponent, toHtml} from './render_util';
@ -35,7 +35,6 @@ describe('@angular/common integration', () => {
} }
elementProperty(1, 'ngForOf', bind(myApp.items)); elementProperty(1, 'ngForOf', bind(myApp.items));
containerRefreshStart(1); containerRefreshStart(1);
directiveRefresh(2, 0);
containerRefreshEnd(); containerRefreshEnd();
function liTemplate(row: NgForOfContext<string>, cm: boolean) { function liTemplate(row: NgForOfContext<string>, cm: boolean) {

View File

@ -73,8 +73,6 @@ describe('components & directives', () => {
} }
ChildComponent.ngComponentDef.h(1, 0); ChildComponent.ngComponentDef.h(1, 0);
SomeDirective.ngDirectiveDef.h(2, 0); SomeDirective.ngDirectiveDef.h(2, 0);
$r3$.ɵr(1, 0);
$r3$.ɵr(2, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -122,7 +120,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
HostBindingDir.ngDirectiveDef.h(1, 0); HostBindingDir.ngDirectiveDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -171,7 +168,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
HostListenerDir.ngDirectiveDef.h(1, 0); HostListenerDir.ngDirectiveDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -214,7 +210,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
HostAttributeDir.ngDirectiveDef.h(1, 0); HostAttributeDir.ngDirectiveDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -260,7 +255,6 @@ describe('components & directives', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
HostBindingDir.ngDirectiveDef.h(1, 0); HostBindingDir.ngDirectiveDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -319,7 +313,6 @@ describe('components & directives', () => {
} }
$r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name)); $r3$.ɵp(0, 'name', $r3$.ɵb(ctx.name));
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -367,7 +360,6 @@ describe('components & directives', () => {
} }
let $foo$ = $r3$.ɵld<any>(1); let $foo$ = $r3$.ɵld<any>(1);
$r3$.ɵcR(2); $r3$.ɵcR(2);
$r3$.ɵr(3, 2);
$r3$.ɵcr(); $r3$.ɵcr();
function C1(ctx1: $any$, cm: $boolean$) { function C1(ctx1: $any$, cm: $boolean$) {
@ -439,7 +431,6 @@ describe('components & directives', () => {
} }
$r3$.ɵp(0, 'names', cm ? $e0_arr$ : $r3$.ɵNC); $r3$.ɵp(0, 'names', cm ? $e0_arr$ : $r3$.ɵNC);
MyArrayComp.ngComponentDef.h(1, 0); MyArrayComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -479,7 +470,6 @@ describe('components & directives', () => {
} }
$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); MyArrayComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -533,7 +523,6 @@ describe('components & directives', () => {
} }
$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); MyComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -571,7 +560,6 @@ describe('components & directives', () => {
} }
$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); MyArrayComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -676,7 +664,6 @@ describe('components & directives', () => {
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); MyComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -744,7 +731,6 @@ describe('components & directives', () => {
} }
$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); ObjectComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -825,7 +811,6 @@ describe('components & directives', () => {
$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); NestedComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
// /NORMATIVE // /NORMATIVE

View File

@ -58,7 +58,6 @@ describe('injection', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }
@ -103,7 +102,6 @@ describe('injection', () => {
$r3$.ɵe(); $r3$.ɵe();
} }
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
$r3$.ɵr(1, 0);
} }
}); });
} }

View File

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

View File

@ -171,7 +171,6 @@ describe('pipes', () => {
$r3$.ɵt(2, $r3$.ɵi1('', $r3$.ɵpb2(3, ctx.name, ctx.size), '')); $r3$.ɵt(2, $r3$.ɵi1('', $r3$.ɵpb2(3, ctx.name, ctx.size), ''));
$r3$.ɵp(4, 'oneTimeIf', $r3$.ɵb(ctx.more)); $r3$.ɵp(4, 'oneTimeIf', $r3$.ɵb(ctx.more));
$r3$.ɵcR(4); $r3$.ɵcR(4);
$r3$.ɵr(5, 4);
$r3$.ɵcr(); $r3$.ɵcr();
function C4(ctx1: $any$, cm: $boolean$) { function C4(ctx1: $any$, cm: $boolean$) {

View File

@ -63,7 +63,6 @@ describe('queries', () => {
$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); SomeDirective.ngDirectiveDef.h(3, 2);
$r3$.ɵr(3, 2);
} }
}); });
// /NORMATIVE // /NORMATIVE
@ -148,8 +147,6 @@ describe('queries', () => {
} }
ContentQueryComponent.ngComponentDef.h(1, 0); ContentQueryComponent.ngComponentDef.h(1, 0);
SomeDirective.ngDirectiveDef.h(3, 2); SomeDirective.ngDirectiveDef.h(3, 2);
$r3$.ɵr(1, 0);
$r3$.ɵr(3, 2);
} }
}); });
// /NON-NORMATIVE // /NON-NORMATIVE

View File

@ -104,7 +104,6 @@ describe('template variables', () => {
} }
$r3$.ɵp(1, 'forOf', $r3$.ɵb(ctx.items)); $r3$.ɵp(1, 'forOf', $r3$.ɵb(ctx.items));
$r3$.ɵcR(1); $r3$.ɵcR(1);
$r3$.ɵr(2, 1);
$r3$.ɵcr(); $r3$.ɵcr();
function MyComponent_ForOfDirective_Template_1(ctx1: $any$, cm: $boolean$) { function MyComponent_ForOfDirective_Template_1(ctx1: $any$, cm: $boolean$) {
@ -173,7 +172,6 @@ describe('template variables', () => {
} }
$r3$.ɵp(1, 'forOf', $r3$.ɵb(ctx.items)); $r3$.ɵp(1, 'forOf', $r3$.ɵb(ctx.items));
$r3$.ɵcR(1); $r3$.ɵcR(1);
$r3$.ɵr(2, 1);
$r3$.ɵcr(); $r3$.ɵcr();
function MyComponent_ForOfDirective_Template_1(ctx1: $any$, cm: $boolean$) { function MyComponent_ForOfDirective_Template_1(ctx1: $any$, cm: $boolean$) {
@ -191,7 +189,6 @@ describe('template variables', () => {
$r3$.ɵp(4, 'forOf', $r3$.ɵb($l0_item$.infos)); $r3$.ɵp(4, 'forOf', $r3$.ɵb($l0_item$.infos));
$r3$.ɵt(2, $r3$.ɵi1('', $l0_item$.name, '')); $r3$.ɵt(2, $r3$.ɵi1('', $l0_item$.name, ''));
$r3$.ɵcR(4); $r3$.ɵcR(4);
$r3$.ɵr(5, 4);
$r3$.ɵcr(); $r3$.ɵcr();
function MyComponent_ForOfDirective_ForOfDirective_Template_3( function MyComponent_ForOfDirective_ForOfDirective_Template_3(

View File

@ -8,8 +8,9 @@
import {DoCheck, ViewEncapsulation} from '../../src/core'; import {DoCheck, ViewEncapsulation} from '../../src/core';
import {defineComponent, markDirty} from '../../src/render3/index'; import {getRenderedText} from '../../src/render3/component';
import {bind, container, containerRefreshEnd, containerRefreshStart, detectChanges, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, text, textBinding} from '../../src/render3/instructions'; import {LifecycleHooksFeature, defineComponent, markDirty} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, text, textBinding, tick} from '../../src/render3/instructions';
import {createRendererType2} from '../../src/view/index'; import {createRendererType2} from '../../src/view/index';
import {getRendererFactory2} from './imported_renderer2'; import {getRendererFactory2} from './imported_renderer2';
@ -111,7 +112,6 @@ describe('component with a container', () => {
} }
elementProperty(0, 'items', bind(ctx.items)); elementProperty(0, 'items', bind(ctx.items));
WrapperComponent.ngComponentDef.h(1, 0); WrapperComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
it('should re-render on input change', () => { it('should re-render on input change', () => {
@ -137,7 +137,6 @@ describe('encapsulation', () => {
elementEnd(); elementEnd();
} }
EncapsulatedComponent.ngComponentDef.h(1, 0); EncapsulatedComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}, },
factory: () => new WrapperComponent, factory: () => new WrapperComponent,
}); });
@ -154,7 +153,6 @@ describe('encapsulation', () => {
elementEnd(); elementEnd();
} }
LeafComponent.ngComponentDef.h(2, 1); LeafComponent.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
}, },
factory: () => new EncapsulatedComponent, factory: () => new EncapsulatedComponent,
rendererType: rendererType:
@ -202,7 +200,6 @@ describe('encapsulation', () => {
elementEnd(); elementEnd();
} }
LeafComponentwith.ngComponentDef.h(1, 0); LeafComponentwith.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}, },
factory: () => new WrapperComponentWith, factory: () => new WrapperComponentWith,
rendererType: rendererType:
@ -234,3 +231,78 @@ describe('encapsulation', () => {
}); });
}); });
describe('recursive components', () => {
let events: string[] = [];
let count = 0;
class TreeNode {
constructor(
public value: number, public depth: number, public left: TreeNode|null,
public right: TreeNode|null) {}
}
class TreeComponent {
data: TreeNode = _buildTree(0);
ngDoCheck() { events.push('check' + this.data.value); }
static ngComponentDef = defineComponent({
type: TreeComponent,
tag: 'tree-comp',
factory: () => new TreeComponent(),
template: (ctx: TreeComponent, cm: boolean) => {
if (cm) {
text(0);
container(1);
container(2);
}
textBinding(0, bind(ctx.data.value));
containerRefreshStart(1);
{
if (ctx.data.left != null) {
if (embeddedViewStart(0)) {
elementStart(0, TreeComponent);
elementEnd();
}
elementProperty(0, 'data', bind(ctx.data.left));
TreeComponent.ngComponentDef.h(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
containerRefreshStart(2);
{
if (ctx.data.right != null) {
if (embeddedViewStart(0)) {
elementStart(0, TreeComponent);
elementEnd();
}
elementProperty(0, 'data', bind(ctx.data.right));
TreeComponent.ngComponentDef.h(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
},
inputs: {data: 'data'}
});
}
function _buildTree(currDepth: number): TreeNode {
const children = currDepth < 2 ? _buildTree(currDepth + 1) : null;
const children2 = currDepth < 2 ? _buildTree(currDepth + 1) : null;
return new TreeNode(count++, currDepth, children, children2);
}
it('should check each component just once', () => {
const comp = renderComponent(TreeComponent, {hostFeatures: [LifecycleHooksFeature]});
expect(getRenderedText(comp)).toEqual('6201534');
expect(events).toEqual(['check6', 'check2', 'check0', 'check1', 'check5', 'check3', 'check4']);
events = [];
tick(comp);
expect(events).toEqual(['check6', 'check2', 'check0', 'check1', 'check5', 'check3', 'check4']);
});
});

View File

@ -7,7 +7,7 @@
*/ */
import {detectChanges} from '../../src/render3/index'; import {detectChanges} from '../../src/render3/index';
import {container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, load, projection, projectionDef, text} from '../../src/render3/instructions'; import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, load, projection, projectionDef, text} from '../../src/render3/instructions';
import {createComponent, renderComponent, toHtml} from './render_util'; import {createComponent, renderComponent, toHtml} from './render_util';
@ -36,7 +36,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -56,7 +55,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child>content</child>'); expect(toHtml(parent)).toEqual('<child>content</child>');
@ -78,7 +76,6 @@ describe('content projection', () => {
{ projection(3, 0); } { projection(3, 0); }
elementEnd(); elementEnd();
GrandChild.ngComponentDef.h(2, 1); GrandChild.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
const Parent = createComponent('parent', function(ctx: any, cm: boolean) { const Parent = createComponent('parent', function(ctx: any, cm: boolean) {
@ -93,7 +90,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)) expect(toHtml(parent))
@ -134,8 +130,6 @@ describe('content projection', () => {
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(3, 2);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)) expect(toHtml(parent))
@ -172,7 +166,6 @@ describe('content projection', () => {
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -208,7 +201,6 @@ describe('content projection', () => {
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
expect(toHtml(parent)).toEqual('<child></child>'); expect(toHtml(parent)).toEqual('<child></child>');
@ -257,7 +249,6 @@ describe('content projection', () => {
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -315,7 +306,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -368,7 +358,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -423,7 +412,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -460,7 +448,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -518,7 +505,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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>');
@ -569,7 +555,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -617,7 +602,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -665,7 +649,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -713,7 +696,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -760,7 +742,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -808,7 +789,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -856,7 +836,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
GrandChild.ngComponentDef.h(2, 1); GrandChild.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
@ -878,7 +857,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -924,7 +902,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
Card.ngComponentDef.h(2, 1); Card.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
@ -940,7 +917,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
CardWithTitle.ngComponentDef.h(1, 0); CardWithTitle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const app = renderComponent(App); const app = renderComponent(App);
@ -987,7 +963,6 @@ describe('content projection', () => {
} }
elementEnd(); elementEnd();
Card.ngComponentDef.h(2, 1); Card.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
}); });
@ -1003,7 +978,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
CardWithTitle.ngComponentDef.h(1, 0); CardWithTitle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const app = renderComponent(App); const app = renderComponent(App);
@ -1044,7 +1018,6 @@ describe('content projection', () => {
elementEnd(); elementEnd();
} }
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const parent = renderComponent(Parent); const parent = renderComponent(Parent);
@ -1091,7 +1064,6 @@ describe('content projection', () => {
} }
containerRefreshEnd(); containerRefreshEnd();
Child.ngComponentDef.h(1, 0); Child.ngComponentDef.h(1, 0);
directiveRefresh(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

@ -11,7 +11,7 @@ import {ChangeDetectorRef, ElementRef, TemplateRef, ViewContainerRef} from '@ang
import {defineComponent} from '../../src/render3/definition'; import {defineComponent} from '../../src/render3/definition';
import {InjectFlags, bloomAdd, bloomFindPossibleInjector, getOrCreateNodeInjector, injectAttribute} from '../../src/render3/di'; import {InjectFlags, bloomAdd, bloomFindPossibleInjector, getOrCreateNodeInjector, injectAttribute} from '../../src/render3/di';
import {NgOnChangesFeature, PublicFeature, defineDirective, directiveInject, injectChangeDetectorRef, injectElementRef, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index'; import {NgOnChangesFeature, PublicFeature, defineDirective, directiveInject, injectChangeDetectorRef, injectElementRef, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, createLNode, createLView, createTView, directiveRefresh, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, enterView, interpolation2, leaveView, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, createLNode, createLView, createTView, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, enterView, interpolation2, leaveView, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions';
import {LInjector} from '../../src/render3/interfaces/injector'; import {LInjector} from '../../src/render3/interfaces/injector';
import {LNodeFlags} from '../../src/render3/interfaces/node'; import {LNodeFlags} from '../../src/render3/interfaces/node';
import {LViewFlags} from '../../src/render3/interfaces/view'; import {LViewFlags} from '../../src/render3/interfaces/view';
@ -261,9 +261,6 @@ describe('di', () => {
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
DirectiveSameInstance.ngDirectiveDef.h(3, 0); DirectiveSameInstance.ngDirectiveDef.h(3, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
directiveRefresh(3, 0);
} }
}); });
} }
@ -296,8 +293,6 @@ describe('di', () => {
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0); DirectiveSameInstance.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
}); });
} }
@ -338,9 +333,6 @@ describe('di', () => {
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(3, 2); Directive.ngDirectiveDef.h(3, 2);
DirectiveSameInstance.ngDirectiveDef.h(4, 2); DirectiveSameInstance.ngDirectiveDef.h(4, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(4, 2);
} }
}); });
} }
@ -385,8 +377,6 @@ describe('di', () => {
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0); DirectiveSameInstance.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
embeddedViewEnd(); embeddedViewEnd();
} }
@ -439,7 +429,6 @@ describe('di', () => {
container(0, [IfDirective], C1); container(0, [IfDirective], C1);
} }
containerRefreshStart(0); containerRefreshStart(0);
{ directiveRefresh(1, 0); }
containerRefreshEnd(); containerRefreshEnd();
function C1(ctx1: any, cm1: boolean) { function C1(ctx1: any, cm1: boolean) {
@ -451,8 +440,6 @@ describe('di', () => {
textBinding(3, bind(load<Directive>(1).value)); textBinding(3, bind(load<Directive>(1).value));
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
DirectiveSameInstance.ngDirectiveDef.h(2, 0); DirectiveSameInstance.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
} }
}); });

View File

@ -7,7 +7,7 @@
*/ */
import {defineDirective} from '../../src/render3/index'; import {defineDirective} from '../../src/render3/index';
import {bind, directiveRefresh, elementEnd, elementProperty, elementStart, load} from '../../src/render3/instructions'; import {bind, elementEnd, elementProperty, elementStart, load} from '../../src/render3/instructions';
import {renderToHtml} from './render_util'; import {renderToHtml} from './render_util';
@ -35,7 +35,6 @@ describe('directive', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, {})).toEqual('<span class="foo"></span>'); expect(renderToHtml(Template, {})).toEqual('<span class="foo"></span>');

View File

@ -7,7 +7,7 @@
*/ */
import {defineComponent, defineDirective} from '../../src/render3/index'; import {defineComponent, defineDirective} from '../../src/render3/index';
import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions'; import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util'; import {containerEl, renderToHtml} from './render_util';
@ -201,7 +201,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
} }
TodoComponent.ngComponentDef.h(1, 0); TodoComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>'); expect(renderToHtml(Template, null)).toEqual('<todo><p>Todo one</p></todo>');
@ -215,7 +214,6 @@ describe('render3 integration test', () => {
text(2, 'two'); text(2, 'two');
} }
TodoComponent.ngComponentDef.h(1, 0); TodoComponent.ngComponentDef.h(1, 0);
directiveRefresh(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');
}); });
@ -234,8 +232,6 @@ describe('render3 integration test', () => {
} }
TodoComponent.ngComponentDef.h(1, 0); TodoComponent.ngComponentDef.h(1, 0);
TodoComponent.ngComponentDef.h(3, 2); TodoComponent.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(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>');
@ -271,7 +267,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
} }
TodoComponentHostBinding.ngComponentDef.h(1, 0); TodoComponentHostBinding.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, {})).toEqual('<todo title="one">one</todo>'); expect(renderToHtml(Template, {})).toEqual('<todo title="one">one</todo>');
@ -304,7 +299,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
} }
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, null)).toEqual('<comp><p>Bess</p></comp>'); expect(renderToHtml(Template, null)).toEqual('<comp><p>Bess</p></comp>');
@ -351,7 +345,6 @@ describe('render3 integration test', () => {
} }
elementProperty(0, 'condition', bind(ctx.condition)); elementProperty(0, 'condition', bind(ctx.condition));
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, {condition: true})).toEqual('<comp><div>text</div></comp>'); expect(renderToHtml(Template, {condition: true})).toEqual('<comp><div>text</div></comp>');
@ -472,7 +465,6 @@ describe('render3 integration test', () => {
} }
containerRefreshEnd(); containerRefreshEnd();
ChildComponent.ngComponentDef.h(1, 0); ChildComponent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
it('should work with a tree', () => { it('should work with a tree', () => {
@ -648,7 +640,6 @@ describe('render3 integration test', () => {
elementEnd(); elementEnd();
} }
HostBindingDir.ngDirectiveDef.h(1, 0); HostBindingDir.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, {})) expect(renderToHtml(Template, {}))

View File

@ -8,7 +8,7 @@
import {SimpleChanges} from '../../src/core'; import {SimpleChanges} from '../../src/core';
import {ComponentTemplate, LifecycleHooksFeature, NgOnChangesFeature, defineComponent, defineDirective} from '../../src/render3/index'; import {ComponentTemplate, LifecycleHooksFeature, NgOnChangesFeature, defineComponent, defineDirective} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, markDirty, projection, projectionDef, store, text} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, markDirty, projection, projectionDef, store, text} from '../../src/render3/instructions';
import {containerEl, renderComponent, renderToHtml, requestAnimationFrame} from './render_util'; import {containerEl, renderComponent, renderToHtml, requestAnimationFrame} from './render_util';
@ -22,7 +22,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
type.ngComponentDef.h(1, 0); type.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}; };
} }
@ -76,7 +75,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {val: '1'}); renderToHtml(Template, {val: '1'});
@ -107,7 +105,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -133,8 +130,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2); Parent.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -161,7 +156,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -192,8 +186,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -226,10 +218,6 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4); Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6); ProjectedComp.ngComponentDef.h(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -245,8 +233,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -265,7 +251,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -305,13 +290,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', j); elementProperty(0, 'val', j);
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -351,13 +333,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', j); elementProperty(0, 'val', j);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -412,7 +391,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -443,7 +421,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -458,7 +435,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -477,8 +453,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -497,7 +471,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -534,7 +507,6 @@ describe('lifecycles', () => {
} }
elementProperty(1, 'val', bind(ctx.val)); elementProperty(1, 'val', bind(ctx.val));
Comp.ngComponentDef.h(2, 1); Comp.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
}); });
let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => { let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => {
@ -572,7 +544,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -610,7 +581,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -640,7 +610,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -667,8 +636,6 @@ describe('lifecycles', () => {
elementProperty(3, 'val', 2); elementProperty(3, 'val', 2);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3); Parent.ngComponentDef.h(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -698,8 +665,6 @@ describe('lifecycles', () => {
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -745,10 +710,6 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
Parent.ngComponentDef.h(6, 5); Parent.ngComponentDef.h(6, 5);
ProjectedComp.ngComponentDef.h(8, 7); ProjectedComp.ngComponentDef.h(8, 7);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(6, 5);
directiveRefresh(8, 7);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -787,13 +748,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(5, 4);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -824,13 +782,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(5, 4);
} }
it('should be called in correct order in a for loop with children', () => { it('should be called in correct order in a for loop with children', () => {
@ -858,7 +813,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -897,8 +851,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -913,7 +865,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -974,7 +925,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1011,7 +961,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1041,7 +990,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1067,8 +1015,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2); Parent.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']); expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']);
@ -1092,8 +1038,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1132,10 +1076,6 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4); Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6); ProjectedComp.ngComponentDef.h(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1161,8 +1101,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', bind(ctx.val)); elementProperty(2, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}); });
/** /**
@ -1180,8 +1118,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
ParentComp.ngComponentDef.h(1, 0); ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2); ParentComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1217,13 +1153,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1260,13 +1193,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1285,7 +1215,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1313,7 +1242,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(ctx.myVal)); elementProperty(0, 'val', bind(ctx.myVal));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {myVal: 5}); renderToHtml(Template, {myVal: 5});
@ -1352,13 +1280,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', i); elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1389,8 +1314,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1405,7 +1328,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -1467,7 +1389,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1504,8 +1425,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', bind('2')); elementProperty(2, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2); Comp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1538,7 +1457,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1566,7 +1484,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
function Template(ctx: any, cm: boolean) { function Template(ctx: any, cm: boolean) {
@ -1581,7 +1498,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Grandparent.ngComponentDef.h(1, 0); Grandparent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1635,10 +1551,6 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4); Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6); ProjectedComp.ngComponentDef.h(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1690,13 +1602,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind('2')); elementProperty(0, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1766,13 +1675,10 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(j)); elementProperty(0, 'val', bind(j));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1841,7 +1747,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(3, 2); Comp.ngComponentDef.h(3, 2);
directiveRefresh(3, 2);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1891,8 +1796,6 @@ describe('lifecycles', () => {
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0); Directive.ngDirectiveDef.h(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1926,7 +1829,6 @@ describe('lifecycles', () => {
elementEnd(); elementEnd();
} }
Directive.ngDirectiveDef.h(1, 0); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -1963,7 +1865,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); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
const ProjectedComp = createOnChangesComponent('projected', (ctx: any, cm: boolean) => { const ProjectedComp = createOnChangesComponent('projected', (ctx: any, cm: boolean) => {
if (cm) { if (cm) {
@ -2021,7 +1922,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); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {val1: '1', val2: 'a'}); renderToHtml(Template, {val1: '1', val2: 'a'});
@ -2048,7 +1948,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); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {val1: '1', val2: 'a'}); renderToHtml(Template, {val1: '1', val2: 'a'});
@ -2079,8 +1978,6 @@ describe('lifecycles', () => {
elementProperty(2, 'publicName', bind(2)); elementProperty(2, 'publicName', bind(2));
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2); Parent.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2114,7 +2011,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); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -2152,8 +2048,6 @@ describe('lifecycles', () => {
elementProperty(2, 'publicName', bind(2)); elementProperty(2, 'publicName', bind(2));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2193,10 +2087,6 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2); ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4); Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6); ProjectedComp.ngComponentDef.h(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2218,7 +2108,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); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2243,7 +2132,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); Directive.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2286,13 +2174,10 @@ 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); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2341,13 +2226,10 @@ 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); Parent.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
containerRefreshEnd(); containerRefreshEnd();
directiveRefresh(1, 0);
directiveRefresh(4, 3);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2419,8 +2301,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2); Comp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -2449,7 +2329,6 @@ describe('lifecycles', () => {
} }
elementProperty(0, 'val', bind(ctx.val)); elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
}); });
/** /**
@ -2467,8 +2346,6 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2); elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0); Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2); Parent.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});

View File

@ -7,7 +7,7 @@
*/ */
import {defineComponent, defineDirective} from '../../src/render3/index'; import {defineComponent, defineDirective} from '../../src/render3/index';
import {container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions'; import {container, containerRefreshEnd, containerRefreshStart, elementEnd, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions';
import {getRendererFactory2} from './imported_renderer2'; import {getRendererFactory2} from './imported_renderer2';
import {containerEl, renderComponent, renderToHtml} from './render_util'; import {containerEl, renderComponent, renderToHtml} from './render_util';
@ -250,7 +250,6 @@ describe('event listeners', () => {
elementEnd(); elementEnd();
} }
HostListenerDir.ngDirectiveDef.h(1, 0); HostListenerDir.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -346,8 +345,6 @@ describe('event listeners', () => {
} }
MyComp.ngComponentDef.h(2, 1); MyComp.ngComponentDef.h(2, 1);
MyComp.ngComponentDef.h(4, 3); MyComp.ngComponentDef.h(4, 3);
directiveRefresh(2, 1);
directiveRefresh(4, 3);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -9,7 +9,7 @@
import {EventEmitter} from '@angular/core'; import {EventEmitter} from '@angular/core';
import {defineComponent, defineDirective} from '../../src/render3/index'; import {defineComponent, defineDirective} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, text} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util'; import {containerEl, renderToHtml} from './render_util';
@ -52,7 +52,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
let counter = 0; let counter = 0;
@ -78,7 +77,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
let counter = 0; let counter = 0;
@ -104,7 +102,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
const ctx = {counter: 0}; const ctx = {counter: 0};
@ -140,7 +137,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -192,7 +188,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -263,8 +258,6 @@ describe('outputs', () => {
} }
ButtonToggle.ngComponentDef.h(3, 2); ButtonToggle.ngComponentDef.h(3, 2);
DestroyComp.ngComponentDef.h(5, 4); DestroyComp.ngComponentDef.h(5, 4);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
embeddedViewEnd(); embeddedViewEnd();
} }
} }
@ -341,7 +334,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
let counter = 0; let counter = 0;
@ -375,7 +367,6 @@ describe('outputs', () => {
} }
elementProperty(0, 'change', bind(ctx.change)); elementProperty(0, 'change', bind(ctx.change));
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
let counter = 0; let counter = 0;
@ -420,7 +411,6 @@ describe('outputs', () => {
elementEnd(); elementEnd();
} }
ButtonToggle.ngComponentDef.h(1, 0); ButtonToggle.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} else { } else {
if (embeddedViewStart(1)) { if (embeddedViewStart(1)) {

View File

@ -10,7 +10,7 @@ import {Directive, OnChanges, OnDestroy, Pipe, PipeTransform, SimpleChange, Simp
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
import {NgOnChangesFeature, defineComponent, defineDirective, definePipe} from '../../src/render3/definition'; import {NgOnChangesFeature, defineComponent, defineDirective, definePipe} from '../../src/render3/definition';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, load, text, textBinding} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, interpolation1, load, text, textBinding} from '../../src/render3/instructions';
import {pipe, pipeBind1, pipeBind3, pipeBind4, pipeBindV} from '../../src/render3/pipe'; import {pipe, pipeBind1, pipeBind3, pipeBind4, pipeBindV} from '../../src/render3/pipe';
import {RenderLog, getRendererFactory2, patchLoggingRenderer2} from './imported_renderer2'; import {RenderLog, getRendererFactory2, patchLoggingRenderer2} from './imported_renderer2';
@ -73,7 +73,6 @@ describe('pipe', () => {
} }
MyDir.ngDirectiveDef.h(1, 0); MyDir.ngDirectiveDef.h(1, 0);
elementProperty(0, 'elprop', bind(pipeBind1(2, ctx))); elementProperty(0, 'elprop', bind(pipeBind1(2, ctx)));
directiveRefresh(1, 0);
directive = load(1); directive = load(1);
} }
renderToHtml(Template, 'a'); renderToHtml(Template, 'a');

View File

@ -9,7 +9,7 @@
import {EventEmitter} from '@angular/core'; import {EventEmitter} from '@angular/core';
import {defineComponent, defineDirective} from '../../src/render3/index'; import {defineComponent, defineDirective} from '../../src/render3/index';
import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, 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 {renderToHtml} from './render_util';
@ -157,7 +157,6 @@ describe('elementProperty', () => {
} }
elementProperty(0, 'id', bind(ctx.id)); elementProperty(0, 'id', bind(ctx.id));
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(renderToHtml(Template, {id: 1})).toEqual(`<comp></comp>`); expect(renderToHtml(Template, {id: 1})).toEqual(`<comp></comp>`);
@ -502,7 +501,6 @@ describe('elementProperty', () => {
elementEnd(); elementEnd();
} }
Comp.ngComponentDef.h(1, 0); Comp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {defineComponent} from '../../src/render3/index'; import {defineComponent} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, load} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, load} from '../../src/render3/instructions';
import {pureFunction1, pureFunction2, pureFunction3, pureFunction4, pureFunction5, pureFunction6, pureFunction7, pureFunction8, pureFunctionV} from '../../src/render3/pure_function'; import {pureFunction1, pureFunction2, pureFunction3, pureFunction4, pureFunction5, pureFunction6, pureFunction7, pureFunction8, pureFunctionV} from '../../src/render3/pure_function';
import {renderToHtml} from '../../test/render3/render_util'; import {renderToHtml} from '../../test/render3/render_util';
@ -36,7 +36,6 @@ describe('array literals', () => {
} }
elementProperty(0, 'names', bind(pureFunction1(e0_ff, ctx.customName))); elementProperty(0, 'names', bind(pureFunction1(e0_ff, ctx.customName)));
MyComp.ngComponentDef.h(1, 0); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {customName: 'Carson'}); renderToHtml(Template, {customName: 'Carson'});
@ -91,7 +90,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); ManyPropComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {customName: 'Carson', customName2: 'George'}); renderToHtml(Template, {customName: 'Carson', customName2: 'George'});
@ -129,7 +127,6 @@ describe('array literals', () => {
} }
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); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
}); });
} }
@ -143,8 +140,6 @@ describe('array literals', () => {
} }
ParentComp.ngComponentDef.h(1, 0); ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2); ParentComp.ngComponentDef.h(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
} }
renderToHtml(Template, {}); renderToHtml(Template, {});
@ -172,7 +167,6 @@ describe('array literals', () => {
} }
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); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {customName: 'Carson', customName2: 'Hannah'}); renderToHtml(Template, {customName: 'Carson', customName2: 'Hannah'});
@ -255,12 +249,6 @@ describe('array literals', () => {
MyComp.ngComponentDef.h(7, 6); MyComp.ngComponentDef.h(7, 6);
MyComp.ngComponentDef.h(9, 8); MyComp.ngComponentDef.h(9, 8);
MyComp.ngComponentDef.h(11, 10); MyComp.ngComponentDef.h(11, 10);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
directiveRefresh(9, 8);
directiveRefresh(11, 10);
} }
renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']); renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']);
@ -308,7 +296,6 @@ describe('array literals', () => {
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); MyComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
expect(myComp !.names).toEqual([ expect(myComp !.names).toEqual([
@ -353,7 +340,6 @@ describe('object literals', () => {
} }
elementProperty(0, 'config', bind(pureFunction1(e0_ff, ctx.name))); elementProperty(0, 'config', bind(pureFunction1(e0_ff, ctx.name)));
ObjectComp.ngComponentDef.h(1, 0); ObjectComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {name: 'slide'}); renderToHtml(Template, {name: 'slide'});
@ -391,7 +377,6 @@ describe('object literals', () => {
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); ObjectComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
} }
renderToHtml(Template, {name: 'slide', duration: 100}); renderToHtml(Template, {name: 'slide', duration: 100});
@ -459,7 +444,6 @@ describe('object literals', () => {
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); ObjectComp.ngComponentDef.h(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd(); embeddedViewEnd();
} }
} }

View File

@ -11,7 +11,7 @@ import {MockAnimationDriver, MockAnimationPlayer} from '@angular/animations/brow
import {RendererType2, ViewEncapsulation} from '../../src/core'; import {RendererType2, ViewEncapsulation} from '../../src/core';
import {defineComponent, detectChanges} from '../../src/render3/index'; import {defineComponent, detectChanges} from '../../src/render3/index';
import {bind, directiveRefresh, elementEnd, elementProperty, elementStart, listener, text, tick} from '../../src/render3/instructions'; import {bind, elementEnd, elementProperty, elementStart, listener, text, tick} from '../../src/render3/instructions';
import {createRendererType2} from '../../src/view/index'; import {createRendererType2} from '../../src/view/index';
import {getAnimationRendererFactory2, getRendererFactory2} from './imported_renderer2'; import {getAnimationRendererFactory2, getRendererFactory2} from './imported_renderer2';
@ -68,7 +68,6 @@ describe('renderer factory lifecycle', () => {
elementEnd(); elementEnd();
} }
SomeComponent.ngComponentDef.h(2, 1); SomeComponent.ngComponentDef.h(2, 1);
directiveRefresh(2, 1);
} }
beforeEach(() => { logs = []; }); beforeEach(() => { logs = []; });

View File

@ -8,7 +8,7 @@
import {TemplateRef, ViewContainerRef} from '../../src/core'; import {TemplateRef, ViewContainerRef} from '../../src/core';
import {defineComponent, defineDirective, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index'; import {defineComponent, defineDirective, injectTemplateRef, injectViewContainerRef} from '../../src/render3/index';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, load, text, textBinding} from '../../src/render3/instructions'; import {bind, container, containerRefreshEnd, containerRefreshStart, load, text, textBinding} from '../../src/render3/instructions';
import {renderComponent, toHtml} from './render_util'; import {renderComponent, toHtml} from './render_util';
@ -42,7 +42,6 @@ describe('ViewContainerRef', () => {
containerRefreshStart(0); containerRefreshStart(0);
cmp.testDir = load<TestDirective>(1); cmp.testDir = load<TestDirective>(1);
TestDirective.ngDirectiveDef.h(1, 0); TestDirective.ngDirectiveDef.h(1, 0);
directiveRefresh(1, 0);
containerRefreshEnd(); containerRefreshEnd();
}, },
}); });