refactor(ivy): rename componentRefresh to directiveRefresh (#22395)

PR Close #22395
This commit is contained in:
Marc Laval
2018-02-23 11:02:38 +01:00
committed by Victor Berchet
parent a81d599bfc
commit aad431642a
14 changed files with 214 additions and 213 deletions

View File

@ -8,7 +8,7 @@
import {SimpleChanges} from '../../src/core';
import {ComponentTemplate, NgOnChangesFeature, defineComponent, defineDirective} from '../../src/render3/index';
import {bind, componentRefresh, container, containerRefreshEnd, containerRefreshStart, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, projection, projectionDef, store, text} from '../../src/render3/instructions';
import {bind, container, containerRefreshEnd, containerRefreshStart, directiveRefresh, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, listener, projection, projectionDef, store, text} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util';
@ -22,7 +22,7 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind(ctx.val));
type.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
};
}
@ -76,7 +76,7 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {val: '1'});
@ -98,7 +98,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -124,8 +124,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -152,7 +152,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -183,8 +183,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -217,10 +217,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
componentRefresh(1, 0);
componentRefresh(3, 2);
componentRefresh(5, 4);
componentRefresh(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
}
renderToHtml(Template, {});
@ -236,8 +236,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
componentRefresh(1, 0);
componentRefresh(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
}
renderToHtml(Template, {});
@ -256,7 +256,7 @@ describe('lifecycles', () => {
elementEnd();
}
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -296,13 +296,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', j);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -342,13 +342,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', j);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -403,7 +403,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -425,7 +425,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -440,7 +440,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -459,8 +459,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
componentRefresh(1, 0);
componentRefresh(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
}
renderToHtml(Template, {});
@ -479,7 +479,7 @@ describe('lifecycles', () => {
elementEnd();
}
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -516,7 +516,7 @@ describe('lifecycles', () => {
}
elementProperty(1, 'val', bind(ctx.val));
Comp.ngComponentDef.h(2, 1);
componentRefresh(2, 1);
directiveRefresh(2, 1);
});
let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => {
@ -554,7 +554,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -583,7 +583,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -613,7 +613,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -640,8 +640,8 @@ describe('lifecycles', () => {
elementProperty(3, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(4, 3);
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -671,8 +671,8 @@ describe('lifecycles', () => {
}
Parent.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -718,10 +718,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Parent.ngComponentDef.h(6, 5);
ProjectedComp.ngComponentDef.h(8, 7);
componentRefresh(1, 0);
componentRefresh(3, 2);
componentRefresh(6, 5);
componentRefresh(8, 7);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(6, 5);
directiveRefresh(8, 7);
}
renderToHtml(Template, {});
@ -760,13 +760,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(5, 4);
directiveRefresh(1, 0);
directiveRefresh(5, 4);
}
renderToHtml(Template, {});
@ -797,13 +797,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(5, 4);
directiveRefresh(1, 0);
directiveRefresh(5, 4);
}
it('should be called in correct order in a for loop with children', () => {
@ -831,7 +831,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -861,8 +861,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
componentRefresh(1, 0);
componentRefresh(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
}
renderToHtml(Template, {});
@ -877,7 +877,7 @@ describe('lifecycles', () => {
elementEnd();
}
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -938,7 +938,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -966,7 +966,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -996,7 +996,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -1022,8 +1022,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
expect(events).toEqual(['comp1', 'comp2', 'parent1', 'parent2']);
@ -1047,8 +1047,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -1087,10 +1087,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
componentRefresh(1, 0);
componentRefresh(3, 2);
componentRefresh(5, 4);
componentRefresh(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
}
renderToHtml(Template, {});
@ -1116,8 +1116,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
});
/**
@ -1135,8 +1135,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2);
ParentComp.ngComponentDef.h(1, 0);
ParentComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -1172,13 +1172,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', i);
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -1215,13 +1215,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -1240,7 +1240,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -1259,7 +1259,7 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind(ctx.myVal));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {myVal: 5});
@ -1298,13 +1298,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', i);
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -1335,8 +1335,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
componentRefresh(1, 0);
componentRefresh(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
}
renderToHtml(Template, {});
@ -1351,7 +1351,7 @@ describe('lifecycles', () => {
elementEnd();
}
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -1413,7 +1413,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -1450,8 +1450,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
embeddedViewEnd();
}
}
@ -1484,7 +1484,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -1512,7 +1512,7 @@ describe('lifecycles', () => {
elementEnd();
}
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
});
function Template(ctx: any, cm: boolean) {
@ -1527,7 +1527,7 @@ describe('lifecycles', () => {
elementEnd();
}
Grandparent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -1581,10 +1581,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
componentRefresh(1, 0);
componentRefresh(3, 2);
componentRefresh(5, 4);
componentRefresh(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
embeddedViewEnd();
}
}
@ -1636,13 +1636,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind('2'));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
embeddedViewEnd();
}
}
@ -1712,13 +1712,13 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind(j));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
embeddedViewEnd();
}
}
@ -1787,7 +1787,7 @@ describe('lifecycles', () => {
elementEnd();
}
Comp.ngComponentDef.h(3, 2);
componentRefresh(3, 2);
directiveRefresh(3, 2);
embeddedViewEnd();
}
}
@ -1837,8 +1837,8 @@ describe('lifecycles', () => {
}
Comp.ngComponentDef.h(1, 0);
Directive.ngDirectiveDef.h(2, 0);
componentRefresh(1, 0);
componentRefresh(2, 0);
directiveRefresh(1, 0);
directiveRefresh(2, 0);
embeddedViewEnd();
}
}
@ -1872,7 +1872,7 @@ describe('lifecycles', () => {
elementEnd();
}
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -1909,7 +1909,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(ctx.a));
elementProperty(0, 'publicName', bind(ctx.b));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
});
const ProjectedComp = createOnChangesComponent('projected', (ctx: any, cm: boolean) => {
if (cm) {
@ -1969,7 +1969,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(ctx.val1));
elementProperty(0, 'publicName', bind(ctx.val2));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {val1: '1', val2: 'a'});
@ -1996,7 +1996,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(ctx.val1));
elementProperty(0, 'publicName', bind(ctx.val2));
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {val1: '1', val2: 'a'});
@ -2027,8 +2027,8 @@ describe('lifecycles', () => {
elementProperty(2, 'publicName', bind(2));
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -2062,7 +2062,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
@ -2100,8 +2100,8 @@ describe('lifecycles', () => {
elementProperty(2, 'publicName', bind(2));
Comp.ngComponentDef.h(1, 0);
ProjectedComp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -2141,10 +2141,10 @@ describe('lifecycles', () => {
ProjectedComp.ngComponentDef.h(3, 2);
Comp.ngComponentDef.h(5, 4);
ProjectedComp.ngComponentDef.h(7, 6);
componentRefresh(1, 0);
componentRefresh(3, 2);
componentRefresh(5, 4);
componentRefresh(7, 6);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
directiveRefresh(5, 4);
directiveRefresh(7, 6);
}
renderToHtml(Template, {});
@ -2166,7 +2166,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -2191,7 +2191,7 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(1));
elementProperty(0, 'publicName', bind(1));
Directive.ngDirectiveDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
}
renderToHtml(Template, {});
@ -2234,13 +2234,13 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(j));
elementProperty(0, 'publicName', bind(j));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -2289,13 +2289,13 @@ describe('lifecycles', () => {
elementProperty(0, 'val1', bind(j));
elementProperty(0, 'publicName', bind(j));
Parent.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
embeddedViewEnd();
}
}
containerRefreshEnd();
componentRefresh(1, 0);
componentRefresh(4, 3);
directiveRefresh(1, 0);
directiveRefresh(4, 3);
}
renderToHtml(Template, {});
@ -2367,8 +2367,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2);
Comp.ngComponentDef.h(1, 0);
Comp.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});
@ -2397,7 +2397,7 @@ describe('lifecycles', () => {
}
elementProperty(0, 'val', bind(ctx.val));
Comp.ngComponentDef.h(1, 0);
componentRefresh(1, 0);
directiveRefresh(1, 0);
});
/**
@ -2415,8 +2415,8 @@ describe('lifecycles', () => {
elementProperty(2, 'val', 2);
Parent.ngComponentDef.h(1, 0);
Parent.ngComponentDef.h(3, 2);
componentRefresh(1, 0);
componentRefresh(3, 2);
directiveRefresh(1, 0);
directiveRefresh(3, 2);
}
renderToHtml(Template, {});