mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3670] Checklist - fix failing unit test (#3873)
* fix unit test on checklist * Fix relative path import
This commit is contained in:
committed by
Eugenio Romano
parent
94df1f6fdd
commit
29f28c7c82
@@ -4,10 +4,10 @@
|
|||||||
@import './app/components/process-service/process-service.component.scss';
|
@import './app/components/process-service/process-service.component.scss';
|
||||||
|
|
||||||
|
|
||||||
@import 'content-services/styles/index';
|
@import '../../lib/content-services/styles/index';
|
||||||
@import 'process-services/styles/index';
|
@import '../../lib/process-services/styles/index';
|
||||||
@import 'insights/styles/index';
|
@import '../../lib/insights/styles/index';
|
||||||
@import 'core/styles/index';
|
@import '../../lib/core/styles/index';
|
||||||
|
|
||||||
@import '~@angular/material/theming';
|
@import '~@angular/material/theming';
|
||||||
|
|
||||||
|
@@ -14,8 +14,8 @@
|
|||||||
<mat-chip-list class="mat-chip-list-stacked">
|
<mat-chip-list class="mat-chip-list-stacked">
|
||||||
<mat-chip id="check-{{check.id}}" class="adf-checklist-chip" *ngFor="let check of checklist">
|
<mat-chip id="check-{{check.id}}" class="adf-checklist-chip" *ngFor="let check of checklist">
|
||||||
<span>{{check.name}}</span>
|
<span>{{check.name}}</span>
|
||||||
<button *ngIf="!readOnly && !check.endDate" mat-icon-button type="button" class="adf-checklist-cancel-button" (click)="delete(check.id)">
|
<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 id="remove-{{check.id}}" matChipRemove>cancel</mat-icon>
|
<mat-icon matChipRemove>cancel</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
</mat-chip-list>
|
</mat-chip-list>
|
||||||
|
@@ -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(''));
|
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.taskId = 'new-fake-task-id';
|
||||||
checklistComponent.checklist.push(new TaskDetailsModel({
|
checklistComponent.checklist.push(new TaskDetailsModel({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let checklistElementRemove = <HTMLElement> element.querySelector('#remove-fake-check-id');
|
fixture.whenStable().then(() => {
|
||||||
expect(checklistElementRemove).toBeDefined();
|
fixture.detectChanges();
|
||||||
expect(checklistElementRemove).not.toBeNull();
|
expect(checklistComponent.checklist.length).toBe(1);
|
||||||
checklistElementRemove.click();
|
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(() => {
|
it('should show load task checklist on change', async(() => {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user