【发布时间】:2018-11-01 14:26:51
【问题描述】:
单元测试有问题。我有一个新项目要求帮助修复测试,我正在添加“CUSTOM_ELEMENTS_SCHEMA”,这样 Angular 就不会在子组件中更深入,并且我在下面收到此错误,我不清楚原因。
Unexpected value 'custom-elements' imported by the module 'DynamicTestModule'
此处的组件规格
describe('CheckboxComponent', () => {
let component: CheckboxComponent;
let fixture: ComponentFixture<CheckboxComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [FormsModule, ReactiveFormsModule, CUSTOM_ELEMENTS_SCHEMA],
declarations: [ CheckboxComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CheckboxComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
【问题讨论】:
标签: angular unit-testing jasmine karma-jasmine