我正在使用VMware的Clarity组件进行角度2项目的POC。当我运行测试运行器时,我遇到以下错误:
'clr-main-container' is not a known element:
1. If 'clr-main-container' is an Angular component, then verify that it is part of this module.
2. If 'clr-main-container' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<clr-main-container>
我是角色2的新手,我无法在Google上找到任何内容。
答案 0 :(得分:2)
嗨agillette, 您可能在测试中缺少Testbed配置。类似的东西:
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {ClarityModule} from 'clarity-angular';
describe('...', function() {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ClarityModule.forRoot()],
declarations: [YourTestComponent]
});
});
});
您可以阅读有关TestBed here的更多信息。
也可以随时查看Clarity seed以查看连接测试的简单工作应用程序。