本文整理汇总了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);
}));