mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working (#2658)
* [ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working * Made the drag and drop area working in demo shell for task attachment * Provided a way to pass custom no content template for drag and drop to the user * Updated the task-attachment README file for the user to know how to use drag and drop component with task-attachment component * [ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working * Made the drag and drop area working in demo shell for task attachment * Provided a way to pass custom no content template for drag and drop to the user * Updated the task-attachment README file for the user to know how to use drag and drop component with task-attachment component
This commit is contained in:
committed by
Eugenio Romano
parent
bf6d0284e0
commit
aa8b2a28f3
@@ -141,7 +141,54 @@ describe('TaskAttachmentList', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display all actions if attachements are not read only', () => {
|
||||
it('emit document when a user wants to view the document', () => {
|
||||
component.emitDocumentContent(mockAttachment.data[1]);
|
||||
fixture.detectChanges();
|
||||
expect(getFileRawContentSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('download document when a user wants to view the document', () => {
|
||||
component.downloadContent(mockAttachment.data[1]);
|
||||
fixture.detectChanges();
|
||||
expect(getFileRawContentSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should show the empty list drag and drop component when the task is not completed', async(() => {
|
||||
getTaskRelatedContentSpy.and.returnValue(Observable.of({
|
||||
'size': 0,
|
||||
'total': 0,
|
||||
'start': 0,
|
||||
'data': []
|
||||
}));
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'taskId': change});
|
||||
component.disabled = false;
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('.adf-custom-empty-template')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not show the empty list drag and drop component when is disabled', async(() => {
|
||||
getTaskRelatedContentSpy.and.returnValue(Observable.of({
|
||||
'size': 0,
|
||||
'total': 0,
|
||||
'start': 0,
|
||||
'data': []
|
||||
}));
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'taskId': change});
|
||||
component.disabled = true;
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('.adf-custom-empty-template')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display all actions if attachments are not read only', () => {
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'taskId': change});
|
||||
fixture.detectChanges();
|
||||
@@ -190,40 +237,6 @@ describe('TaskAttachmentList', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show the empty list drag and drop component when the task is not completed', async(() => {
|
||||
getTaskRelatedContentSpy.and.returnValue(Observable.of({
|
||||
'size': 0,
|
||||
'total': 0,
|
||||
'start': 0,
|
||||
'data': []
|
||||
}));
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'taskId': change});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('adf-empty-list .adf-empty-list-drag_drop').innerText.trim()).toEqual('ADF_TASK_LIST.ATTACHMENT.EMPTY.DRAG-AND-DROP.TITLE');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not show the empty list drag and drop component when is disabled', async(() => {
|
||||
getTaskRelatedContentSpy.and.returnValue(Observable.of({
|
||||
'size': 0,
|
||||
'total': 0,
|
||||
'start': 0,
|
||||
'data': []
|
||||
}));
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'taskId': change});
|
||||
component.disabled = true;
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('adf-empty-list .adf-empty-list-drag_drop')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show the empty list component when the attachments list is empty for completed task', async(() => {
|
||||
getTaskRelatedContentSpy.and.returnValue(Observable.of({
|
||||
'size': 0,
|
||||
@@ -270,7 +283,7 @@ describe('TaskAttachmentList', () => {
|
||||
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456');
|
||||
});
|
||||
|
||||
it('should NOT fetch new attachments when empty changeset made', () => {
|
||||
it('should NOT fetch new attachments when empty change set made', () => {
|
||||
component.ngOnChanges({});
|
||||
expect(getTaskRelatedContentSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -292,5 +305,11 @@ describe('TaskAttachmentList', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
|
||||
it('delete content by contentId', () => {
|
||||
component.deleteAttachmentById(5);
|
||||
fixture.detectChanges();
|
||||
expect(deleteContentSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user