mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3539] created first version for process list cloud (#3925)
* [ADF-3539] created first version for process list cloud * [ADF-3539] fixed process list and added demo page * [ADF-3539] fixed sorting and start working on tests * [ADF-3539] start adding tests for process list cloud * [ADF-3539] fixed empty templates unit tests * [ADF-3539] added documentation * [ADF-3539] missed import * [ADF-3539] fixed wrong export * [ADF-3539] removed model * [ADF-3539] fixed style problem and removed wrong comment
This commit is contained in:
@@ -115,6 +115,13 @@ export let fakeProcessInstancesWithNoName = {
|
||||
]
|
||||
};
|
||||
|
||||
export let fakeProcessInstancesEmpty = {
|
||||
size: 0,
|
||||
total: 0,
|
||||
start: 0,
|
||||
data: []
|
||||
};
|
||||
|
||||
export let fakeProcessCustomSchema = [
|
||||
new ObjectDataColumn({
|
||||
key: 'fakeName',
|
||||
|
@@ -104,3 +104,10 @@ export let fakeColumnSchema = {
|
||||
],
|
||||
fakeCustomSchema
|
||||
};
|
||||
|
||||
export let fakeEmptyTask = {
|
||||
size: 0,
|
||||
start: 0,
|
||||
total: 0,
|
||||
data: []
|
||||
};
|
||||
|
@@ -15,20 +15,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, SimpleChange, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
import { ProcessInstanceListComponent } from './process-list.component';
|
||||
|
||||
import { AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService, setupTestBed, CoreModule, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DataRowEvent, ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
|
||||
|
||||
import { fakeProcessInstance, fakeProcessInstancesWithNoName } from '../../mock';
|
||||
import { fakeProcessInstance, fakeProcessInstancesWithNoName, fakeProcessInstancesEmpty } from '../../mock';
|
||||
import { ProcessService } from '../services/process.service';
|
||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||
import { fakeProcessCustomSchema } from '../../mock';
|
||||
import { ProcessListModule } from 'process-list/process-list.module';
|
||||
|
||||
describe('ProcessInstanceListComponent', () => {
|
||||
|
||||
@@ -506,27 +507,28 @@ describe('CustomProcessListComponent', () => {
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<adf-process-instance-list>
|
||||
<adf-empty-content-holder>
|
||||
<adf-process-instance-list [appId]="1">
|
||||
<adf-empty-custom-content>
|
||||
<p id="custom-id"> No Process Instance</p>
|
||||
</adf-empty-content-holder>
|
||||
</adf-empty-custom-content>
|
||||
</adf-process-instance-list>
|
||||
`
|
||||
})
|
||||
class EmptyTemplateComponent {
|
||||
}
|
||||
|
||||
describe('Process List: Custom EmptyTemplateComponent', () => {
|
||||
let fixture: ComponentFixture<EmptyTemplateComponent>;
|
||||
let processService: ProcessService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [EmptyTemplateComponent],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
imports: [ProcessTestingModule, ProcessListModule, DataTableModule],
|
||||
declarations: [EmptyTemplateComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EmptyTemplateComponent);
|
||||
processService = TestBed.get(ProcessService);
|
||||
spyOn(processService, 'getProcessInstances').and.returnValue(of(fakeProcessInstancesEmpty));
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -534,13 +536,14 @@ describe('Process List: Custom EmptyTemplateComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should render the custom template', async(() => {
|
||||
it('should render the custom template', (done) => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let title = fixture.debugElement.query(By.css('#custom-id'));
|
||||
expect(title).not.toBeNull();
|
||||
expect(title.nativeElement.innerText).toBe('No Process Instance');
|
||||
expect(fixture.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@@ -15,17 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, SimpleChange, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService, setupTestBed, CoreModule, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DataRowEvent, ObjectDataRow } from '@alfresco/adf-core';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
import { TaskListComponent } from './task-list.component';
|
||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||
import { fakeGlobalTask, fakeCustomSchema } from '../../mock';
|
||||
import { fakeGlobalTask, fakeCustomSchema, fakeEmptyTask } from '../../mock';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { of } from 'rxjs';
|
||||
import { TaskListModule } from 'task-list/task-list.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -567,10 +568,10 @@ describe('CustomTaskListComponent', () => {
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<adf-tasklist>
|
||||
<adf-empty-content-holder>
|
||||
<p id="custom-id"></p>
|
||||
</adf-empty-content-holder>
|
||||
<adf-tasklist [appId]="1">
|
||||
<adf-empty-custom-content>
|
||||
<p id="custom-id">CUSTOM EMPTY</p>
|
||||
</adf-empty-custom-content>
|
||||
</adf-tasklist>
|
||||
`
|
||||
})
|
||||
@@ -580,19 +581,20 @@ class EmptyTemplateComponent {
|
||||
describe('Task List: Custom EmptyTemplateComponent', () => {
|
||||
let fixture: ComponentFixture<EmptyTemplateComponent>;
|
||||
let translateService: TranslateService;
|
||||
let taskListService: TaskListService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [EmptyTemplateComponent],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
imports: [ProcessTestingModule, TaskListModule, DataTableModule],
|
||||
declarations: [EmptyTemplateComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
translateService = TestBed.get(TranslateService);
|
||||
taskListService = TestBed.get(TaskListService);
|
||||
spyOn(translateService, 'get').and.callFake((key) => {
|
||||
return of(key);
|
||||
});
|
||||
|
||||
spyOn(taskListService, 'findTasksByState').and.returnValue(of(fakeEmptyTask));
|
||||
fixture = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@@ -601,10 +603,12 @@ describe('Task List: Custom EmptyTemplateComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should render the custom template', fakeAsync(() => {
|
||||
it('should render the custom template', (done) => {
|
||||
fixture.detectChanges();
|
||||
tick(100);
|
||||
expect(fixture.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixture.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
}));
|
||||
fixture.whenStable().then(() => {
|
||||
expect(fixture.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixture.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user