我的模板的特性“根”包含角2单元测试:无法读取未定义
<a [routerLink]="['/my-profile']" routerLinkActive="active">
<i class="icon-user"></i>{{ 'MY_PROFILE' | translate }}
</a>
错误是因为routerLink
和routerLinkActive
指令。
单元测试文件。
TestBed.configureTestingModule({
imports: [
MultilingualModule, CommonModule,
RouterTestingModule.withRoutes([
{ path: 'my-profile', component: MockComponent },
{ path: 'change-password', component: MockComponent },
])
],
schemas: [ NO_ERRORS_SCHEMA ],
declarations: [TopNavigationBarComponent, TestComponent,MockComponent],
providers: [
{ provide: LoginService, useValue: MockLoginService },
{ provide: Router, useClass: RouterStub }
]
});