请有人帮助我! 我试图测试使用Angular Material的LoginComponent,我已经在生产代码上使用了MdDialogRef,到目前为止这是我的测试类,我只想填充所有依赖项以使其运行:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import {
MdDialogModule,
MdDialogRef
} from '@angular/material';
import { LoginComponent } from './login.component';
import { AppMaterialModule } from 'app/module/app-material.module';
import { CustomDialogModule } from 'app/module/custom-modal/custom-dialog.module';
fdescribe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [LoginComponent],
imports: [
ReactiveFormsModule,
MdDialogModule,
AppMaterialModule,
CustomDialogModule
],
providers: [
MdDialogRef
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
我一直收到此错误:Failed: Can't resolve all parameters for MdDialogRef: (?, ?).
有什么帮助吗?谢谢!