本文整理匯總了TypeScript中@angular/core.DebugElement.triggerEventHandler方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DebugElement.triggerEventHandler方法的具體用法?TypeScript DebugElement.triggerEventHandler怎麽用?TypeScript DebugElement.triggerEventHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/core.DebugElement
的用法示例。
在下文中一共展示了DebugElement.triggerEventHandler方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should show confirmation dialog and handle reject', () => {
spyOn(dotAlertConfirmService, 'confirm').and.callFake((conf) => {
conf.reject();
});
dotIframeDialog.triggerEventHandler('custom', {
detail: {
name: 'edit-contentlet-data-updated',
payload: true
}
});
dotIframeDialog.triggerEventHandler('beforeClose', {
close: () => {}
});
expect(dotAlertConfirmService.confirm).toHaveBeenCalledWith({
accept: jasmine.any(Function),
reject: jasmine.any(Function),
header: 'Header',
message: 'Message',
footerLabel: {
accept: 'Accept'
}
});
expect(component.close.emit).not.toHaveBeenCalled();
expect(dotAddContentletService.clear).not.toHaveBeenCalled();
});
示例2: it
it('should listen to native focus and blur events', () => {
spyOn(component, 'onFocusChange');
testElement.triggerEventHandler('focus', null);
testElement.triggerEventHandler('blur', null);
expect(component.onFocusChange).toHaveBeenCalledTimes(2);
});
示例3: xit
xit("should listen to native focus and blur events", () => {
spyOn(component, "onFocusChange");
inputElement.triggerEventHandler("focus", null);
inputElement.triggerEventHandler("blur", null);
expect(component.onFocusChange).toHaveBeenCalledTimes(2);
});
示例4: it
it('Hover over input to check background change', () => {
input_element.triggerEventHandler('mouseover', null);
fixture.detectChanges();
expect(input_element.nativeElement.style.backgroundColor).toBe('red');
input_element.triggerEventHandler('mouseout', null);
fixture.detectChanges();
expect(input_element.nativeElement.style.backgroundColor).toBe('inherit');
});
開發者ID:sbjavateam,項目名稱:TypeScript-2.x-for-Angular-Developers,代碼行數:9,代碼來源:background-changer.directive.spec.ts
示例5: it
it('should execute the command on the selected menu item and hide the menu', () => {
spyOn(component.model[0], 'command');
button.triggerEventHandler('click', {
stopPropagation: () => {}
});
fixture.detectChanges();
const menuItem: DebugElement = fixture.debugElement.query(By.css('.dot-menu-item__link'));
menuItem.triggerEventHandler('click', {
stopPropagation: () => {}
});
expect(component.model[0].command).toHaveBeenCalled();
expect(component.visible).toBeFalsy();
});
示例6: it
it('should call close method on dot-dialog on dot-iframe escape key', () => {
dotIframe.triggerEventHandler('keydown', {
key: 'Escape'
});
expect(component.keydown.emit).toHaveBeenCalledTimes(1);
});
示例7: beforeEach
beforeEach(() => {
migrationIssueService = de.injector.get(MigrationIssuesService);
migrationIssueService.getIssuesPerFile.and.returnValue(new Observable<any>(observer => {
let data = [
{
occurrences: 3,
file: {
fileName: 'SearchOperatorEnum.java'
}
},
{
occurrences: 3,
file: {
fileName: 'SearchOperatorEnumNoPath.java'
}
},
{
occurrences: 4,
file: {
fileName: 'DescriptionDaoImpl.java'
}
}
];
observer.next(data);
observer.complete();
}));
de = fixture.debugElement.query(By.css('a.issue-title'));
el = de.nativeElement;
de.triggerEventHandler('click', null);
fixture.detectChanges();
});
示例8: it
it('should transform containers raw data from component "dot-container-selector" into proper data to be saved in the BE', () => {
const containerSelector: DebugElement = hostComponentfixture.debugElement.query(
By.css('dot-container-selector')
);
const transformedValue = {
containers: [
{
identifier: mockDotContainers[0].container.identifier,
uuid: undefined
},
{
identifier: mockDotContainers[1].container.identifier,
uuid: undefined
}
],
location: 'left',
width: 'small'
};
spyOn(component, 'updateAndPropagate').and.callThrough();
spyOn(component, 'propagateChange');
containerSelector.triggerEventHandler('change', 'mockDotContainers');
component.updateAndPropagate(mockDotContainers);
expect(component.updateAndPropagate).toHaveBeenCalled();
expect(component.propagateChange).toHaveBeenCalledWith(transformedValue);
});
示例9: it
it('should close the task details dialog when close button clicked', () => {
component.clickTask({}, new TaskDetailsModel(taskDetailsMock));
fixture.detectChanges();
let closeButton: DebugElement = debugElement.query(By.css('[data-automation-id="button-task-close"]'));
closeButton.triggerEventHandler('click', null);
expect(closeSpy).toHaveBeenCalled();
});
開發者ID:Pokhriyal,項目名稱:alfresco-ng2-components,代碼行數:7,代碼來源:activiti-process-instance-tasks.component.spec.ts
示例10: it
it('list another page when page was changed', fakeAsync(() => {
pagerDebugElement.triggerEventHandler('pageChanged', {page: 2});
advance(fixture);
cmpDebugElement = fixture.debugElement.query(By.directive(UserListComponent));
const cmp:UserListComponent = cmpDebugElement.componentInstance;
expect(cmp.page).toEqual(2);
}));