RouterTestingModule
设置要用于测试的路由器。
Sets up the router to be used for testing.
class RouterTestingModule {
static withRoutes(routes: Route[], config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>
}
说明
这些模块会设置用于测试的路由器。它提供 Location
、LocationStrategy
和 NgModuleFactoryLoader
的间谍实现。
The modules sets up the router to be used for testing. It provides spy implementations of Location
, LocationStrategy
, and NgModuleFactoryLoader
.
Further information available in the Usage Notes...
静态方法
参数
返回值 |
提供商
提供商 |
---|
|
|
|
|
|
|
|
使用说明
例子
Example
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule.withRoutes(
[{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
)
]
});
});