6
6
* found in the LICENSE file at https://angular.dev/license
7
7
*/
8
8
9
- import { Component , provideExperimentalZonelessChangeDetection } from '@angular/core' ;
9
+ import { Component , Type , provideExperimentalZonelessChangeDetection } from '@angular/core' ;
10
10
import { bootstrapApplication } from '@angular/platform-browser' ;
11
11
import { provideServerRendering } from '@angular/platform-server' ;
12
12
import { RouterOutlet , Routes , provideRouter } from '@angular/router' ;
13
13
import { destroyAngularServerApp } from '../src/app' ;
14
14
import { ServerAsset , setAngularAppManifest } from '../src/manifest' ;
15
15
import { ServerRoute , provideServerRoutesConfig } from '../src/routes/route-config' ;
16
16
17
+ @Component ( {
18
+ standalone : true ,
19
+ selector : 'app-root' ,
20
+ template : '<router-outlet />' ,
21
+ imports : [ RouterOutlet ] ,
22
+ } )
23
+ class AppComponent { }
24
+
17
25
/**
18
26
* Configures the Angular application for testing by setting up the Angular app manifest,
19
27
* configuring server-side rendering, and bootstrapping the application with the provided routes.
@@ -26,24 +34,18 @@ import { ServerRoute, provideServerRoutesConfig } from '../src/routes/route-conf
26
34
* @param additionalServerAssets - A record of additional server assets to include,
27
35
* where the keys are asset paths and the values are asset details.
28
36
* @param locale - An optional locale to configure for the application during testing.
37
+ * @param rootComponent - The root Angular component to bootstrap the application.
29
38
*/
30
39
export function setAngularAppTestingManifest (
31
40
routes : Routes ,
32
41
serverRoutes : ServerRoute [ ] ,
33
42
baseHref = '/' ,
34
43
additionalServerAssets : Record < string , ServerAsset > = { } ,
35
44
locale ?: string ,
45
+ rootComponent : Type < unknown > = AppComponent ,
36
46
) : void {
37
47
destroyAngularServerApp ( ) ;
38
48
39
- @Component ( {
40
- standalone : true ,
41
- selector : 'app-root' ,
42
- template : '<router-outlet />' ,
43
- imports : [ RouterOutlet ] ,
44
- } )
45
- class AppComponent { }
46
-
47
49
setAngularAppManifest ( {
48
50
inlineCriticalCss : false ,
49
51
baseHref,
@@ -81,7 +83,7 @@ export function setAngularAppTestingManifest(
81
83
} ,
82
84
} ,
83
85
bootstrap : async ( ) => ( ) => {
84
- return bootstrapApplication ( AppComponent , {
86
+ return bootstrapApplication ( rootComponent , {
85
87
providers : [
86
88
provideServerRendering ( ) ,
87
89
provideExperimentalZonelessChangeDetection ( ) ,
0 commit comments