message: test(core): avoid `TemplateFixture` usages in LViewDebug spec
  This commit further reduces the use of an obsolete `TemplateFixture` class.
  PR Close
diff: * found in the LICENSE file at https://angular.io/license
  */
  +import {Type} from '@angular/core/public_api';
  import {ComponentTemplate} from '@angular/core/src/render3';
  +import {extractDirectiveDef} from '@angular/core/src/render3/definition';
  import {createLView, createTNode, createTView} from '@angular/core/src/render3/instructions/shared';
  +import {DirectiveDef, DirectiveDefList, DirectiveTypesOrFactory, PipeDef, PipeDefList, PipeTypesOrFactory} from '@angular/core/src/render3/interfaces/definition';
  import {TConstants, TElementNode, TNodeType} from '@angular/core/src/render3/interfaces/node';
  import {domRendererFactory3} from '@angular/core/src/render3/interfaces/renderer';
  import {LView, LViewFlags, T_HOST, TView, TViewType} from '@angular/core/src/render3/interfaces/view';
  @@ -36,12 +39,13 @@ export class ViewFixture {
  lView: LView;
  - constructor({template, decls, vars, consts, context}: {
  + constructor({template, decls, vars, consts, context, directives}: {
  decls?: number,
  vars?: number,
  template?: ComponentTemplate<any>,
  consts?: TConstants,
  - context?: {}
  + context?: {},
  + directives?: any[],
  } = {}) {
  const hostRenderer = domRendererFactory3.createRenderer(null, null);
  this.host = hostRenderer.createElement('host-element') as HTMLElement;
  @@ -50,9 +54,9 @@ export class ViewFixture {
  null, hostTView, {}, LViewFlags.CheckAlways | LViewFlags.IsRoot, null, null,
  domRendererFactory3, hostRenderer, null, null, null);
  -
  this.tView = createTView(
  - TViewType.Component, null, template || noop, decls || 0, vars || 0, null, null, null, null,
  + TViewType.Component, null, template || noop, decls || 0, vars || 0,
  + directives ? toDefs(directives, dir => extractDirectiveDef(dir)!) : null, null, null, null,
  consts || null);
  const hostTNode =
  createTNode(hostTView, null, TNodeType.Element, 0, 'host-element', null) as TElementNode;
  @@ -82,3 +86,18 @@ export class ViewFixture {
  }
  }
  }
  +
  +function toDefs(
  + types: DirectiveTypesOrFactory|undefined|null,
  + mapFn: (type: Type<any>) => DirectiveDef<any>): DirectiveDefList|null;
  +function toDefs(types: PipeTypesOrFactory|undefined|null, mapFn: (type: Type<any>) => PipeDef<any>):
  + PipeDefList|null;
  +function toDefs(
  + types: Type<any>[]|(() => Type<any>[])|undefined|null,
  + mapFn: (type: Type<any>) => PipeDef<any>| DirectiveDef<any>): any {
  + if (!types) return null;
  + if (typeof types == 'function') {
  + types = types();
  + }
  + return types.map(mapFn);
  +}
  