【发布时间】:2016-12-03 21:10:26
【问题描述】:
我正在运行我的单元测试并在结果下方看到实际的应用程序页面。如果它应用了样式会很好,因为图像等会变得很大而且不值得一看。
这是我的设置代码:
describe('ResultImageComponent', () => {
let fixture: ComponentFixture<UserAttributesCardComponent>;
let component: UserAttributesCardComponent;
let element: HTMLElement;
let result: Result;
let page: Page;
beforeAll(() => {
TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(BrowserDynamicTestingModule,
platformBrowserDynamicTesting());
});
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [UserAttributesCardComponent],
}).compileComponents();
}));
beforeEach(async(() => {
fixture = TestBed.createComponent(UserAttributesCardComponent);
component = fixture.componentInstance;
createComponent();
}));
function createComponent() {
page = new Page();
component.user = new UserService().getBen();
fixture.detectChanges();
return fixture.whenStable().then(() => {
fixture.detectChanges();
page.addPageElements();
});
}
被测组件有一个外部模板,可以正常加载,但也有一个外部样式表没有加载。 这可以在配置测试台时完成吗?
【问题讨论】:
标签: css angular jasmine angular2-testing