本文整理汇总了TypeScript中@angular/core/testing.ComponentFixture.whenStable方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ComponentFixture.whenStable方法的具体用法?TypeScript ComponentFixture.whenStable怎么用?TypeScript ComponentFixture.whenStable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core/testing.ComponentFixture
的用法示例。
在下文中一共展示了ComponentFixture.whenStable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
component.success.subscribe((res) => {
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(res).toBeDefined();
let event: any = element.querySelector('diagram-end-event > diagram-event > raphael-circle[ng-reflect-stroke="#2632aa"]');
expect(event).not.toBeNull();
let iconEvent: any = element.querySelector('diagram-end-event > diagram-event >' +
' diagram-container-icon-event > div > div > diagram-icon-error > raphael-icon-error');
expect(iconEvent).not.toBeNull();
let tooltip: any = element.querySelector('diagram-tooltip > div');
expect(tooltip.textContent).toContain(res.elements[0].id);
expect(tooltip.textContent).toContain(res.elements[0].type);
});
});
示例2: expect
dialog.open(PizzaMsg, config).then(dialogRef => {
viewContainerFixture.detectChanges();
let afterCloseResult: string;
dialogRef.afterClosed().subscribe(result => {
afterCloseResult = result;
});
dialogRef.close('Charmander');
viewContainerFixture.whenStable().then(() => {
expect(afterCloseResult).toBe('Charmander');
expect(overlayContainerElement.childNodes.length).toBe(0);
});
});
示例3: it
it('should render a disabled attachForm button if the user select the original formId', async(() => {
component.taskId = 1;
component.formId = 2;
component.attachFormControl.setValue(3);
fixture.detectChanges();
spyOn(taskService, 'attachFormToATask').and.returnValue(of(true));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
component.attachFormControl.setValue(2);
fixture.detectChanges();
let attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
expect(attachButton.nativeElement.disabled).toBeTruthy();
});
}));
示例4: it
it('should show QUEUED if status is QUEUED', async(() => {
component.state = ScanState.QUEUED;
fixture.detectChanges();
fixture.whenStable().then(() => { // wait for async getRecentLogs
fixture.detectChanges();
let el: HTMLElement = fixture.nativeElement.querySelector('.bar-state');
expect(el).toBeTruthy();
let el2: HTMLElement = el.querySelector('span');
expect(el2).toBeTruthy();
expect(el2.textContent).toEqual('VULNERABILITY.STATE.QUEUED');
});
}));
示例5: it
it('on init should get all things', async () => {
const http = TestBed.get(HttpTestingController);
const customConfiguration = TestBed.get(Configuration);
const expectedResponse = [{ id: 1, name: 'NetCore' }];
const url = customConfiguration.Server + 'api/things/';
fixture.detectChanges();
http.expectOne(url).flush(expectedResponse);
fixture.whenStable().then(() => {
expect(comp.things).toEqual(expectedResponse);
});
})
示例6: it
it('should open to edit existing endpoint', async(()=>{
fixture.detectChanges();
fixture.whenStable().then(()=>{
let de: DebugElement = fixture.debugElement.query(del=>del.classes['action-item']);
expect(de).toBeTruthy();
fixture.detectChanges();
click(de);
fixture.detectChanges();
let deInput: DebugElement = fixture.debugElement.query(By.css('input'));
expect(deInput).toBeTruthy();
let elInput: HTMLElement = deInput.nativeElement;
expect(elInput).toBeTruthy();
expect(elInput.textContent).toEqual('target_01');
});
}));
示例7: it
it('should show QUEUED if status is QUEUED', async(() => {
component.summary.scan_status = VULNERABILITY_SCAN_STATUS.pending;
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let el: HTMLElement = fixture.nativeElement.querySelector('.bar-state');
expect(el).toBeTruthy();
let el2: HTMLElement = el.querySelector('span');
expect(el2).toBeTruthy();
expect(el2.textContent).toEqual('VULNERABILITY.STATE.QUEUED');
});
}));
示例8: it
it('should update the property value after a successful update attempt', async(() => {
component.editable = true;
component.property.editable = true;
component.property.value = null;
const expectedDate = moment('Jul 10 2017', 'MMM DD YY');
fixture.detectChanges();
component.onDateChanged({ value: expectedDate });
fixture.whenStable().then(
(updateNotification) => {
expect(component.property.value).toEqual(expectedDate.toDate());
}
);
}));