Angular 2 애플리케이션을 작성 중이며 UI 팀의 라이브러리를 사용하고 있습니다. 응용 프로그램의 개발이 잘 진행되고 있습니다. 이와 같은 import 문을 사용하여 모든 구성 요소를 쉽게 사용할 수 있습니다. 이것은 내 app.module.ts입니다.
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>
응용 프로그램은 문제없이 잘 작동했습니다. 하지만 지금 내 단위 테스트에 문제가있을 때. 이전에 처음 몇 번의 단위 테스트로 작업했지만 일주일 정도 그대로두고 더 많은 콘텐츠를 추가했는데 이제 테스트가 제대로 실행되지 않습니다.
테스트를 실행할 때 오류가 발생합니다.
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!');
}));
});
테스트에서 import 문을 제거하면 다음 오류가 발생하기 때문에 지금은 원을 그리며 갈 것입니다.
Can't bind to 'closeOnSelect' since it isn't a known property of 'select'. ("label required">Versions</label>
도와주세요!
응용 프로그램은 여전히 잘 작동하며 문제를 일으키는 단위 테스트 만 작동합니다. 나는 하루 종일 수정 사항을 찾기 위해 보냈지 만 이것을 알아낼 수 없습니다.
내 파일을 더 게시해야하는 경우 알려주십시오. 고마워, 크리스
어떤 이유로이 문제를 일으킨 것은 각도 라이브러리였습니다. 버전을 업데이트하고 문제가 해결되었습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다