本文整理匯總了TypeScript中@services/dot-alert-confirm/dot-alert-confirm.service.DotAlertConfirmService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.DotAlertConfirmService類的具體用法?TypeScript service.DotAlertConfirmService怎麽用?TypeScript service.DotAlertConfirmService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了service.DotAlertConfirmService類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should add message', () => {
dialogService.alert({
header: 'Header Test',
message: 'Hello world message'
});
fixture.detectChanges();
const message = de.query(By.css('.ui-dialog-content p'));
expect(message.nativeElement.textContent).toEqual('Hello world message');
});
示例2:
return Observable.create((observer: Observer<boolean>) => {
this.dotDialogService.confirm({
accept: () => {
component.onDeactivateSave().subscribe((res) => {
observer.next(res);
observer.complete();
});
},
reject: () => {
observer.next(true);
observer.complete();
},
header: component.getSaveWarningMessages().header,
message: component.getSaveWarningMessages().message
});
});
示例3: fakeAsync
fakeAsync(() => {
spyOn(component, 'onClickConfirm');
dialogService.confirm({
header: '',
message: ''
});
fixture.detectChanges(); // ngIf
tick();
fixture.detectChanges(); // confirmation service make it happen
const buttons = de.queryAll(By.css('p-confirmDialog button'));
buttons[0].nativeElement.click();
expect(component.onClickConfirm).toHaveBeenCalledTimes(1);
buttons[1].nativeElement.click();
expect(component.onClickConfirm).toHaveBeenCalledTimes(2);
})