@@ -84,6 +84,20 @@ describe('route utils', () => {
84
84
expect ( newContent ) . toEqual ( `import { Router } from '@angular/router';\n` ) ;
85
85
} ) ;
86
86
} ) ;
87
+ it ( 'inserts subcomponent in win32 environment' , ( ) => {
88
+ let content = './level1\\level2/level2.component' ;
89
+ return nru . insertImport ( sourceFile , 'level2' , content ) . apply ( )
90
+ . then ( ( ) => readFile ( sourceFile , 'utf8' ) )
91
+ . then ( newContent => {
92
+ if ( process . platform . startsWith ( 'win' ) ) {
93
+ expect ( newContent ) . toEqual (
94
+ `import { level2 } from './level1/level2/level2.component';\n` ) ;
95
+ } else {
96
+ expect ( newContent ) . toEqual (
97
+ `import { level2 } from './level1\\level2/level2.component';\n` ) ;
98
+ }
99
+ } ) ;
100
+ } ) ;
87
101
} ) ;
88
102
89
103
describe ( 'bootstrapItem' , ( ) => {
@@ -124,7 +138,7 @@ describe('route utils', () => {
124
138
. then ( content => {
125
139
expect ( content ) . toEqual (
126
140
`import routes from './routes';
127
- import { provideRouter } from '@angular/router';
141
+ import { provideRouter } from '@angular/router';
128
142
bootstrap(AppComponent, [ provideRouter(routes) ]);` ) ;
129
143
} ) ;
130
144
} ) ;
@@ -299,7 +313,7 @@ export default [
299
313
children: [
300
314
{ path: 'about', component: AboutComponent,
301
315
children: [
302
- { path: 'details', component: DetailsComponent },
316
+ { path: 'details', component: DetailsComponent },
303
317
{ path: 'more', component: MoreComponent }
304
318
]
305
319
}
@@ -327,7 +341,7 @@ export default [
327
341
children: [
328
342
{ path: 'more', component: MoreComponent,
329
343
children: [
330
- { path: 'sections', component: SectionsComponent }
344
+ { path: 'sections', component: SectionsComponent }
331
345
]
332
346
}
333
347
]
@@ -359,7 +373,7 @@ export default [
359
373
{ path: 'main', component: MainComponent }
360
374
{ path: 'home', component: HomeComponent,
361
375
children: [
362
- { path: 'about/:id', component: AboutComponent_1 },
376
+ { path: 'about/:id', component: AboutComponent_1 },
363
377
{ path: 'about', component: AboutComponent }
364
378
]
365
379
}
@@ -447,7 +461,7 @@ export default [
447
461
export default [
448
462
{ path: 'home', component: HomeComponent,
449
463
children: [
450
- { path: 'trap-queen', component: TrapQueenComponent },
464
+ { path: 'trap-queen', component: TrapQueenComponent },
451
465
{ path: 'about', component: AboutComponent,
452
466
children: [
453
467
{ path: 'more', component: MoreComponent }
@@ -478,7 +492,7 @@ import { HomeComponent as HomeComponent_1 } from './app/home/home/home.component
478
492
export default [
479
493
{ path: 'home', component: HomeComponent,
480
494
children: [
481
- { path: 'home', component: HomeComponent_1 }
495
+ { path: 'home', component: HomeComponent_1 }
482
496
]
483
497
}
484
498
];` ;
@@ -487,7 +501,7 @@ export default [
487
501
} ) ;
488
502
it ( 'throws error if components collide and there is repitition' , ( ) => {
489
503
let editedFile = new InsertChange ( routesFile , 16 ,
490
- `\n { path: 'about', component: AboutComponent,
504
+ `\n { path: 'about', component: AboutComponent,
491
505
children: [
492
506
{ path: 'details/:id', component: DetailsComponent_1 },
493
507
{ path: 'details', component: DetailsComponent }
@@ -543,7 +557,7 @@ import { DetailsComponent as DetailsComponent_1 } from './app/about/description/
543
557
export default [
544
558
{ path: 'home', component: HomeComponent,
545
559
children: [
546
- { path: 'more', component: MoreComponent, canDeactivate: [ MyGuard ], useAsDefault: true }
560
+ { path: 'more', component: MoreComponent, canDeactivate: [ MyGuard ], useAsDefault: true }
547
561
]
548
562
}
549
563
];`
0 commit comments