| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-03 11:42:48 +01:00
										 |  |  | import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util'; | 
					
						
							| 
									
										
										
										
											2018-01-09 16:43:12 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 15:54:16 -07:00
										 |  |  | import {Injector} from '../../src/di/injector'; | 
					
						
							| 
									
										
										
										
											2018-03-06 11:58:08 -08:00
										 |  |  | import {CreateComponentOptions} from '../../src/render3/component'; | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  | import {extractDirectiveDef, extractPipeDef} from '../../src/render3/definition'; | 
					
						
							| 
									
										
										
										
											2018-06-18 08:05:06 -07:00
										 |  |  | import {ComponentTemplate, ComponentType, DirectiveDefInternal, DirectiveType, PublicFeature, RenderFlags, defineComponent, defineDirective, renderComponent as _renderComponent, tick} from '../../src/render3/index'; | 
					
						
							| 
									
										
										
										
											2018-03-20 19:06:49 -07:00
										 |  |  | import {NG_HOST_SYMBOL, renderTemplate} from '../../src/render3/instructions'; | 
					
						
							| 
									
										
										
										
											2018-06-26 10:43:06 -07:00
										 |  |  | import {DirectiveDefList, DirectiveDefListOrFactory, DirectiveTypesOrFactory, PipeDefInternal, PipeDefList, PipeDefListOrFactory, PipeTypesOrFactory} from '../../src/render3/interfaces/definition'; | 
					
						
							| 
									
										
										
										
											2018-03-20 19:06:49 -07:00
										 |  |  | import {LElementNode} from '../../src/render3/interfaces/node'; | 
					
						
							| 
									
										
										
										
											2018-01-09 18:38:17 -08:00
										 |  |  | import {RElement, RText, Renderer3, RendererFactory3, domRendererFactory3} from '../../src/render3/interfaces/renderer'; | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  | import {Sanitizer} from '../../src/sanitization/security'; | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  | import {Type} from '../../src/type'; | 
					
						
							| 
									
										
										
										
											2018-01-09 16:43:12 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  | import {getRendererFactory2} from './imported_renderer2'; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | export abstract class BaseFixture { | 
					
						
							|  |  |  |   hostElement: HTMLElement; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor() { | 
					
						
							|  |  |  |     this.hostElement = document.createElement('div'); | 
					
						
							|  |  |  |     this.hostElement.setAttribute('fixture', 'mark'); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Current state of rendered HTML. | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 |  |  |   get html(): string { return toHtml(this.hostElement as any as Element); } | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  | function noop() {} | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Fixture for testing template functions in a convenient way. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This fixture allows: | 
					
						
							|  |  |  |  * - specifying the creation block and update block as two separate functions, | 
					
						
							|  |  |  |  * - maintaining the template state between invocations, | 
					
						
							|  |  |  |  * - access to the render `html`. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | export class TemplateFixture extends BaseFixture { | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |   hostNode: LElementNode; | 
					
						
							| 
									
										
										
										
											2018-04-05 10:29:47 +02:00
										 |  |  |   private _directiveDefs: DirectiveDefList|null; | 
					
						
							|  |  |  |   private _pipeDefs: PipeDefList|null; | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |   private _sanitizer: Sanitizer|null; | 
					
						
							| 
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 |  |  |   private _rendererFactory: RendererFactory3; | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * @param createBlock Instructions which go into the creation block: | 
					
						
							| 
									
										
										
										
											2018-05-13 21:01:37 +02:00
										 |  |  |    *          `if (rf & RenderFlags.Create) { __here__ }`. | 
					
						
							|  |  |  |    * @param updateBlock Optional instructions which go into the update block: | 
					
						
							|  |  |  |    *          `if (rf & RenderFlags.Update) { __here__ }`. | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2018-04-05 10:29:47 +02:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       private createBlock: () => void, private updateBlock: () => void = noop, | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |       directives?: DirectiveTypesOrFactory|null, pipes?: PipeTypesOrFactory|null, | 
					
						
							| 
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 |  |  |       sanitizer?: Sanitizer|null, rendererFactory?: RendererFactory3) { | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  |     super(); | 
					
						
							| 
									
										
										
										
											2018-04-05 10:29:47 +02:00
										 |  |  |     this._directiveDefs = toDefs(directives, extractDirectiveDef); | 
					
						
							|  |  |  |     this._pipeDefs = toDefs(pipes, extractPipeDef); | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |     this._sanitizer = sanitizer || null; | 
					
						
							| 
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 |  |  |     this._rendererFactory = rendererFactory || domRendererFactory3; | 
					
						
							| 
									
										
										
										
											2018-04-10 20:57:09 -07:00
										 |  |  |     this.hostNode = renderTemplate(this.hostElement, (rf: RenderFlags, ctx: any) => { | 
					
						
							|  |  |  |       if (rf & RenderFlags.Create) { | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |         this.createBlock(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-04-10 20:57:09 -07:00
										 |  |  |       if (rf & RenderFlags.Update) { | 
					
						
							|  |  |  |         this.updateBlock(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 |  |  |     }, null !, this._rendererFactory, null, this._directiveDefs, this._pipeDefs, sanitizer); | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Update the existing template | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * @param updateBlock Optional update block. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   update(updateBlock?: () => void): void { | 
					
						
							|  |  |  |     renderTemplate( | 
					
						
							| 
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 |  |  |         this.hostNode.native, updateBlock || this.updateBlock, null !, this._rendererFactory, | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |         this.hostNode, this._directiveDefs, this._pipeDefs, this._sanitizer); | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Fixture for testing Components in a convenient way. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export class ComponentFixture<T> extends BaseFixture { | 
					
						
							|  |  |  |   component: T; | 
					
						
							|  |  |  |   requestAnimationFrame: {(fn: () => void): void; flush(): void; queue: (() => void)[];}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |   constructor( | 
					
						
							|  |  |  |       private componentType: ComponentType<T>, | 
					
						
							| 
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 |  |  |       opts: {injector?: Injector, sanitizer?: Sanitizer, rendererFactory?: RendererFactory3} = {}) { | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  |     super(); | 
					
						
							|  |  |  |     this.requestAnimationFrame = function(fn: () => void) { | 
					
						
							|  |  |  |       requestAnimationFrame.queue.push(fn); | 
					
						
							|  |  |  |     } as any; | 
					
						
							|  |  |  |     this.requestAnimationFrame.queue = []; | 
					
						
							|  |  |  |     this.requestAnimationFrame.flush = function() { | 
					
						
							|  |  |  |       while (requestAnimationFrame.queue.length) { | 
					
						
							|  |  |  |         requestAnimationFrame.queue.shift() !(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |     this.component = _renderComponent(componentType, { | 
					
						
							|  |  |  |       host: this.hostElement, | 
					
						
							|  |  |  |       scheduler: this.requestAnimationFrame, | 
					
						
							|  |  |  |       injector: opts.injector, | 
					
						
							| 
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 |  |  |       sanitizer: opts.sanitizer, | 
					
						
							|  |  |  |       rendererFactory: opts.rendererFactory || domRendererFactory3 | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   update(): void { | 
					
						
							|  |  |  |     tick(this.component); | 
					
						
							|  |  |  |     this.requestAnimationFrame.flush(); | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // The methods below use global state and we should stop using them.
 | 
					
						
							|  |  |  | // Fixtures above are preferred way of testing Components and Templates
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2018-03-01 17:14:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 16:49:39 -07:00
										 |  |  | export const document = ((typeof global == 'object' && global || window) as any).document; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | export let containerEl: HTMLElement = null !; | 
					
						
							| 
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 |  |  | let host: LElementNode|null; | 
					
						
							| 
									
										
										
										
											2017-12-27 10:54:19 -08:00
										 |  |  | const isRenderer2 = | 
					
						
							|  |  |  |     typeof process == 'object' && process.argv[3] && process.argv[3] === '--r=renderer2'; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | // tslint:disable-next-line:no-console
 | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  | console.log(`Running tests with ${!isRenderer2 ? 'document' : 'Renderer2'} renderer...`); | 
					
						
							|  |  |  | const testRendererFactory: RendererFactory3 = | 
					
						
							|  |  |  |     isRenderer2 ? getRendererFactory2(document) : domRendererFactory3; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const requestAnimationFrame: | 
					
						
							|  |  |  |     {(fn: () => void): void; flush(): void; queue: (() => void)[];} = function(fn: () => void) { | 
					
						
							|  |  |  |       requestAnimationFrame.queue.push(fn); | 
					
						
							|  |  |  |     } as any; | 
					
						
							|  |  |  | requestAnimationFrame.flush = function() { | 
					
						
							|  |  |  |   while (requestAnimationFrame.queue.length) { | 
					
						
							|  |  |  |     requestAnimationFrame.queue.shift() !(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function resetDOM() { | 
					
						
							|  |  |  |   requestAnimationFrame.queue = []; | 
					
						
							| 
									
										
										
										
											2017-12-15 17:50:54 +01:00
										 |  |  |   if (containerEl) { | 
					
						
							| 
									
										
										
										
											2018-01-03 10:45:09 +01:00
										 |  |  |     try { | 
					
						
							|  |  |  |       document.body.removeChild(containerEl); | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-12-15 17:50:54 +01:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   containerEl = document.createElement('div'); | 
					
						
							|  |  |  |   containerEl.setAttribute('host', ''); | 
					
						
							| 
									
										
										
										
											2017-12-15 17:50:54 +01:00
										 |  |  |   document.body.appendChild(containerEl); | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  |   host = null; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   // TODO: assert that the global state is clean (e.g. ngData, previousOrParentNode, etc)
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @deprecated use `TemplateFixture` or `ComponentFixture` | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  | export function renderToHtml( | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  |     template: ComponentTemplate<any>, ctx: any, directives?: DirectiveTypesOrFactory | null, | 
					
						
							|  |  |  |     pipes?: PipeTypesOrFactory | null, providedRendererFactory?: RendererFactory3 | null) { | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  |   host = renderTemplate( | 
					
						
							| 
									
										
										
										
											2018-03-27 15:53:48 -07:00
										 |  |  |       containerEl, template, ctx, providedRendererFactory || testRendererFactory, host, | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  |       toDefs(directives, extractDirectiveDef), toDefs(pipes, extractPipeDef)); | 
					
						
							| 
									
										
										
										
											2017-12-11 16:30:46 +01:00
										 |  |  |   return toHtml(containerEl); | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  | function toDefs( | 
					
						
							|  |  |  |     types: DirectiveTypesOrFactory | undefined | null, | 
					
						
							| 
									
										
										
										
											2018-05-31 15:50:02 -07:00
										 |  |  |     mapFn: (type: Type<any>) => DirectiveDefInternal<any>): DirectiveDefList|null; | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  | function toDefs( | 
					
						
							|  |  |  |     types: PipeTypesOrFactory | undefined | null, | 
					
						
							| 
									
										
										
										
											2018-06-26 10:43:06 -07:00
										 |  |  |     mapFn: (type: Type<any>) => PipeDefInternal<any>): PipeDefList|null; | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  | function toDefs( | 
					
						
							|  |  |  |     types: PipeTypesOrFactory | DirectiveTypesOrFactory | undefined | null, | 
					
						
							| 
									
										
										
										
											2018-06-26 10:43:06 -07:00
										 |  |  |     mapFn: (type: Type<any>) => PipeDefInternal<any>| DirectiveDefInternal<any>): any { | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  |   if (!types) return null; | 
					
						
							|  |  |  |   if (typeof types == 'function') { | 
					
						
							|  |  |  |     types = types(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return types.map(mapFn); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | beforeEach(resetDOM); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @deprecated use `TemplateFixture` or `ComponentFixture` | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-03-06 10:13:49 -08:00
										 |  |  | export function renderComponent<T>(type: ComponentType<T>, opts?: CreateComponentOptions): T { | 
					
						
							| 
									
										
										
										
											2018-02-03 20:34:30 -08:00
										 |  |  |   return _renderComponent(type, { | 
					
						
							| 
									
										
										
										
											2018-03-06 10:13:49 -08:00
										 |  |  |     rendererFactory: opts && opts.rendererFactory || testRendererFactory, | 
					
						
							| 
									
										
										
										
											2018-02-03 20:34:30 -08:00
										 |  |  |     host: containerEl, | 
					
						
							|  |  |  |     scheduler: requestAnimationFrame, | 
					
						
							| 
									
										
										
										
											2018-05-09 15:30:16 -07:00
										 |  |  |     sanitizer: opts ? opts.sanitizer : undefined, | 
					
						
							| 
									
										
										
										
											2018-03-06 11:58:08 -08:00
										 |  |  |     hostFeatures: opts && opts.hostFeatures | 
					
						
							| 
									
										
										
										
											2018-02-03 20:34:30 -08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-13 12:31:21 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @deprecated use `TemplateFixture` or `ComponentFixture` | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | export function toHtml<T>(componentOrElement: T | RElement): string { | 
					
						
							| 
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 |  |  |   const node = (componentOrElement as any)[NG_HOST_SYMBOL] as LElementNode; | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   if (node) { | 
					
						
							|  |  |  |     return toHtml(node.native); | 
					
						
							|  |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2018-01-03 11:42:48 +01:00
										 |  |  |     return stringifyElement(componentOrElement) | 
					
						
							|  |  |  |         .replace(/^<div host="">/, '') | 
					
						
							| 
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 |  |  |         .replace(/^<div fixture="mark">/, '') | 
					
						
							| 
									
										
										
										
											2018-01-03 11:42:48 +01:00
										 |  |  |         .replace(/<\/div>$/, '') | 
					
						
							|  |  |  |         .replace(' style=""', '') | 
					
						
							| 
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 |  |  |         .replace(/<!--container-->/g, ''); | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function createComponent( | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  |     name: string, template: ComponentTemplate<any>, directives: DirectiveTypesOrFactory = [], | 
					
						
							| 
									
										
										
										
											2018-06-19 17:58:42 +02:00
										 |  |  |     pipes: PipeTypesOrFactory = [], | 
					
						
							|  |  |  |     viewQuery: ComponentTemplate<any>| null = null): ComponentType<any> { | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   return class Component { | 
					
						
							|  |  |  |     value: any; | 
					
						
							| 
									
										
										
										
											2018-01-22 15:27:21 -08:00
										 |  |  |     static ngComponentDef = defineComponent({ | 
					
						
							|  |  |  |       type: Component, | 
					
						
							| 
									
										
										
										
											2018-03-29 16:41:45 -07:00
										 |  |  |       selectors: [[name]], | 
					
						
							| 
									
										
										
										
											2018-01-22 15:27:21 -08:00
										 |  |  |       factory: () => new Component, | 
					
						
							|  |  |  |       template: template, | 
					
						
							| 
									
										
										
										
											2018-06-19 17:58:42 +02:00
										 |  |  |       viewQuery: viewQuery, | 
					
						
							| 
									
										
										
										
											2018-03-25 21:32:39 -07:00
										 |  |  |       features: [PublicFeature], | 
					
						
							| 
									
										
										
										
											2018-03-29 12:58:41 -07:00
										 |  |  |       directives: directives, | 
					
						
							|  |  |  |       pipes: pipes | 
					
						
							| 
									
										
										
										
											2018-01-22 15:27:21 -08:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  |   }; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-25 21:32:39 -07:00
										 |  |  | export function createDirective( | 
					
						
							|  |  |  |     name: string, {exportAs}: {exportAs?: string} = {}): DirectiveType<any> { | 
					
						
							| 
									
										
										
										
											2017-12-19 16:51:42 +01:00
										 |  |  |   return class Directive { | 
					
						
							|  |  |  |     static ngDirectiveDef = defineDirective({ | 
					
						
							| 
									
										
										
										
											2018-01-22 15:27:21 -08:00
										 |  |  |       type: Directive, | 
					
						
							| 
									
										
										
										
											2018-03-29 16:41:45 -07:00
										 |  |  |       selectors: [['', name, '']], | 
					
						
							| 
									
										
										
										
											2017-12-19 16:51:42 +01:00
										 |  |  |       factory: () => new Directive(), | 
					
						
							| 
									
										
										
										
											2017-12-20 12:19:59 +01:00
										 |  |  |       features: [PublicFeature], | 
					
						
							| 
									
										
										
										
											2018-01-08 21:57:50 -08:00
										 |  |  |       exportAs: exportAs, | 
					
						
							| 
									
										
										
										
											2017-12-19 16:51:42 +01:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Verify that DOM is a type of render. This is here for error checking only and has no use.
 | 
					
						
							|  |  |  | export const renderer: Renderer3 = null as any as Document; | 
					
						
							|  |  |  | export const element: RElement = null as any as HTMLElement; | 
					
						
							|  |  |  | export const text: RText = null as any as Text; |