refactor(ivy): flatten hooks and collapse LView hook properties (#21650)

PR Close #21650
This commit is contained in:
Kara Erickson
2018-01-23 18:39:09 -08:00
committed by Misko Hevery
parent 33b338120c
commit 3e03dbe576
11 changed files with 113 additions and 129 deletions

View File

@ -175,6 +175,7 @@ describe('compiler specification', () => {
@Component({selector: 'simple', template: `<div><ng-content></ng-content></div>`})
class SimpleComponent {
static ngComponentDef = r3.defineComponent({
type: SimpleComponent,
tag: 'simple',
factory: () => new SimpleComponent(),
template: function(ctx: SimpleComponent, cm: boolean) {
@ -196,6 +197,7 @@ describe('compiler specification', () => {
})
class ComplexComponent {
static ngComponentDef = r3.defineComponent({
type: ComplexComponent,
tag: 'complex',
factory: () => new ComplexComponent(),
template: function(ctx: ComplexComponent, cm: boolean) {
@ -221,6 +223,7 @@ describe('compiler specification', () => {
})
class MyApp {
static ngComponentDef = r3.defineComponent({
type: MyApp,
tag: 'my-app',
factory: () => new MyApp(),
template: function(ctx: MyApp, cm: boolean) {

View File

@ -104,7 +104,7 @@ describe('content projection', () => {
/** <div><ng-content></ng-content></div> */
const Child = createComponent('child', (ctx: any, cm: boolean) => {
if (cm) {
m(0, pD());
pD(0);
E(1, 'div');
{ P(2, 0); }
e();

View File

@ -42,11 +42,11 @@ describe('define', () => {
expect(myDir.log).toEqual(['second']);
expect(myDir.valB).toEqual('works');
myDir.log.length = 0;
myDir.ngDoCheck();
MyDirective.ngDirectiveDef.doCheck !.call(myDir);
expect(myDir.log).toEqual([
'ngOnChanges', 'valA', 'initValue', 'first', 'valB', undefined, 'second', 'ngDoCheck'
]);
});
});
});
});
});

View File

@ -31,7 +31,7 @@ describe('lifecycles', () => {
let Comp = createOnInitComponent('comp', (ctx: any, cm: boolean) => {
if (cm) {
m(0, pD());
pD(0);
E(1, 'div');
{ P(2, 0); }
e();
@ -435,14 +435,14 @@ describe('lifecycles', () => {
let Comp = createAfterContentInitComp('comp', function(ctx: any, cm: boolean) {
if (cm) {
m(0, pD());
pD(0);
P(1, 0);
}
});
let Parent = createAfterContentInitComp('parent', function(ctx: any, cm: boolean) {
if (cm) {
m(0, pD());
pD(0);
E(1, Comp);
{ P(3, 0); }
e();
@ -454,7 +454,7 @@ describe('lifecycles', () => {
let ProjectedComp = createAfterContentInitComp('projected', (ctx: any, cm: boolean) => {
if (cm) {
m(0, pD());
pD(0);
P(1, 0);
}
});
@ -813,7 +813,7 @@ describe('lifecycles', () => {
let Comp = createAfterViewInitComponent('comp', (ctx: any, cm: boolean) => {
if (cm) {
m(0, pD());
pD(0);
E(1, 'div');
{ P(2, 0); }
e();
@ -1244,7 +1244,7 @@ describe('lifecycles', () => {
let Comp = createOnDestroyComponent('comp', (ctx: any, cm: boolean) => {
if (cm) {
m(0, pD());
pD(0);
P(1, 0);
}
});