[ADF-3670] Checklist - fix failing unit test (#3873)

* fix unit test on checklist

* Fix relative path import
This commit is contained in:
Maurizio Vitale
2018-10-09 12:26:04 +01:00
committed by Eugenio Romano
parent 94df1f6fdd
commit 29f28c7c82
3 changed files with 19 additions and 18 deletions

View File

@@ -4,10 +4,10 @@
@import './app/components/process-service/process-service.component.scss';
@import 'content-services/styles/index';
@import 'process-services/styles/index';
@import 'insights/styles/index';
@import 'core/styles/index';
@import '../../lib/content-services/styles/index';
@import '../../lib/process-services/styles/index';
@import '../../lib/insights/styles/index';
@import '../../lib/core/styles/index';
@import '~@angular/material/theming';

View File

@@ -14,8 +14,8 @@
<mat-chip-list class="mat-chip-list-stacked">
<mat-chip id="check-{{check.id}}" class="adf-checklist-chip" *ngFor="let check of checklist">
<span>{{check.name}}</span>
<button *ngIf="!readOnly && !check.endDate" mat-icon-button type="button" class="adf-checklist-cancel-button" (click)="delete(check.id)">
<mat-icon id="remove-{{check.id}}" matChipRemove>cancel</mat-icon>
<button *ngIf="!readOnly && !check.endDate" id="remove-{{check.id}}" mat-icon-button type="button" class="adf-checklist-cancel-button" (click)="delete(check.id)">
<mat-icon matChipRemove>cancel</mat-icon>
</button>
</mat-chip>
</mat-chip-list>

View File

@@ -205,25 +205,26 @@ describe('ChecklistComponent', () => {
});
}));
it('should send an event when the checklist is deleted', (done) => {
it('should send an event when the checklist is deleted', async(() => {
spyOn(service, 'deleteTask').and.returnValue(of(''));
let disposableDelete = checklistComponent.checklistTaskDeleted.subscribe(() => {
expect(element.querySelector('#fake-check-id')).toBeNull();
disposableDelete.unsubscribe();
done();
});
checklistComponent.taskId = 'new-fake-task-id';
checklistComponent.checklist.push(new TaskDetailsModel({
id: 'fake-check-id',
name: 'fake-check-name'
}));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(checklistComponent.checklist.length).toBe(1);
let checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
expect(checklistElementRemove).toBeDefined();
expect(checklistElementRemove).not.toBeNull();
checklistElementRemove.click();
expect(checklistComponent.checklist.length).toBe(0);
});
}));
it('should show load task checklist on change', async(() => {