mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Use event to close dialog
- Work around close handler method being private Refs #849
This commit is contained in:
parent
5f60760cd5
commit
840912967e
@ -74,7 +74,7 @@
|
|||||||
<activiti-task-details [taskId]="selectedTaskId" (formCompleted)="taskFormCompleted()" #taskdetails></activiti-task-details>
|
<activiti-task-details [taskId]="selectedTaskId" (formCompleted)="taskFormCompleted()" #taskdetails></activiti-task-details>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-dialog__actions">
|
<div class="mdl-dialog__actions">
|
||||||
<button type="button" (click)="closeDialog()" class="mdl-button close">{{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}</button>
|
<button type="button" (click)="closeDialog()" class="mdl-button close" data-automation-id="button-task-close">{{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
@ -34,6 +34,7 @@ describe('ActivitiProcessInstanceTasks', () => {
|
|||||||
let componentHandler: any;
|
let componentHandler: any;
|
||||||
let component: ActivitiProcessInstanceTasks;
|
let component: ActivitiProcessInstanceTasks;
|
||||||
let fixture: ComponentFixture<ActivitiProcessInstanceTasks>;
|
let fixture: ComponentFixture<ActivitiProcessInstanceTasks>;
|
||||||
|
let debugElement: DebugElement;
|
||||||
let service: ActivitiProcessService;
|
let service: ActivitiProcessService;
|
||||||
let getProcessTasksSpy: jasmine.Spy;
|
let getProcessTasksSpy: jasmine.Spy;
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ describe('ActivitiProcessInstanceTasks', () => {
|
|||||||
|
|
||||||
fixture = TestBed.createComponent(ActivitiProcessInstanceTasks);
|
fixture = TestBed.createComponent(ActivitiProcessInstanceTasks);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
debugElement = fixture.debugElement;
|
||||||
service = fixture.debugElement.injector.get(ActivitiProcessService);
|
service = fixture.debugElement.injector.get(ActivitiProcessService);
|
||||||
getProcessTasksSpy = spyOn(service, 'getProcessTasks').and.returnValue(Observable.of([new TaskDetailsModel(taskDetailsMock)]));
|
getProcessTasksSpy = spyOn(service, 'getProcessTasks').and.returnValue(Observable.of([new TaskDetailsModel(taskDetailsMock)]));
|
||||||
|
|
||||||
@ -181,7 +183,8 @@ describe('ActivitiProcessInstanceTasks', () => {
|
|||||||
it('should close the task details dialog when close button clicked', () => {
|
it('should close the task details dialog when close button clicked', () => {
|
||||||
component.clickTask({}, new TaskDetailsModel(taskDetailsMock));
|
component.clickTask({}, new TaskDetailsModel(taskDetailsMock));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.cancelDialog();
|
let closeButton: DebugElement = debugElement.query(By.css('[data-automation-id="button-task-close"]'));
|
||||||
|
closeButton.triggerEventHandler('click', null);
|
||||||
expect(closeSpy).toHaveBeenCalled();
|
expect(closeSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user