
committed by
Misko Hevery

parent
811679a583
commit
33b338120c
@ -8,7 +8,7 @@
|
||||
|
||||
import {NgForOfContext} from '@angular/common';
|
||||
|
||||
import {C, E, T, b, cR, cr, defineComponent, e, p, t} from '../../src/render3/index';
|
||||
import {C, E, T, b, cR, cr, defineComponent, e, p, r, t} from '../../src/render3/index';
|
||||
|
||||
import {NgForOf} from './common_with_def';
|
||||
import {renderComponent, toHtml} from './render_util';
|
||||
@ -20,6 +20,7 @@ describe('@angular/common integration', () => {
|
||||
items: string[] = ['first', 'second'];
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
type: MyApp,
|
||||
factory: () => new MyApp(),
|
||||
tag: 'my-app',
|
||||
// <ul>
|
||||
@ -33,7 +34,7 @@ describe('@angular/common integration', () => {
|
||||
}
|
||||
p(1, 'ngForOf', b(myApp.items));
|
||||
cR(1);
|
||||
NgForOf.ngDirectiveDef.r(2, 0);
|
||||
r(2, 0);
|
||||
cr();
|
||||
|
||||
function liTemplate(row: NgForOfContext<string>, cm: boolean) {
|
||||
|
@ -15,13 +15,11 @@ import {DirectiveType, InjectFlags, NgOnChangesFeature, defineDirective, inject,
|
||||
export const NgForOf: DirectiveType<NgForOfDef<any>> = NgForOfDef as any;
|
||||
|
||||
NgForOf.ngDirectiveDef = defineDirective({
|
||||
type: NgForOfDef,
|
||||
factory: () => new NgForOfDef(
|
||||
injectViewContainerRef(), injectTemplateRef(),
|
||||
inject(IterableDiffers, InjectFlags.Default, defaultIterableDiffers)),
|
||||
features: [NgOnChangesFeature(NgForOf)],
|
||||
refresh: (directiveIndex: number, elementIndex: number) => {
|
||||
m<NgForOfDef<any>>(directiveIndex).ngDoCheck();
|
||||
},
|
||||
inputs: {
|
||||
ngForOf: 'ngForOf',
|
||||
ngForTrackBy: 'ngForTrackBy',
|
||||
|
@ -311,14 +311,12 @@ describe('compiler specification', () => {
|
||||
|
||||
// NORMATIVE
|
||||
static ngDirectiveDef = r3.defineDirective({
|
||||
type: ForOfDirective,
|
||||
factory: function ForOfDirective_Factory() {
|
||||
return new ForOfDirective(r3.injectViewContainerRef(), r3.injectTemplateRef());
|
||||
},
|
||||
// TODO(chuckj): Enable when ngForOf enabling lands.
|
||||
// features: [NgOnChangesFeature(NgForOf)],
|
||||
refresh: function ForOfDirective_Refresh(directiveIndex: number, elementIndex: number) {
|
||||
r3.m<ForOfDirective>(directiveIndex).ngDoCheck();
|
||||
},
|
||||
inputs: {forOf: 'forOf'}
|
||||
});
|
||||
// /NORMATIVE
|
||||
@ -340,6 +338,7 @@ describe('compiler specification', () => {
|
||||
|
||||
// NORMATIVE
|
||||
static ngComponentDef = r3.defineComponent({
|
||||
type: MyComponent,
|
||||
tag: 'my-component',
|
||||
factory: function MyComponent_Factory() { return new MyComponent(); },
|
||||
template: function MyComponentTemplate(ctx: MyComponent, cm: boolean) {
|
||||
@ -350,7 +349,7 @@ describe('compiler specification', () => {
|
||||
}
|
||||
r3.p(1, 'forOf', r3.b(ctx.items));
|
||||
r3.cR(1);
|
||||
ForOfDirective.ngDirectiveDef.r(2, 1);
|
||||
r3.r(2, 1);
|
||||
r3.cr();
|
||||
|
||||
function MyComponent_ForOfDirective_Template_1(ctx1: any, cm: boolean) {
|
||||
@ -404,6 +403,7 @@ describe('compiler specification', () => {
|
||||
|
||||
// NORMATIVE
|
||||
static ngComponentDef = r3.defineComponent({
|
||||
type: MyComponent,
|
||||
tag: 'my-component',
|
||||
factory: function MyComponent_Factory() { return new MyComponent(); },
|
||||
template: function MyComponent_Template(ctx: MyComponent, cm: boolean) {
|
||||
@ -414,7 +414,7 @@ describe('compiler specification', () => {
|
||||
}
|
||||
r3.p(1, 'forOf', r3.b(ctx.items));
|
||||
r3.cR(1);
|
||||
ForOfDirective.ngDirectiveDef.r(2, 1);
|
||||
r3.r(2, 1);
|
||||
r3.cr();
|
||||
|
||||
function MyComponent_ForOfDirective_Template_1(ctx1: any, cm: boolean) {
|
||||
@ -430,7 +430,7 @@ describe('compiler specification', () => {
|
||||
r3.t(1, r3.b1('', l0_item.name, ''));
|
||||
r3.p(4, 'forOf', r3.b(ctx.items));
|
||||
r3.cR(3);
|
||||
ForOfDirective.ngDirectiveDef.r(4, 3);
|
||||
r3.r(4, 3);
|
||||
r3.cr();
|
||||
|
||||
function MyComponent_ForOfDirective_ForOfDirective_Template_3(
|
||||
|
@ -28,6 +28,7 @@ describe('define', () => {
|
||||
}
|
||||
|
||||
static ngDirectiveDef = defineDirective({
|
||||
type: MyDirective,
|
||||
factory: () => new MyDirective(),
|
||||
features: [NgOnChangesFeature(MyDirective)],
|
||||
inputs: {valA: 'valA', valB: 'valB'}
|
||||
|
@ -240,7 +240,7 @@ describe('di', () => {
|
||||
constructor(public value: string) {}
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
// type: MyApp,
|
||||
type: MyApp,
|
||||
tag: 'my-app',
|
||||
factory: () => new MyApp(inject(String as any, InjectFlags.Default, 'DefaultValue')),
|
||||
template: () => null
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {TemplateRef, ViewContainerRef} from '../../src/core';
|
||||
import {C, T, b, cR, cr, defineComponent, defineDirective, injectTemplateRef, injectViewContainerRef, m, t} from '../../src/render3/index';
|
||||
import {C, T, b, cR, cr, defineComponent, defineDirective, injectTemplateRef, injectViewContainerRef, m, r, t} from '../../src/render3/index';
|
||||
|
||||
import {renderComponent, toHtml} from './render_util';
|
||||
|
||||
@ -16,6 +16,7 @@ describe('ViewContainerRef', () => {
|
||||
constructor(public viewContainer: ViewContainerRef, public template: TemplateRef<any>, ) {}
|
||||
|
||||
static ngDirectiveDef = defineDirective({
|
||||
type: TestDirective,
|
||||
factory: () => new TestDirective(injectViewContainerRef(), injectTemplateRef(), ),
|
||||
});
|
||||
}
|
||||
@ -24,6 +25,7 @@ describe('ViewContainerRef', () => {
|
||||
testDir: TestDirective;
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
type: TestComponent,
|
||||
tag: 'test-cmp',
|
||||
factory: () => new TestComponent(),
|
||||
template: (cmp: TestComponent, cm: boolean) => {
|
||||
@ -38,7 +40,8 @@ describe('ViewContainerRef', () => {
|
||||
}
|
||||
cR(0);
|
||||
cmp.testDir = m(1) as TestDirective;
|
||||
TestDirective.ngDirectiveDef.r(1, 0);
|
||||
TestDirective.ngDirectiveDef.h(1, 0);
|
||||
r(1, 0);
|
||||
cr();
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user