refactor(ivy): remove `type` from `DirectiveDef` (#21374)
This change makes the code cleaner for the user. It does mean a little bit more work for us since we have to patch the `type` back into the `DirectiveDef`. However since the patching happens only once on startup it should not be significant. PR Close #21374
This commit is contained in:
parent
16232f000f
commit
5eaaac35a8
|
@ -16,16 +16,13 @@ export class LargeTableComponent {
|
||||||
|
|
||||||
/** @nocollapse */
|
/** @nocollapse */
|
||||||
static ngComponentDef: ComponentDef<LargeTableComponent> = defineComponent({
|
static ngComponentDef: ComponentDef<LargeTableComponent> = defineComponent({
|
||||||
type: LargeTableComponent,
|
|
||||||
tag: 'largetable',
|
tag: 'largetable',
|
||||||
template: function(ctx: LargeTableComponent, cm: boolean) {
|
template: function(ctx: LargeTableComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'table');
|
E(0, 'table');
|
||||||
{
|
{
|
||||||
E(1, 'tbody');
|
E(1, 'tbody');
|
||||||
{
|
{ C(2); }
|
||||||
C(2);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
e();
|
e();
|
||||||
|
|
|
@ -36,7 +36,6 @@ export class TreeComponent {
|
||||||
|
|
||||||
/** @nocollapse */
|
/** @nocollapse */
|
||||||
static ngComponentDef: ComponentDef<TreeComponent> = defineComponent({
|
static ngComponentDef: ComponentDef<TreeComponent> = defineComponent({
|
||||||
type: TreeComponent,
|
|
||||||
tag: 'tree',
|
tag: 'tree',
|
||||||
template: function(ctx: TreeComponent, cm: boolean) {
|
template: function(ctx: TreeComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -93,7 +92,6 @@ export class TreeFunction extends TreeComponent {
|
||||||
|
|
||||||
/** @nocollapse */
|
/** @nocollapse */
|
||||||
static ngComponentDef: ComponentDef<TreeFunction> = defineComponent({
|
static ngComponentDef: ComponentDef<TreeFunction> = defineComponent({
|
||||||
type: TreeFunction,
|
|
||||||
tag: 'tree',
|
tag: 'tree',
|
||||||
template: function(ctx: TreeFunction, cm: boolean) {
|
template: function(ctx: TreeFunction, cm: boolean) {
|
||||||
// bit of a hack
|
// bit of a hack
|
||||||
|
|
|
@ -13,13 +13,14 @@ import {ComponentRef as viewEngine_ComponentRef} from '../linker/component_facto
|
||||||
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef} from '../linker/view_ref';
|
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef} from '../linker/view_ref';
|
||||||
|
|
||||||
import {assertNotNull} from './assert';
|
import {assertNotNull} from './assert';
|
||||||
import {NG_HOST_SYMBOL, createError, createLView, directive, enterView, hostElement, leaveView, locateHostElement, renderComponentOrTemplate, directiveCreate} from './instructions';
|
import {NG_HOST_SYMBOL, createError, createLView, directive, directiveCreate, enterView, hostElement, leaveView, locateHostElement, renderComponentOrTemplate} from './instructions';
|
||||||
import {ComponentDef, ComponentType} from './interfaces/definition';
|
import {ComponentDef, ComponentType, TypedComponentDef} from './interfaces/definition';
|
||||||
import {LElementNode} from './interfaces/node';
|
import {LElementNode} from './interfaces/node';
|
||||||
import {RElement, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
||||||
import {notImplemented, stringify} from './util';
|
import {notImplemented, stringify} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Options that control how the component should be bootstrapped. */
|
/** Options that control how the component should be bootstrapped. */
|
||||||
export interface CreateComponentOptions {
|
export interface CreateComponentOptions {
|
||||||
/** Which renderer factory to use. */
|
/** Which renderer factory to use. */
|
||||||
|
@ -165,7 +166,8 @@ export const NULL_INJECTOR: Injector = {
|
||||||
export function renderComponent<T>(
|
export function renderComponent<T>(
|
||||||
componentType: ComponentType<T>, opts: CreateComponentOptions = {}): T {
|
componentType: ComponentType<T>, opts: CreateComponentOptions = {}): T {
|
||||||
const rendererFactory = opts.rendererFactory || domRendererFactory3;
|
const rendererFactory = opts.rendererFactory || domRendererFactory3;
|
||||||
const componentDef = componentType.ngComponentDef;
|
const componentDef = componentType.ngComponentDef as TypedComponentDef<T>;
|
||||||
|
if (componentDef.type != componentType) componentDef.type = componentType;
|
||||||
let component: T;
|
let component: T;
|
||||||
const hostNode = locateHostElement(rendererFactory, opts.host || componentDef.tag);
|
const hostNode = locateHostElement(rendererFactory, opts.host || componentDef.tag);
|
||||||
const oldView = enterView(
|
const oldView = enterView(
|
||||||
|
|
|
@ -32,7 +32,6 @@ import {ComponentDef, ComponentDefArgs, DirectiveDef, DirectiveDefArgs} from './
|
||||||
*/
|
*/
|
||||||
export function defineComponent<T>(componentDefinition: ComponentDefArgs<T>): ComponentDef<T> {
|
export function defineComponent<T>(componentDefinition: ComponentDefArgs<T>): ComponentDef<T> {
|
||||||
const def = <ComponentDef<any>>{
|
const def = <ComponentDef<any>>{
|
||||||
type: componentDefinition.type,
|
|
||||||
diPublic: null,
|
diPublic: null,
|
||||||
n: componentDefinition.factory,
|
n: componentDefinition.factory,
|
||||||
tag: (componentDefinition as ComponentDefArgs<T>).tag || null !,
|
tag: (componentDefinition as ComponentDefArgs<T>).tag || null !,
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {ViewContainerRef as viewEngine_ViewContainerRef} from '../linker/view_co
|
||||||
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef, ViewRef as viewEngine_ViewRef} from '../linker/view_ref';
|
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef, ViewRef as viewEngine_ViewRef} from '../linker/view_ref';
|
||||||
import {Type} from '../type';
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {ComponentTemplate, DirectiveDef} from './interfaces/definition';
|
import {ComponentTemplate, DirectiveDef, TypedDirectiveDef} from './interfaces/definition';
|
||||||
import {LInjector} from './interfaces/injector';
|
import {LInjector} from './interfaces/injector';
|
||||||
import {LContainerNode, LElementNode, LNodeFlags} from './interfaces/node';
|
import {LContainerNode, LElementNode, LNodeFlags} from './interfaces/node';
|
||||||
import {assertNodeType} from './node_assert';
|
import {assertNodeType} from './node_assert';
|
||||||
|
@ -147,7 +147,7 @@ function createInjectionError(text: string, token: any) {
|
||||||
* @param di The node injector in which a directive will be added
|
* @param di The node injector in which a directive will be added
|
||||||
* @param def The definition of the directive to be made public
|
* @param def The definition of the directive to be made public
|
||||||
*/
|
*/
|
||||||
export function diPublicInInjector(di: LInjector, def: DirectiveDef<any>): void {
|
export function diPublicInInjector(di: LInjector, def: TypedDirectiveDef<any>): void {
|
||||||
bloomAdd(di, def.type);
|
bloomAdd(di, def.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ export function getOrCreateInjectable<T>(di: LInjector, token: Type<T>, flags?:
|
||||||
for (let i = start, ii = start + size; i < ii; i++) {
|
for (let i = start, ii = start + size; i < ii; i++) {
|
||||||
// Get the definition for the directive at this index and, if it is injectable (diPublic),
|
// Get the definition for the directive at this index and, if it is injectable (diPublic),
|
||||||
// and matches the given token, return the directive instance.
|
// and matches the given token, return the directive instance.
|
||||||
const directiveDef = ngStaticData[i] as DirectiveDef<any>;
|
const directiveDef = ngStaticData[i] as TypedDirectiveDef<any>;
|
||||||
if (directiveDef.diPublic && directiveDef.type == token) {
|
if (directiveDef.diPublic && directiveDef.type == token) {
|
||||||
return node.view.data[i];
|
return node.view.data[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {LContainerNode, LElementNode, LNode, LNodeFlags, LProjectionNode, LTextN
|
||||||
import {assertNodeType} from './node_assert';
|
import {assertNodeType} from './node_assert';
|
||||||
import {appendChild, insertChild, insertView, processProjectedNode, removeView} from './node_manipulation';
|
import {appendChild, insertChild, insertView, processProjectedNode, removeView} from './node_manipulation';
|
||||||
import {isNodeMatchingSelector} from './node_selector_matcher';
|
import {isNodeMatchingSelector} from './node_selector_matcher';
|
||||||
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType} from './interfaces/definition';
|
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, TypedDirectiveDef, TypedComponentDef} from './interfaces/definition';
|
||||||
import {InjectFlags, diPublicInInjector, getOrCreateNodeInjectorForNode, getOrCreateElementRef, getOrCreateTemplateRef, getOrCreateContainerRef, getOrCreateInjectable} from './di';
|
import {InjectFlags, diPublicInInjector, getOrCreateNodeInjectorForNode, getOrCreateElementRef, getOrCreateTemplateRef, getOrCreateContainerRef, getOrCreateInjectable} from './di';
|
||||||
import {QueryList, LQuery_} from './query';
|
import {QueryList, LQuery_} from './query';
|
||||||
import {RComment, RElement, RText, Renderer3, RendererFactory3, ProceduralRenderer3, ObjectOrientedRenderer3, RendererStyleFlags3} from './interfaces/renderer';
|
import {RComment, RElement, RText, Renderer3, RendererFactory3, ProceduralRenderer3, ObjectOrientedRenderer3, RendererStyleFlags3} from './interfaces/renderer';
|
||||||
|
@ -343,7 +343,7 @@ export function getOrCreateNodeInjector(): LInjector {
|
||||||
*
|
*
|
||||||
* @param def The definition of the directive to be made public
|
* @param def The definition of the directive to be made public
|
||||||
*/
|
*/
|
||||||
export function diPublic(def: DirectiveDef<any>): void {
|
export function diPublic(def: TypedDirectiveDef<any>): void {
|
||||||
diPublicInInjector(getOrCreateNodeInjector(), def);
|
diPublicInInjector(getOrCreateNodeInjector(), def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,6 +475,8 @@ export function elementStart(
|
||||||
if (hostComponentDef) {
|
if (hostComponentDef) {
|
||||||
// TODO(mhevery): This assumes that the directives come in correct order, which
|
// TODO(mhevery): This assumes that the directives come in correct order, which
|
||||||
// is not guaranteed. Must be refactored to take it into account.
|
// is not guaranteed. Must be refactored to take it into account.
|
||||||
|
(hostComponentDef as TypedComponentDef<any>).type =
|
||||||
|
nameOrComponentType as ComponentType<any>;
|
||||||
directiveCreate(++index, hostComponentDef.n(), hostComponentDef, queryName);
|
directiveCreate(++index, hostComponentDef.n(), hostComponentDef, queryName);
|
||||||
}
|
}
|
||||||
hack_declareDirectives(index, directiveTypes, localRefs);
|
hack_declareDirectives(index, directiveTypes, localRefs);
|
||||||
|
@ -500,7 +502,9 @@ function hack_declareDirectives(
|
||||||
// template
|
// template
|
||||||
// code for slight startup(first run) performance. (No impact on subsequent runs)
|
// code for slight startup(first run) performance. (No impact on subsequent runs)
|
||||||
// TODO(misko): refactor this to store the `DirectiveDef` in `TView.data`.
|
// TODO(misko): refactor this to store the `DirectiveDef` in `TView.data`.
|
||||||
const directiveDef = directiveTypes[i].ngDirectiveDef;
|
const directiveType = directiveTypes[i];
|
||||||
|
const directiveDef = directiveType.ngDirectiveDef;
|
||||||
|
(directiveDef as TypedDirectiveDef<any>).type = directiveType;
|
||||||
directiveCreate(
|
directiveCreate(
|
||||||
++index, directiveDef.n(), directiveDef, hack_findQueryName(directiveDef, localRefs));
|
++index, directiveDef.n(), directiveDef, hack_findQueryName(directiveDef, localRefs));
|
||||||
}
|
}
|
||||||
|
@ -945,8 +949,7 @@ export function directiveCreate<T>(
|
||||||
if (index >= ngStaticData.length) {
|
if (index >= ngStaticData.length) {
|
||||||
ngStaticData[index] = directiveDef !;
|
ngStaticData[index] = directiveDef !;
|
||||||
if (queryName) {
|
if (queryName) {
|
||||||
ngDevMode &&
|
ngDevMode && assertNotNull(previousOrParentNode.tNode, 'previousOrParentNode.staticData');
|
||||||
assertNotNull(previousOrParentNode.tNode, 'previousOrParentNode.staticData');
|
|
||||||
const nodeStaticData = previousOrParentNode !.tNode !;
|
const nodeStaticData = previousOrParentNode !.tNode !;
|
||||||
(nodeStaticData.localNames || (nodeStaticData.localNames = [])).push(queryName, index);
|
(nodeStaticData.localNames || (nodeStaticData.localNames = [])).push(queryName, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,6 @@ export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||||
* `DirectiveDef` is a compiled version of the Directive used by the renderer instructions.
|
* `DirectiveDef` is a compiled version of the Directive used by the renderer instructions.
|
||||||
*/
|
*/
|
||||||
export interface DirectiveDef<T> {
|
export interface DirectiveDef<T> {
|
||||||
/**
|
|
||||||
* Token representing the directive. Used by DI.
|
|
||||||
*/
|
|
||||||
type: Type<T>;
|
|
||||||
|
|
||||||
/** Function that makes a directive public to the DI system. */
|
/** Function that makes a directive public to the DI system. */
|
||||||
diPublic: ((def: DirectiveDef<any>) => void)|null;
|
diPublic: ((def: DirectiveDef<any>) => void)|null;
|
||||||
|
|
||||||
|
@ -41,26 +36,26 @@ export interface DirectiveDef<T> {
|
||||||
*
|
*
|
||||||
* The key is minified property name whereas the value is the original unminified name.
|
* The key is minified property name whereas the value is the original unminified name.
|
||||||
*/
|
*/
|
||||||
inputs: {[P in keyof T]: P};
|
readonly inputs: {[P in keyof T]: P};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of outputs which are part of the components public API.
|
* List of outputs which are part of the components public API.
|
||||||
*
|
*
|
||||||
* The key is minified property name whereas the value is the original unminified name.=
|
* The key is minified property name whereas the value is the original unminified name.=
|
||||||
*/
|
*/
|
||||||
outputs: {[P in keyof T]: P};
|
readonly outputs: {[P in keyof T]: P};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of methods which are part of the components public API.
|
* List of methods which are part of the components public API.
|
||||||
*
|
*
|
||||||
* The key is minified property name whereas the value is the original unminified name.
|
* The key is minified property name whereas the value is the original unminified name.
|
||||||
*/
|
*/
|
||||||
methods: {[P in keyof T]: P};
|
readonly methods: {[P in keyof T]: P};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name under which the directive is exported (for use with local references in template)
|
* Name under which the directive is exported (for use with local references in template)
|
||||||
*/
|
*/
|
||||||
exportAs: string|null;
|
readonly exportAs: string|null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* factory function used to create a new directive instance.
|
* factory function used to create a new directive instance.
|
||||||
|
@ -111,25 +106,34 @@ export interface ComponentDef<T> extends DirectiveDef<T> {
|
||||||
*
|
*
|
||||||
* NOTE: only used with component directives.
|
* NOTE: only used with component directives.
|
||||||
*/
|
*/
|
||||||
tag: string;
|
readonly tag: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The View template of the component.
|
* The View template of the component.
|
||||||
*
|
*
|
||||||
* NOTE: only used with component directives.
|
* NOTE: only used with component directives.
|
||||||
*/
|
*/
|
||||||
template: ComponentTemplate<T>;
|
readonly template: ComponentTemplate<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renderer type data of the component.
|
* Renderer type data of the component.
|
||||||
*
|
*
|
||||||
* NOTE: only used with component directives.
|
* NOTE: only used with component directives.
|
||||||
*/
|
*/
|
||||||
rendererType: RendererType2|null;
|
readonly rendererType: RendererType2|null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private: do not export
|
||||||
|
*/
|
||||||
|
export interface TypedDirectiveDef<T> extends DirectiveDef<T> { type: DirectiveType<T>; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private: do not export
|
||||||
|
*/
|
||||||
|
export interface TypedComponentDef<T> extends ComponentDef<T> { type: ComponentType<T>; }
|
||||||
|
|
||||||
export interface DirectiveDefArgs<T> {
|
export interface DirectiveDefArgs<T> {
|
||||||
type: Type<T>;
|
|
||||||
factory: () => T;
|
factory: () => T;
|
||||||
refresh?: (directiveIndex: number, elementIndex: number) => void;
|
refresh?: (directiveIndex: number, elementIndex: number) => void;
|
||||||
inputs?: {[P in keyof T]?: string};
|
inputs?: {[P in keyof T]?: string};
|
||||||
|
|
|
@ -17,13 +17,14 @@ import {Type} from '../type';
|
||||||
|
|
||||||
import {assertNotNull} from './assert';
|
import {assertNotNull} from './assert';
|
||||||
import {getOrCreateContainerRef, getOrCreateElementRef, getOrCreateNodeInjectorForNode, getOrCreateTemplateRef} from './di';
|
import {getOrCreateContainerRef, getOrCreateElementRef, getOrCreateNodeInjectorForNode, getOrCreateTemplateRef} from './di';
|
||||||
import {DirectiveDef} from './interfaces/definition';
|
import {DirectiveDef, TypedDirectiveDef} from './interfaces/definition';
|
||||||
import {LInjector} from './interfaces/injector';
|
import {LInjector} from './interfaces/injector';
|
||||||
import {LContainerNode, LElementNode, LNode, LNodeFlags, LViewNode, TNode} from './interfaces/node';
|
import {LContainerNode, LElementNode, LNode, LNodeFlags, LViewNode, TNode} from './interfaces/node';
|
||||||
import {LQuery, QueryReadType} from './interfaces/query';
|
import {LQuery, QueryReadType} from './interfaces/query';
|
||||||
import {assertNodeOfPossibleTypes} from './node_assert';
|
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A predicate which determines if a given element/directive should be included in the query
|
* A predicate which determines if a given element/directive should be included in the query
|
||||||
*/
|
*/
|
||||||
|
@ -142,7 +143,7 @@ function geIdxOfMatchingDirective(node: LNode, type: Type<any>): number|null {
|
||||||
for (let i = flags >> LNodeFlags.INDX_SHIFT,
|
for (let i = flags >> LNodeFlags.INDX_SHIFT,
|
||||||
ii = i + ((flags & LNodeFlags.SIZE_MASK) >> LNodeFlags.SIZE_SHIFT);
|
ii = i + ((flags & LNodeFlags.SIZE_MASK) >> LNodeFlags.SIZE_SHIFT);
|
||||||
i < ii; i++) {
|
i < ii; i++) {
|
||||||
const def = ngStaticData[i] as DirectiveDef<any>;
|
const def = ngStaticData[i] as TypedDirectiveDef<any>;
|
||||||
if (def.diPublic && def.type === type) {
|
if (def.diPublic && def.type === type) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ describe('iv perf test', () => {
|
||||||
it(`${iteration}. create ${count} divs in Render3`, () => {
|
it(`${iteration}. create ${count} divs in Render3`, () => {
|
||||||
class Component {
|
class Component {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: Component,
|
|
||||||
tag: 'div',
|
tag: 'div',
|
||||||
template: function Template(ctx: any, cm: any) {
|
template: function Template(ctx: any, cm: any) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
|
|
@ -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 {Component, Directive, Type, NgModule, Injectable, Optional, TemplateRef} from '../../src/core';
|
import {Component, Directive, Injectable, NgModule, Optional, TemplateRef, Type} from '../../src/core';
|
||||||
import * as r3 from '../../src/render3/index';
|
import * as r3 from '../../src/render3/index';
|
||||||
|
|
||||||
import {containerEl, renderComponent, requestAnimationFrame, toHtml} from './render_util';
|
import {containerEl, renderComponent, requestAnimationFrame, toHtml} from './render_util';
|
||||||
|
@ -27,7 +27,6 @@ describe('compiler specification', () => {
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
// NORMATIVE
|
// NORMATIVE
|
||||||
static ngComponentDef = r3.defineComponent({
|
static ngComponentDef = r3.defineComponent({
|
||||||
type: MyComponent,
|
|
||||||
tag: 'my-component',
|
tag: 'my-component',
|
||||||
factory: () => new MyComponent(),
|
factory: () => new MyComponent(),
|
||||||
template: function(ctx: MyComponent, cm: boolean) {
|
template: function(ctx: MyComponent, cm: boolean) {
|
||||||
|
@ -60,7 +59,6 @@ describe('compiler specification', () => {
|
||||||
constructor() { log.push('ChildComponent'); }
|
constructor() { log.push('ChildComponent'); }
|
||||||
// NORMATIVE
|
// NORMATIVE
|
||||||
static ngComponentDef = r3.defineComponent({
|
static ngComponentDef = r3.defineComponent({
|
||||||
type: ChildComponent,
|
|
||||||
tag: `child`,
|
tag: `child`,
|
||||||
factory: () => new ChildComponent(),
|
factory: () => new ChildComponent(),
|
||||||
template: function(ctx: ChildComponent, cm: boolean) {
|
template: function(ctx: ChildComponent, cm: boolean) {
|
||||||
|
@ -79,7 +77,6 @@ describe('compiler specification', () => {
|
||||||
constructor() { log.push('SomeDirective'); }
|
constructor() { log.push('SomeDirective'); }
|
||||||
// NORMATIVE
|
// NORMATIVE
|
||||||
static ngDirectiveDef = r3.defineDirective({
|
static ngDirectiveDef = r3.defineDirective({
|
||||||
type: ChildComponent,
|
|
||||||
factory: () => new SomeDirective(),
|
factory: () => new SomeDirective(),
|
||||||
});
|
});
|
||||||
// /NORMATIVE
|
// /NORMATIVE
|
||||||
|
@ -121,13 +118,13 @@ describe('compiler specification', () => {
|
||||||
constructor(template: TemplateRef<any>) { log.push('ifDirective'); }
|
constructor(template: TemplateRef<any>) { log.push('ifDirective'); }
|
||||||
// NORMATIVE
|
// NORMATIVE
|
||||||
static ngDirectiveDef = r3.defineDirective({
|
static ngDirectiveDef = r3.defineDirective({
|
||||||
type: IfDirective,
|
|
||||||
factory: () => new IfDirective(r3.injectTemplateRef()),
|
factory: () => new IfDirective(r3.injectTemplateRef()),
|
||||||
});
|
});
|
||||||
// /NORMATIVE
|
// /NORMATIVE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({selector: 'my-component', template: `<ul #foo><li *if>{{salutation}} {{foo}}</li></ul>`})
|
@Component(
|
||||||
|
{selector: 'my-component', template: `<ul #foo><li *if>{{salutation}} {{foo}}</li></ul>`})
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
salutation = 'Hello';
|
salutation = 'Hello';
|
||||||
// NORMATIVE
|
// NORMATIVE
|
||||||
|
|
|
@ -20,7 +20,6 @@ describe('component', () => {
|
||||||
increment() { this.count++; }
|
increment() { this.count++; }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: CounterComponent,
|
|
||||||
tag: 'counter',
|
tag: 'counter',
|
||||||
template: function(ctx: CounterComponent, cm: boolean) {
|
template: function(ctx: CounterComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -64,7 +63,6 @@ describe('component', () => {
|
||||||
describe('encapsulation', () => {
|
describe('encapsulation', () => {
|
||||||
class WrapperComponent {
|
class WrapperComponent {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: WrapperComponent,
|
|
||||||
tag: 'wrapper',
|
tag: 'wrapper',
|
||||||
template: function(ctx: WrapperComponent, cm: boolean) {
|
template: function(ctx: WrapperComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -80,7 +78,6 @@ describe('encapsulation', () => {
|
||||||
|
|
||||||
class EncapsulatedComponent {
|
class EncapsulatedComponent {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: EncapsulatedComponent,
|
|
||||||
tag: 'encapsulated',
|
tag: 'encapsulated',
|
||||||
template: function(ctx: EncapsulatedComponent, cm: boolean) {
|
template: function(ctx: EncapsulatedComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -99,7 +96,6 @@ describe('encapsulation', () => {
|
||||||
|
|
||||||
class LeafComponent {
|
class LeafComponent {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: LeafComponent,
|
|
||||||
tag: 'leaf',
|
tag: 'leaf',
|
||||||
template: function(ctx: LeafComponent, cm: boolean) {
|
template: function(ctx: LeafComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -129,7 +125,6 @@ describe('encapsulation', () => {
|
||||||
it('should encapsulate host and children with different attributes', () => {
|
it('should encapsulate host and children with different attributes', () => {
|
||||||
class WrapperComponentWith {
|
class WrapperComponentWith {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: WrapperComponent,
|
|
||||||
tag: 'wrapper',
|
tag: 'wrapper',
|
||||||
template: function(ctx: WrapperComponentWith, cm: boolean) {
|
template: function(ctx: WrapperComponentWith, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -147,7 +142,6 @@ describe('encapsulation', () => {
|
||||||
|
|
||||||
class LeafComponentwith {
|
class LeafComponentwith {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: LeafComponentwith,
|
|
||||||
tag: 'leaf',
|
tag: 'leaf',
|
||||||
template: function(ctx: LeafComponentwith, cm: boolean) {
|
template: function(ctx: LeafComponentwith, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
|
|
@ -151,9 +151,7 @@ describe('content projection', () => {
|
||||||
const Parent = createComponent('parent', function(ctx: {value: any}, cm: boolean) {
|
const Parent = createComponent('parent', function(ctx: {value: any}, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, Child);
|
E(0, Child);
|
||||||
{
|
{ C(2); }
|
||||||
C(2);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(2);
|
cR(2);
|
||||||
|
@ -244,9 +242,7 @@ describe('content projection', () => {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
m(0, pD());
|
m(0, pD());
|
||||||
E(1, 'div');
|
E(1, 'div');
|
||||||
{
|
{ C(2); }
|
||||||
C(2);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(2);
|
cR(2);
|
||||||
|
@ -301,9 +297,7 @@ describe('content projection', () => {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
m(0, pD());
|
m(0, pD());
|
||||||
E(1, 'div');
|
E(1, 'div');
|
||||||
{
|
{ C(2); }
|
||||||
C(2);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(2);
|
cR(2);
|
||||||
|
@ -398,9 +392,7 @@ describe('content projection', () => {
|
||||||
m(0, pD());
|
m(0, pD());
|
||||||
P(1, 0);
|
P(1, 0);
|
||||||
E(2, 'div');
|
E(2, 'div');
|
||||||
{
|
{ C(3); }
|
||||||
C(3);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(3);
|
cR(3);
|
||||||
|
@ -816,9 +808,7 @@ describe('content projection', () => {
|
||||||
const Parent = createComponent('parent', function(ctx: {value: any}, cm: boolean) {
|
const Parent = createComponent('parent', function(ctx: {value: any}, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, Child);
|
E(0, Child);
|
||||||
{
|
{ C(2, undefined, undefined, 'div'); }
|
||||||
C(2, undefined, undefined, 'div');
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(2);
|
cR(2);
|
||||||
|
|
|
@ -17,9 +17,7 @@ describe('JS control flow', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div');
|
E(0, 'div');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -67,9 +65,7 @@ describe('JS control flow', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div');
|
E(0, 'div');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -79,9 +75,7 @@ describe('JS control flow', () => {
|
||||||
{
|
{
|
||||||
if (cm1) {
|
if (cm1) {
|
||||||
E(0, 'span');
|
E(0, 'span');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -180,9 +174,7 @@ describe('JS control flow', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'ul');
|
E(0, 'ul');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -228,9 +220,7 @@ describe('JS control flow', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'ul');
|
E(0, 'ul');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -240,9 +230,7 @@ describe('JS control flow', () => {
|
||||||
{
|
{
|
||||||
if (cm1) {
|
if (cm1) {
|
||||||
E(0, 'li');
|
E(0, 'li');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -457,9 +445,7 @@ describe('JS control flow', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div');
|
E(0, 'div');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
@ -507,9 +493,7 @@ describe('JS for loop', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div');
|
E(0, 'div');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core';
|
import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||||
|
|
||||||
import {bloomAdd, bloomFindPossibleInjector} from '../../src/render3/di';
|
import {bloomAdd, bloomFindPossibleInjector} from '../../src/render3/di';
|
||||||
import {C, D, E, PublicFeature, T, V, b, b2, c, cR, cr, defineDirective, e, inject, injectElementRef, injectTemplateRef, injectViewContainerRef, t, v} from '../../src/render3/index';
|
import {C, D, E, PublicFeature, T, V, b, b2, cR, cr, defineDirective, e, inject, injectElementRef, injectTemplateRef, injectViewContainerRef, t, v} from '../../src/render3/index';
|
||||||
import {createLNode, createLView, enterView, getOrCreateNodeInjector, leaveView} from '../../src/render3/instructions';
|
import {createLNode, createLView, enterView, getOrCreateNodeInjector, leaveView} 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';
|
||||||
|
@ -21,7 +21,7 @@ describe('di', () => {
|
||||||
it('should create directive with no deps', () => {
|
it('should create directive with no deps', () => {
|
||||||
class Directive {
|
class Directive {
|
||||||
value: string = 'Created';
|
value: string = 'Created';
|
||||||
static ngDirectiveDef = defineDirective({type: Directive, factory: () => new Directive});
|
static ngDirectiveDef = defineDirective({factory: () => new Directive});
|
||||||
}
|
}
|
||||||
|
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
|
@ -41,23 +41,21 @@ describe('di', () => {
|
||||||
it('should create directive with inter view dependencies', () => {
|
it('should create directive with inter view dependencies', () => {
|
||||||
class DirectiveA {
|
class DirectiveA {
|
||||||
value: string = 'A';
|
value: string = 'A';
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: DirectiveA, factory: () => new DirectiveA, features: [PublicFeature]});
|
defineDirective({factory: () => new DirectiveA, features: [PublicFeature]});
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveB {
|
class DirectiveB {
|
||||||
value: string = 'B';
|
value: string = 'B';
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: DirectiveB, factory: () => new DirectiveB, features: [PublicFeature]});
|
defineDirective({factory: () => new DirectiveB, features: [PublicFeature]});
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveC {
|
class DirectiveC {
|
||||||
value: string;
|
value: string;
|
||||||
constructor(a: DirectiveA, b: DirectiveB) { this.value = a.value + b.value; }
|
constructor(a: DirectiveA, b: DirectiveB) { this.value = a.value + b.value; }
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: DirectiveC,
|
{factory: () => new DirectiveC(inject(DirectiveA), inject(DirectiveB))});
|
||||||
factory: () => new DirectiveC(inject(DirectiveA), inject(DirectiveB))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
|
@ -84,11 +82,8 @@ describe('di', () => {
|
||||||
constructor(public elementRef: ElementRef) {
|
constructor(public elementRef: ElementRef) {
|
||||||
this.value = (elementRef.constructor as any).name;
|
this.value = (elementRef.constructor as any).name;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: Directive,
|
{factory: () => new Directive(injectElementRef()), features: [PublicFeature]});
|
||||||
factory: () => new Directive(injectElementRef()),
|
|
||||||
features: [PublicFeature]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveSameInstance {
|
class DirectiveSameInstance {
|
||||||
|
@ -96,10 +91,8 @@ describe('di', () => {
|
||||||
constructor(elementRef: ElementRef, directive: Directive) {
|
constructor(elementRef: ElementRef, directive: Directive) {
|
||||||
this.value = elementRef === directive.elementRef;
|
this.value = elementRef === directive.elementRef;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: DirectiveSameInstance,
|
{factory: () => new DirectiveSameInstance(injectElementRef(), inject(Directive))});
|
||||||
factory: () => new DirectiveSameInstance(injectElementRef(), inject(Directive))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
|
@ -122,11 +115,8 @@ describe('di', () => {
|
||||||
constructor(public templateRef: TemplateRef<any>) {
|
constructor(public templateRef: TemplateRef<any>) {
|
||||||
this.value = (templateRef.constructor as any).name;
|
this.value = (templateRef.constructor as any).name;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: Directive,
|
{factory: () => new Directive(injectTemplateRef()), features: [PublicFeature]});
|
||||||
factory: () => new Directive(injectTemplateRef()),
|
|
||||||
features: [PublicFeature]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveSameInstance {
|
class DirectiveSameInstance {
|
||||||
|
@ -134,10 +124,8 @@ describe('di', () => {
|
||||||
constructor(templateRef: TemplateRef<any>, directive: Directive) {
|
constructor(templateRef: TemplateRef<any>, directive: Directive) {
|
||||||
this.value = templateRef === directive.templateRef;
|
this.value = templateRef === directive.templateRef;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: DirectiveSameInstance,
|
{factory: () => new DirectiveSameInstance(injectTemplateRef(), inject(Directive))});
|
||||||
factory: () => new DirectiveSameInstance(injectTemplateRef(), inject(Directive))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,11 +148,8 @@ describe('di', () => {
|
||||||
constructor(public viewContainerRef: ViewContainerRef) {
|
constructor(public viewContainerRef: ViewContainerRef) {
|
||||||
this.value = (viewContainerRef.constructor as any).name;
|
this.value = (viewContainerRef.constructor as any).name;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: Directive,
|
{factory: () => new Directive(injectViewContainerRef()), features: [PublicFeature]});
|
||||||
factory: () => new Directive(injectViewContainerRef()),
|
|
||||||
features: [PublicFeature]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveSameInstance {
|
class DirectiveSameInstance {
|
||||||
|
@ -173,7 +158,6 @@ describe('di', () => {
|
||||||
this.value = viewContainerRef === directive.viewContainerRef;
|
this.value = viewContainerRef === directive.viewContainerRef;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: DirectiveSameInstance,
|
|
||||||
factory: () => new DirectiveSameInstance(injectViewContainerRef(), inject(Directive))
|
factory: () => new DirectiveSameInstance(injectViewContainerRef(), inject(Directive))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -235,11 +219,8 @@ describe('di', () => {
|
||||||
|
|
||||||
it('should inject from parent view', () => {
|
it('should inject from parent view', () => {
|
||||||
class ParentDirective {
|
class ParentDirective {
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef =
|
||||||
type: ParentDirective,
|
defineDirective({factory: () => new ParentDirective(), features: [PublicFeature]});
|
||||||
factory: () => new ParentDirective(),
|
|
||||||
features: [PublicFeature]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChildDirective {
|
class ChildDirective {
|
||||||
|
@ -248,7 +229,6 @@ describe('di', () => {
|
||||||
this.value = (parent.constructor as any).name;
|
this.value = (parent.constructor as any).name;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: ChildDirective,
|
|
||||||
factory: () => new ChildDirective(inject(ParentDirective)),
|
factory: () => new ChildDirective(inject(ParentDirective)),
|
||||||
features: [PublicFeature]
|
features: [PublicFeature]
|
||||||
});
|
});
|
||||||
|
@ -259,18 +239,14 @@ describe('di', () => {
|
||||||
constructor(parent: ParentDirective, child: ChildDirective) {
|
constructor(parent: ParentDirective, child: ChildDirective) {
|
||||||
this.value = parent === child.parent;
|
this.value = parent === child.parent;
|
||||||
}
|
}
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: Child2Directive,
|
{factory: () => new Child2Directive(inject(ParentDirective), inject(ChildDirective))});
|
||||||
factory: () => new Child2Directive(inject(ParentDirective), inject(ChildDirective))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div', null, [ParentDirective]);
|
E(0, 'div', null, [ParentDirective]);
|
||||||
{
|
{ C(2); }
|
||||||
C(2);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(2);
|
cR(2);
|
||||||
|
|
|
@ -20,7 +20,6 @@ describe('directive', () => {
|
||||||
class Directive {
|
class Directive {
|
||||||
klass = 'foo';
|
klass = 'foo';
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: Directive,
|
|
||||||
factory: () => directiveInstance = new Directive,
|
factory: () => directiveInstance = new Directive,
|
||||||
refresh: (directiveIndex: number, elementIndex: number) => {
|
refresh: (directiveIndex: number, elementIndex: number) => {
|
||||||
p(elementIndex, 'className', b(D<Directive>(directiveIndex).klass));
|
p(elementIndex, 'className', b(D<Directive>(directiveIndex).klass));
|
||||||
|
|
|
@ -42,12 +42,8 @@ describe('exports', () => {
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
name = 'Nancy';
|
name = 'Nancy';
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef =
|
||||||
type: MyComponent,
|
defineComponent({tag: 'comp', template: function() {}, factory: () => new MyComponent});
|
||||||
tag: 'comp',
|
|
||||||
template: function() {},
|
|
||||||
factory: () => new MyComponent
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(renderToHtml(Template, {})).toEqual('<comp></comp>Nancy');
|
expect(renderToHtml(Template, {})).toEqual('<comp></comp>Nancy');
|
||||||
|
@ -59,19 +55,14 @@ describe('exports', () => {
|
||||||
let myDir: MyDir;
|
let myDir: MyDir;
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
constructor() { myComponent = this; }
|
constructor() { myComponent = this; }
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef =
|
||||||
type: MyComponent,
|
defineComponent({tag: 'comp', template: function() {}, factory: () => new MyComponent});
|
||||||
tag: 'comp',
|
|
||||||
template: function() {},
|
|
||||||
factory: () => new MyComponent
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyDir {
|
class MyDir {
|
||||||
myDir: MyComponent;
|
myDir: MyComponent;
|
||||||
constructor() { myDir = this; }
|
constructor() { myDir = this; }
|
||||||
static ngDirectiveDef =
|
static ngDirectiveDef = defineDirective({factory: () => new MyDir, inputs: {myDir: 'myDir'}});
|
||||||
defineDirective({type: MyDir, factory: () => new MyDir, inputs: {myDir: 'myDir'}});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <comp #myComp></comp> <div [myDir]="myComp"></div> */
|
/** <comp #myComp></comp> <div [myDir]="myComp"></div> */
|
||||||
|
@ -103,7 +94,7 @@ describe('exports', () => {
|
||||||
|
|
||||||
class SomeDir {
|
class SomeDir {
|
||||||
name = 'Drew';
|
name = 'Drew';
|
||||||
static ngDirectiveDef = defineDirective({type: SomeDir, factory: () => new SomeDir});
|
static ngDirectiveDef = defineDirective({factory: () => new SomeDir});
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(renderToHtml(Template, {})).toEqual('<div></div>Drew');
|
expect(renderToHtml(Template, {})).toEqual('<div></div>Drew');
|
||||||
|
@ -184,7 +175,6 @@ describe('exports', () => {
|
||||||
constructor() { myComponent = this; }
|
constructor() { myComponent = this; }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: MyComponent,
|
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
template: function(ctx: MyComponent, cm: boolean) {},
|
template: function(ctx: MyComponent, cm: boolean) {},
|
||||||
factory: () => new MyComponent
|
factory: () => new MyComponent
|
||||||
|
@ -197,7 +187,7 @@ describe('exports', () => {
|
||||||
constructor() { myDir = this; }
|
constructor() { myDir = this; }
|
||||||
|
|
||||||
static ngDirectiveDef =
|
static ngDirectiveDef =
|
||||||
defineDirective({type: MyDir, factory: () => new MyDir, inputs: {myDir: 'myDir'}});
|
defineDirective({factory: () => new MyDir, inputs: {myDir: 'myDir'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <div [myDir]="myComp"></div><comp #myComp></comp> */
|
/** <div [myDir]="myComp"></div><comp #myComp></comp> */
|
||||||
|
@ -240,12 +230,8 @@ describe('exports', () => {
|
||||||
|
|
||||||
constructor() { myComponent = this; }
|
constructor() { myComponent = this; }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef =
|
||||||
type: MyComponent,
|
defineComponent({tag: 'comp', template: function() {}, factory: () => new MyComponent});
|
||||||
tag: 'comp',
|
|
||||||
template: function() {},
|
|
||||||
factory: () => new MyComponent
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
expect(renderToHtml(Template, {})).toEqual('oneNancy<comp></comp><input value="one">');
|
expect(renderToHtml(Template, {})).toEqual('oneNancy<comp></comp><input value="one">');
|
||||||
});
|
});
|
||||||
|
@ -254,9 +240,7 @@ describe('exports', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div');
|
E(0, 'div');
|
||||||
{
|
{ C(1); }
|
||||||
C(1);
|
|
||||||
}
|
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
cR(1);
|
cR(1);
|
||||||
|
|
|
@ -210,7 +210,6 @@ describe('render3 integration test', () => {
|
||||||
value = ' one';
|
value = ' one';
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: TodoComponent,
|
|
||||||
tag: 'todo',
|
tag: 'todo',
|
||||||
template: function TodoTemplate(ctx: any, cm: boolean) {
|
template: function TodoTemplate(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -280,7 +279,6 @@ describe('render3 integration test', () => {
|
||||||
class TodoComponentHostBinding {
|
class TodoComponentHostBinding {
|
||||||
title = 'one';
|
title = 'one';
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: TodoComponentHostBinding,
|
|
||||||
tag: 'todo',
|
tag: 'todo',
|
||||||
template: function TodoComponentHostBindingTemplate(
|
template: function TodoComponentHostBindingTemplate(
|
||||||
ctx: TodoComponentHostBinding, cm: boolean) {
|
ctx: TodoComponentHostBinding, cm: boolean) {
|
||||||
|
@ -316,7 +314,6 @@ describe('render3 integration test', () => {
|
||||||
class MyComp {
|
class MyComp {
|
||||||
name = 'Bess';
|
name = 'Bess';
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: MyComp,
|
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
template: function MyCompTemplate(ctx: any, cm: boolean) {
|
template: function MyCompTemplate(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -351,7 +348,6 @@ describe('render3 integration test', () => {
|
||||||
class MyComp {
|
class MyComp {
|
||||||
condition: boolean;
|
condition: boolean;
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: MyComp,
|
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
template: function MyCompTemplate(ctx: any, cm: boolean) {
|
template: function MyCompTemplate(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
|
|
@ -38,7 +38,6 @@ describe('lifecycles', () => {
|
||||||
ngOnInit() { events.push(`${name}${this.val}`); }
|
ngOnInit() { events.push(`${name}${this.val}`); }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: Component,
|
|
||||||
tag: name,
|
tag: name,
|
||||||
factory: () => new Component(),
|
factory: () => new Component(),
|
||||||
hostBindings: function(directiveIndex: number, elementIndex: number):
|
hostBindings: function(directiveIndex: number, elementIndex: number):
|
||||||
|
@ -271,7 +270,6 @@ describe('lifecycles', () => {
|
||||||
ngOnInit() { allEvents.push('ngOnInit ' + name); }
|
ngOnInit() { allEvents.push('ngOnInit ' + name); }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: Component,
|
|
||||||
tag: name,
|
tag: name,
|
||||||
factory: () => new Component(),
|
factory: () => new Component(),
|
||||||
hostBindings: function(
|
hostBindings: function(
|
||||||
|
@ -363,7 +361,6 @@ describe('lifecycles', () => {
|
||||||
ngAfterViewChecked() { allEvents.push(`${name}${this.val} check`); }
|
ngAfterViewChecked() { allEvents.push(`${name}${this.val} check`); }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: Component,
|
|
||||||
tag: name,
|
tag: name,
|
||||||
factory: () => new Component(),
|
factory: () => new Component(),
|
||||||
refresh: (directiveIndex: number, elementIndex: number) => {
|
refresh: (directiveIndex: number, elementIndex: number) => {
|
||||||
|
@ -405,7 +402,6 @@ describe('lifecycles', () => {
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
C(0);
|
C(0);
|
||||||
c();
|
|
||||||
}
|
}
|
||||||
cR(0);
|
cR(0);
|
||||||
{
|
{
|
||||||
|
@ -492,7 +488,6 @@ describe('lifecycles', () => {
|
||||||
E(0, Comp);
|
E(0, Comp);
|
||||||
e();
|
e();
|
||||||
C(2);
|
C(2);
|
||||||
c();
|
|
||||||
E(3, Comp);
|
E(3, Comp);
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
|
@ -536,7 +531,6 @@ describe('lifecycles', () => {
|
||||||
E(0, Parent);
|
E(0, Parent);
|
||||||
e();
|
e();
|
||||||
C(2);
|
C(2);
|
||||||
c();
|
|
||||||
E(3, Parent);
|
E(3, Parent);
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
|
@ -621,7 +615,6 @@ describe('lifecycles', () => {
|
||||||
E(0, Parent);
|
E(0, Parent);
|
||||||
e();
|
e();
|
||||||
C(2);
|
C(2);
|
||||||
c();
|
|
||||||
E(3, Parent);
|
E(3, Parent);
|
||||||
e();
|
e();
|
||||||
}
|
}
|
||||||
|
@ -674,7 +667,6 @@ describe('lifecycles', () => {
|
||||||
ngOnDestroy() { events.push(`${name}${this.val}`); }
|
ngOnDestroy() { events.push(`${name}${this.val}`); }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: Component,
|
|
||||||
tag: name,
|
tag: name,
|
||||||
factory: () => {
|
factory: () => {
|
||||||
const comp = new Component();
|
const comp = new Component();
|
||||||
|
|
|
@ -21,7 +21,6 @@ describe('event listeners', () => {
|
||||||
onClick() { this.counter++; }
|
onClick() { this.counter++; }
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: MyComp,
|
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
/** <button (click)="onClick()"> Click me </button> */
|
/** <button (click)="onClick()"> Click me </button> */
|
||||||
template: function CompTemplate(ctx: any, cm: boolean) {
|
template: function CompTemplate(ctx: any, cm: boolean) {
|
||||||
|
|
|
@ -21,7 +21,6 @@ describe('outputs', () => {
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
tag: 'button-toggle',
|
tag: 'button-toggle',
|
||||||
type: ButtonToggle,
|
|
||||||
template: function(ctx: any, cm: boolean) {},
|
template: function(ctx: any, cm: boolean) {},
|
||||||
factory: () => buttonToggle = new ButtonToggle(),
|
factory: () => buttonToggle = new ButtonToggle(),
|
||||||
outputs: {change: 'change', resetStream: 'reset'}
|
outputs: {change: 'change', resetStream: 'reset'}
|
||||||
|
@ -33,11 +32,8 @@ describe('outputs', () => {
|
||||||
class OtherDir {
|
class OtherDir {
|
||||||
changeStream = new EventEmitter();
|
changeStream = new EventEmitter();
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective(
|
||||||
type: OtherDir,
|
{factory: () => otherDir = new OtherDir, outputs: {changeStream: 'change'}});
|
||||||
factory: () => otherDir = new OtherDir,
|
|
||||||
outputs: {changeStream: 'change'}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should call component output function when event is emitted', () => {
|
it('should call component output function when event is emitted', () => {
|
||||||
|
@ -217,7 +213,6 @@ describe('outputs', () => {
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
tag: 'destroy-comp',
|
tag: 'destroy-comp',
|
||||||
type: DestroyComp,
|
|
||||||
template: function(ctx: any, cm: boolean) {},
|
template: function(ctx: any, cm: boolean) {},
|
||||||
factory: () => {
|
factory: () => {
|
||||||
destroyComp = new DestroyComp();
|
destroyComp = new DestroyComp();
|
||||||
|
@ -296,8 +291,8 @@ describe('outputs', () => {
|
||||||
class MyButton {
|
class MyButton {
|
||||||
click = new EventEmitter();
|
click = new EventEmitter();
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: MyButton, factory: () => buttonDir = new MyButton, outputs: {click: 'click'}});
|
defineDirective({factory: () => buttonDir = new MyButton, outputs: {click: 'click'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
function Template(ctx: any, cm: boolean) {
|
function Template(ctx: any, cm: boolean) {
|
||||||
|
@ -349,8 +344,8 @@ describe('outputs', () => {
|
||||||
class OtherDir {
|
class OtherDir {
|
||||||
change: boolean;
|
change: boolean;
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: OtherDir, factory: () => otherDir = new OtherDir, inputs: {change: 'change'}});
|
defineDirective({factory: () => otherDir = new OtherDir, inputs: {change: 'change'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** <button-toggle (change)="onChange()" otherDir [change]="change"></button-toggle> */
|
/** <button-toggle (change)="onChange()" otherDir [change]="change"></button-toggle> */
|
||||||
|
|
|
@ -69,8 +69,8 @@ describe('elementProperty', () => {
|
||||||
class MyButton {
|
class MyButton {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: MyButton, factory: () => button = new MyButton(), inputs: {disabled: 'disabled'}});
|
defineDirective({factory: () => button = new MyButton(), inputs: {disabled: 'disabled'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
class OtherDir {
|
class OtherDir {
|
||||||
|
@ -78,7 +78,6 @@ describe('elementProperty', () => {
|
||||||
clickStream = new EventEmitter();
|
clickStream = new EventEmitter();
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: OtherDir,
|
|
||||||
factory: () => otherDir = new OtherDir(),
|
factory: () => otherDir = new OtherDir(),
|
||||||
inputs: {id: 'id'},
|
inputs: {id: 'id'},
|
||||||
outputs: {clickStream: 'click'}
|
outputs: {clickStream: 'click'}
|
||||||
|
@ -142,7 +141,6 @@ describe('elementProperty', () => {
|
||||||
|
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
type: Comp,
|
|
||||||
template: function(ctx: any, cm: boolean) {},
|
template: function(ctx: any, cm: boolean) {},
|
||||||
factory: () => comp = new Comp(),
|
factory: () => comp = new Comp(),
|
||||||
inputs: {id: 'id'}
|
inputs: {id: 'id'}
|
||||||
|
@ -174,7 +172,6 @@ describe('elementProperty', () => {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: OtherDisabledDir,
|
|
||||||
factory: () => otherDisabledDir = new OtherDisabledDir(),
|
factory: () => otherDisabledDir = new OtherDisabledDir(),
|
||||||
inputs: {disabled: 'disabled'}
|
inputs: {disabled: 'disabled'}
|
||||||
});
|
});
|
||||||
|
@ -234,8 +231,8 @@ describe('elementProperty', () => {
|
||||||
class IdDir {
|
class IdDir {
|
||||||
idNumber: number;
|
idNumber: number;
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: IdDir, factory: () => idDir = new IdDir(), inputs: {idNumber: 'id'}});
|
defineDirective({factory: () => idDir = new IdDir(), inputs: {idNumber: 'id'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,7 +294,6 @@ describe('elementProperty', () => {
|
||||||
changeStream = new EventEmitter();
|
changeStream = new EventEmitter();
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: MyDir,
|
|
||||||
factory: () => myDir = new MyDir(),
|
factory: () => myDir = new MyDir(),
|
||||||
inputs: {role: 'role', direction: 'dir'},
|
inputs: {role: 'role', direction: 'dir'},
|
||||||
outputs: {changeStream: 'change'}
|
outputs: {changeStream: 'change'}
|
||||||
|
@ -308,8 +304,8 @@ describe('elementProperty', () => {
|
||||||
class MyDirB {
|
class MyDirB {
|
||||||
roleB: string;
|
roleB: string;
|
||||||
|
|
||||||
static ngDirectiveDef = defineDirective(
|
static ngDirectiveDef =
|
||||||
{type: MyDirB, factory: () => dirB = new MyDirB(), inputs: {roleB: 'role'}});
|
defineDirective({factory: () => dirB = new MyDirB(), inputs: {roleB: 'role'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should set input property based on attribute if existing', () => {
|
it('should set input property based on attribute if existing', () => {
|
||||||
|
@ -472,7 +468,6 @@ describe('elementProperty', () => {
|
||||||
class Comp {
|
class Comp {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
tag: 'comp',
|
tag: 'comp',
|
||||||
type: Comp,
|
|
||||||
template: function(ctx: any, cm: boolean) {
|
template: function(ctx: any, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
E(0, 'div', ['role', 'button'], [MyDir]);
|
E(0, 'div', ['role', 'button'], [MyDir]);
|
||||||
|
|
|
@ -7,11 +7,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
|
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
|
||||||
import {DirectiveDefArgs} from '../../src/render3/definition_interfaces';
|
|
||||||
import {ComponentTemplate, ComponentType, DirectiveType, PublicFeature, defineComponent, defineDirective, renderComponent as _renderComponent} from '../../src/render3/index';
|
import {ComponentTemplate, ComponentType, DirectiveType, PublicFeature, defineComponent, defineDirective, renderComponent as _renderComponent} from '../../src/render3/index';
|
||||||
import {NG_HOST_SYMBOL, createLNode, createLView, renderTemplate} from '../../src/render3/instructions';
|
import {NG_HOST_SYMBOL, createLNode, createLView, renderTemplate} from '../../src/render3/instructions';
|
||||||
|
import {DirectiveDefArgs} from '../../src/render3/interfaces/definition';
|
||||||
import {LElementNode, LNodeFlags} from '../../src/render3/interfaces/node';
|
import {LElementNode, LNodeFlags} from '../../src/render3/interfaces/node';
|
||||||
import {RElement, RText, Renderer3, RendererFactory3, domRendererFactory3} from '../../src/render3/interfaces/renderer';
|
import {RElement, RText, Renderer3, RendererFactory3, domRendererFactory3} from '../../src/render3/interfaces/renderer';
|
||||||
|
|
||||||
import {getRendererFactory2} from './imported_renderer2';
|
import {getRendererFactory2} from './imported_renderer2';
|
||||||
|
|
||||||
export const document = ((global || window) as any).document;
|
export const document = ((global || window) as any).document;
|
||||||
|
@ -80,20 +82,14 @@ export function createComponent(
|
||||||
name: string, template: ComponentTemplate<any>): ComponentType<any> {
|
name: string, template: ComponentTemplate<any>): ComponentType<any> {
|
||||||
return class Component {
|
return class Component {
|
||||||
value: any;
|
value: any;
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent(
|
||||||
type: Component,
|
{tag: name, factory: () => new Component, template: template, features: [PublicFeature]});
|
||||||
tag: name,
|
|
||||||
factory: () => new Component,
|
|
||||||
template: template,
|
|
||||||
features: [PublicFeature]
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDirective({exportAs}: {exportAs?: string} = {}): DirectiveType<any> {
|
export function createDirective({exportAs}: {exportAs?: string} = {}): DirectiveType<any> {
|
||||||
return class Directive {
|
return class Directive {
|
||||||
static ngDirectiveDef = defineDirective({
|
static ngDirectiveDef = defineDirective({
|
||||||
type: Directive,
|
|
||||||
factory: () => new Directive(),
|
factory: () => new Directive(),
|
||||||
features: [PublicFeature],
|
features: [PublicFeature],
|
||||||
exportAs: exportAs,
|
exportAs: exportAs,
|
||||||
|
|
|
@ -29,7 +29,6 @@ describe('renderer factory lifecycle', () => {
|
||||||
|
|
||||||
class SomeComponent {
|
class SomeComponent {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: SomeComponent,
|
|
||||||
tag: 'some-component',
|
tag: 'some-component',
|
||||||
template: function(ctx: SomeComponent, cm: boolean) {
|
template: function(ctx: SomeComponent, cm: boolean) {
|
||||||
logs.push('component');
|
logs.push('component');
|
||||||
|
@ -43,7 +42,6 @@ describe('renderer factory lifecycle', () => {
|
||||||
|
|
||||||
class SomeComponentWhichThrows {
|
class SomeComponentWhichThrows {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: SomeComponentWhichThrows,
|
|
||||||
tag: 'some-component-with-Error',
|
tag: 'some-component-with-Error',
|
||||||
template: function(ctx: SomeComponentWhichThrows, cm: boolean) {
|
template: function(ctx: SomeComponentWhichThrows, cm: boolean) {
|
||||||
throw(new Error('SomeComponentWhichThrows threw'));
|
throw(new Error('SomeComponentWhichThrows threw'));
|
||||||
|
@ -122,7 +120,6 @@ describe('animation renderer factory', () => {
|
||||||
|
|
||||||
class SomeComponent {
|
class SomeComponent {
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: SomeComponent,
|
|
||||||
tag: 'some-component',
|
tag: 'some-component',
|
||||||
template: function(ctx: SomeComponent, cm: boolean) {
|
template: function(ctx: SomeComponent, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
@ -139,7 +136,6 @@ describe('animation renderer factory', () => {
|
||||||
eventLogs.push(`${event.fromState ? event.fromState : event.toState} - ${event.phaseName}`);
|
eventLogs.push(`${event.fromState ? event.fromState : event.toState} - ${event.phaseName}`);
|
||||||
}
|
}
|
||||||
static ngComponentDef = defineComponent({
|
static ngComponentDef = defineComponent({
|
||||||
type: SomeComponentWithAnimation,
|
|
||||||
tag: 'some-component',
|
tag: 'some-component',
|
||||||
template: function(ctx: SomeComponentWithAnimation, cm: boolean) {
|
template: function(ctx: SomeComponentWithAnimation, cm: boolean) {
|
||||||
if (cm) {
|
if (cm) {
|
||||||
|
|
Loading…
Reference in New Issue