私はAngle 2アプリケーションを作成しており、UIチームのライブラリを使用しています。アプリケーションの開発はすごく進んでいます。そのようなimport文を使用することで、すべてのコンポーネントを簡単に使用できます。これは私のapp.module.tsです:'DynamicTestModule'モジュールによって予期しない値 'SohoComponentsModule'がインポートされました
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { SohoComponentsModule } from '@infor/sohoxi-angular'; // This is the one in question.
import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';
@NgModule({
declarations: [
AppComponent,
licenseGeneratorComponent,
emergencyLicenseComponent,
partnerLicenseComponent,
standardLicenseComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
SohoComponentsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
、ここでは、このアプリ内で使用される私のテンプレートの一つであり、SOHOものは、このライブラリからです:
<div class="row">
<div class="twelve columns">
<h1>License Generator</h1>
<div soho-tabs>
<ul soho-tab-list>
<li soho-tab><a soho-tab-title tabId='tabs-normal-emergency'>Emergency Licenses</a></li>
<li soho-tab><a soho-tab-title tabId='tabs-normal-partner'>Partner Licenses</a></li>
<li soho-tab><a soho-tab-title tabId='tabs-normal-standard'>Standard Licenses</a></li>
</ul>
<div soho-tab-panel tabId='tabs-normal-emergency'>
<emergency-license></emergency-license>
</div>
<div soho-tab-panel tabId='tabs-normal-partner'>
<partner-license></partner-license>
</div>
<div soho-tab-panel tabId='tabs-normal-standard'>
<standard-license></standard-license>
</div>
</div>
</div>
</div>
アプリケーションがうまく働いています、 問題ありません。しかし、今私のユニットテストに問題があるとき。最初のいくつかの単体テストで作業していましたが、1週間ほど放置して内容を追加して、テストが正しく実行されませんでした。私はエラーを取得する私のテスト
Unexpected value 'SohoComponentsModule' imported by the module 'DynamicTestModule'
を実行すると
マイapp.component.specは次のようになります。
import { TestBed, async } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';
import { SohoComponentsModule } from '@infor/sohoxi-angular';
describe('AppComponent',() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent,
licenseGeneratorComponent,
emergencyLicenseComponent,
partnerLicenseComponent,
standardLicenseComponent,
],
imports: [
FormsModule,
SohoComponentsModule
],
});
});
it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
});
私は、インポートを削除するためならば今しかし界で起こっていますテストでは、これらのエラーがスローされます:
Can't bind to 'closeOnSelect' since it isn't a known property of 'select'. ("label required">Versions</label>
助けてください!
アプリケーションはうまく機能していることに注意してください。単なるユニットテストで問題が発生します。私は一日中修正を探していましたが、これを理解することはできません。
ファイルをもっと投稿する必要がある場合はお知らせください。 ありがとう、 クリス