2016-12-06 63 views
1

我正在使用VMware的Clarity組件進行角度2方案的POC測試。當我運行測試運行,我收到以下錯誤:使用VMware Clarity模塊進行角度2單元測試

'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,我無法找到任何谷歌。

+0

嗨@agillette測試連線。看起來你還沒有註冊'ClarityModule'。需要更多的細節來了解完整的問題。什麼是測試跑步者?你在使用Clarity種子項目嗎?我建議通過Clarity入門頁面:https://vmware.github.io/clarity/get-started#seedProjectClarity並使用他們的種子應用程序。 – takeradi

回答

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] 
 
    }); 
 
    }); 
 

 
});

您可以瞭解更多關於測試牀here

而且隨時檢查出Clarity seed一個簡單的工作應用程序在。