@@ -2,9 +2,9 @@ import { IgniteUIForAngularTemplate } from "@igniteui/angular-templates";
22import { ComponentGroup , Config , Framework , ProjectConfig , Util } from "@igniteui/cli-core" ;
33import * as path from "path" ;
44import { TemplateManager } from "../../packages/cli/lib/TemplateManager" ;
5- import { AngularTemplate } from "../../packages/cli/lib/templates/AngularTemplate" ;
65import { jQueryTemplate } from "../../packages/cli/lib/templates/jQueryTemplate" ;
76import { ReactTemplate } from "../../packages/cli/lib/templates/ReactTemplate" ;
7+ import { IgniteUIForWebComponentsTemplate } from "../../packages//cli/lib/templates/IgniteUIForWebComponentsTemplate" ;
88import { mockProLibFactory } from "../helpers/mocks" ;
99import { resetSpy } from "../helpers/utils" ;
1010
@@ -165,21 +165,22 @@ describe("Unit - Template manager", () => {
165165 } ) ;
166166
167167 it ( "Should load/create/register diff types of external custom Templates" , async ( ) => {
168- spyOn ( Util , "getDirectoryNames" ) . and . returnValue ( [ "jquery" , "react" , "angular" ] ) ;
168+ spyOn ( Util , "getDirectoryNames" ) . and . returnValue ( [ "jquery" , "react" , "angular" , "webcomponents" ] ) ;
169169 const templates = [
170170 "file:/template/jquery/js" ,
171171 "file:/template/react/es6" ,
172- "path:/template/angular/ig -ts" ,
172+ "path:/template/webcomponents/igc -ts" ,
173173 "/template/angular/igx-ts"
174174 ] ;
175175 const mockProjectConfig = { customTemplates : templates } as unknown as Config ;
176176 spyOn ( ProjectConfig , "getConfig" ) . and . returnValue ( mockProjectConfig ) ;
177177 spyOn ( Util , "directoryExists" ) . and . returnValue ( true ) ;
178178 spyOn ( Util , "fileExists" ) . and . returnValue ( true ) ;
179179 mockProjLibs = {
180- angular : [ mockProLibFactory ( "ig-ts" ) , mockProLibFactory ( " igx-ts") ] ,
180+ angular : [ mockProLibFactory ( "igx-ts" ) ] ,
181181 jquery : [ mockProLibFactory ( "js" ) ] ,
182- react : [ mockProLibFactory ( "es6" ) ]
182+ react : [ mockProLibFactory ( "es6" ) ] ,
183+ webcomponents : [ mockProLibFactory ( "igc-ts" ) ] ,
183184 } ;
184185 customRequire = {
185186 require : modulePath => {
@@ -214,14 +215,14 @@ describe("Unit - Template manager", () => {
214215 expect ( mockProjLibs . react [ 0 ] . registerTemplate ) . toHaveBeenCalledWith (
215216 jasmine . objectContaining ( template ( "react" , "es6" ) )
216217 ) ;
218+ expect ( mockProjLibs . webcomponents [ 0 ] . registerTemplate ) . toHaveBeenCalledTimes ( 1 ) ;
219+ expect ( mockProjLibs . webcomponents [ 0 ] . registerTemplate ) . toHaveBeenCalledWith ( jasmine . any ( IgniteUIForWebComponentsTemplate ) ) ;
220+ expect ( mockProjLibs . webcomponents [ 0 ] . registerTemplate ) . toHaveBeenCalledWith (
221+ jasmine . objectContaining ( template ( "webcomponents" , "igc-ts" ) )
222+ ) ;
217223 expect ( mockProjLibs . angular [ 0 ] . registerTemplate ) . toHaveBeenCalledTimes ( 1 ) ;
218- expect ( mockProjLibs . angular [ 0 ] . registerTemplate ) . toHaveBeenCalledWith ( jasmine . any ( AngularTemplate ) ) ;
224+ expect ( mockProjLibs . angular [ 0 ] . registerTemplate ) . toHaveBeenCalledWith ( jasmine . any ( IgniteUIForAngularTemplate ) ) ;
219225 expect ( mockProjLibs . angular [ 0 ] . registerTemplate ) . toHaveBeenCalledWith (
220- jasmine . objectContaining ( template ( "angular" , "ig-ts" ) )
221- ) ;
222- expect ( mockProjLibs . angular [ 1 ] . registerTemplate ) . toHaveBeenCalledTimes ( 1 ) ;
223- expect ( mockProjLibs . angular [ 1 ] . registerTemplate ) . toHaveBeenCalledWith ( jasmine . any ( IgniteUIForAngularTemplate ) ) ;
224- expect ( mockProjLibs . angular [ 1 ] . registerTemplate ) . toHaveBeenCalledWith (
225226 jasmine . objectContaining ( template ( "angular" , "igx-ts" ) )
226227 ) ;
227228 } ) ;
0 commit comments