mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[ADF-5076] Automate tastrail case (#5463)
This commit is contained in:
@@ -283,4 +283,25 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should be possible update a date/date-time', async(() => {
|
||||||
|
component.editable = true;
|
||||||
|
component.property.editable = true;
|
||||||
|
component.property.default = 'Jul 10 2017';
|
||||||
|
component.property.key = 'fake-key';
|
||||||
|
component.property.value = 'Jul 10 2017';
|
||||||
|
const expectedDate = moment('Jul 10 2018', 'MMM DD YY');
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
const element = fixture.debugElement.nativeElement.querySelector('span[data-automation-id="card-date-value-fake-key"]');
|
||||||
|
expect(element).toBeDefined();
|
||||||
|
expect(element.innerText).toEqual('Jul 10, 2017');
|
||||||
|
component.onDateChanged({ value: expectedDate });
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => expect(component.property.value).toEqual(expectedDate.toDate()));
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ObjectDataColumn } from '@alfresco/adf-core';
|
import { ObjectDataColumn } from '@alfresco/adf-core';
|
||||||
|
|
||||||
export let fakeGlobalTask = {
|
export const fakeGlobalTask = {
|
||||||
size: 2,
|
size: 2,
|
||||||
start: 0,
|
start: 0,
|
||||||
total: 2,
|
total: 2,
|
||||||
@@ -111,3 +111,165 @@ export let fakeEmptyTask = {
|
|||||||
total: 0,
|
total: 0,
|
||||||
data: []
|
data: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const paginatedTask = {
|
||||||
|
'size': 5,
|
||||||
|
'total': 9,
|
||||||
|
'start': 0,
|
||||||
|
'data': [{
|
||||||
|
'id': '69211',
|
||||||
|
'name': 'My Task Name',
|
||||||
|
'description': '',
|
||||||
|
'category': null,
|
||||||
|
'assignee': {'id': 1493, 'firstName': 'fake name', 'lastName': 'fake', 'email': 'abc@test.com'},
|
||||||
|
'created': '2020-02-06T18:41:21.587+0000',
|
||||||
|
'dueDate': null,
|
||||||
|
'endDate': null,
|
||||||
|
'duration': null,
|
||||||
|
'priority': 50,
|
||||||
|
'parentTaskId': null,
|
||||||
|
'parentTaskName': null,
|
||||||
|
'processInstanceId': null,
|
||||||
|
'processInstanceName': null,
|
||||||
|
'processDefinitionId': null,
|
||||||
|
'processDefinitionName': null,
|
||||||
|
'processDefinitionDescription': null,
|
||||||
|
'processDefinitionKey': null,
|
||||||
|
'processDefinitionCategory': null,
|
||||||
|
'processDefinitionVersion': 0,
|
||||||
|
'processDefinitionDeploymentId': null,
|
||||||
|
'formKey': null,
|
||||||
|
'processInstanceStartUserId': null,
|
||||||
|
'initiatorCanCompleteTask': false,
|
||||||
|
'adhocTaskCanBeReassigned': false,
|
||||||
|
'taskDefinitionKey': null,
|
||||||
|
'executionId': null,
|
||||||
|
'memberOfCandidateGroup': false,
|
||||||
|
'memberOfCandidateUsers': false,
|
||||||
|
'managerOfCandidateGroup': false
|
||||||
|
}, {
|
||||||
|
'id': '61054',
|
||||||
|
'name': null,
|
||||||
|
'description': null,
|
||||||
|
'category': null,
|
||||||
|
'assignee': {'id': 19, 'firstName': 'Mm9ntWGB', 'lastName': 'jfQOzSDL', 'email': 'c4jly@activiti.test.com'},
|
||||||
|
'created': '2020-02-06T15:26:32.488+0000',
|
||||||
|
'dueDate': null,
|
||||||
|
'endDate': null,
|
||||||
|
'duration': null,
|
||||||
|
'priority': 50,
|
||||||
|
'parentTaskId': null,
|
||||||
|
'parentTaskName': null,
|
||||||
|
'processInstanceId': '61049',
|
||||||
|
'processInstanceName': null,
|
||||||
|
'processDefinitionId': 'upload:1:50118',
|
||||||
|
'processDefinitionName': 'upload',
|
||||||
|
'processDefinitionDescription': null,
|
||||||
|
'processDefinitionKey': 'upload',
|
||||||
|
'processDefinitionCategory': 'http://www.activiti.org/processdef',
|
||||||
|
'processDefinitionVersion': 1,
|
||||||
|
'processDefinitionDeploymentId': '50115',
|
||||||
|
'formKey': '8474',
|
||||||
|
'processInstanceStartUserId': null,
|
||||||
|
'initiatorCanCompleteTask': false,
|
||||||
|
'adhocTaskCanBeReassigned': false,
|
||||||
|
'taskDefinitionKey': 'sid-7A12380E-28F8-4B15-9326-C5CFB8DD5BBC',
|
||||||
|
'executionId': '61049',
|
||||||
|
'memberOfCandidateGroup': false,
|
||||||
|
'memberOfCandidateUsers': false,
|
||||||
|
'managerOfCandidateGroup': false
|
||||||
|
}, {
|
||||||
|
'id': '61048',
|
||||||
|
'name': 'My Task Name',
|
||||||
|
'description': null,
|
||||||
|
'category': null,
|
||||||
|
'assignee': {'id': 1493, 'firstName': 'fake name', 'lastName': 'fake', 'email': 'abc@test.com'},
|
||||||
|
'created': '2020-02-06T15:26:03.012+0000',
|
||||||
|
'dueDate': null,
|
||||||
|
'endDate': null,
|
||||||
|
'duration': null,
|
||||||
|
'priority': 50,
|
||||||
|
'parentTaskId': null,
|
||||||
|
'parentTaskName': null,
|
||||||
|
'processInstanceId': null,
|
||||||
|
'processInstanceName': null,
|
||||||
|
'processDefinitionId': null,
|
||||||
|
'processDefinitionName': null,
|
||||||
|
'processDefinitionDescription': null,
|
||||||
|
'processDefinitionKey': null,
|
||||||
|
'processDefinitionCategory': null,
|
||||||
|
'processDefinitionVersion': 0,
|
||||||
|
'processDefinitionDeploymentId': null,
|
||||||
|
'formKey': null,
|
||||||
|
'processInstanceStartUserId': null,
|
||||||
|
'initiatorCanCompleteTask': false,
|
||||||
|
'adhocTaskCanBeReassigned': false,
|
||||||
|
'taskDefinitionKey': null,
|
||||||
|
'executionId': null,
|
||||||
|
'memberOfCandidateGroup': false,
|
||||||
|
'memberOfCandidateUsers': false,
|
||||||
|
'managerOfCandidateGroup': false
|
||||||
|
}, {
|
||||||
|
'id': '54705',
|
||||||
|
'name': 'My Task Name',
|
||||||
|
'description': '',
|
||||||
|
'category': '1349',
|
||||||
|
'assignee': {'id': 1493, 'firstName': 'fake name', 'lastName': 'fake', 'email': 'abc@test.com'},
|
||||||
|
'created': '2020-02-06T13:01:23.403+0000',
|
||||||
|
'dueDate': null,
|
||||||
|
'endDate': null,
|
||||||
|
'duration': null,
|
||||||
|
'priority': 50,
|
||||||
|
'parentTaskId': null,
|
||||||
|
'parentTaskName': null,
|
||||||
|
'processInstanceId': null,
|
||||||
|
'processInstanceName': null,
|
||||||
|
'processDefinitionId': null,
|
||||||
|
'processDefinitionName': null,
|
||||||
|
'processDefinitionDescription': null,
|
||||||
|
'processDefinitionKey': null,
|
||||||
|
'processDefinitionCategory': null,
|
||||||
|
'processDefinitionVersion': 0,
|
||||||
|
'processDefinitionDeploymentId': null,
|
||||||
|
'formKey': null,
|
||||||
|
'processInstanceStartUserId': null,
|
||||||
|
'initiatorCanCompleteTask': false,
|
||||||
|
'adhocTaskCanBeReassigned': false,
|
||||||
|
'taskDefinitionKey': null,
|
||||||
|
'executionId': null,
|
||||||
|
'memberOfCandidateGroup': false,
|
||||||
|
'memberOfCandidateUsers': false,
|
||||||
|
'managerOfCandidateGroup': false
|
||||||
|
}, {
|
||||||
|
'id': '50158',
|
||||||
|
'name': 'My Task Name',
|
||||||
|
'description': '',
|
||||||
|
'category': '1349',
|
||||||
|
'assignee': {'id': 1493, 'firstName': 'fake name', 'lastName': 'fake', 'email': 'abc@test.com'},
|
||||||
|
'created': '2020-02-06T09:13:55.532+0000',
|
||||||
|
'dueDate': '2019-01-09T11:53:00.000+0000',
|
||||||
|
'endDate': null,
|
||||||
|
'duration': null,
|
||||||
|
'priority': 0,
|
||||||
|
'parentTaskId': null,
|
||||||
|
'parentTaskName': null,
|
||||||
|
'processInstanceId': null,
|
||||||
|
'processInstanceName': null,
|
||||||
|
'processDefinitionId': null,
|
||||||
|
'processDefinitionName': null,
|
||||||
|
'processDefinitionDescription': null,
|
||||||
|
'processDefinitionKey': null,
|
||||||
|
'processDefinitionCategory': null,
|
||||||
|
'processDefinitionVersion': 0,
|
||||||
|
'processDefinitionDeploymentId': null,
|
||||||
|
'formKey': '8484',
|
||||||
|
'processInstanceStartUserId': null,
|
||||||
|
'initiatorCanCompleteTask': false,
|
||||||
|
'adhocTaskCanBeReassigned': false,
|
||||||
|
'taskDefinitionKey': null,
|
||||||
|
'executionId': null,
|
||||||
|
'memberOfCandidateGroup': false,
|
||||||
|
'memberOfCandidateUsers': false,
|
||||||
|
'managerOfCandidateGroup': false
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
@@ -22,7 +22,7 @@ import { AppConfigService, setupTestBed, CoreModule, DataTableModule, DataRowEve
|
|||||||
import { TaskListService } from '../services/tasklist.service';
|
import { TaskListService } from '../services/tasklist.service';
|
||||||
import { TaskListComponent } from './task-list.component';
|
import { TaskListComponent } from './task-list.component';
|
||||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||||
import { fakeGlobalTask, fakeCustomSchema, fakeEmptyTask } from '../../mock';
|
import { fakeGlobalTask, fakeCustomSchema, fakeEmptyTask, paginatedTask } from '../../mock';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { TaskListModule } from '../task-list.module';
|
import { TaskListModule } from '../task-list.module';
|
||||||
@@ -33,6 +33,7 @@ describe('TaskListComponent', () => {
|
|||||||
let component: TaskListComponent;
|
let component: TaskListComponent;
|
||||||
let fixture: ComponentFixture<TaskListComponent>;
|
let fixture: ComponentFixture<TaskListComponent>;
|
||||||
let appConfig: AppConfigService;
|
let appConfig: AppConfigService;
|
||||||
|
let taskListService: TaskListService;
|
||||||
|
|
||||||
setupTestBed({
|
setupTestBed({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -46,6 +47,7 @@ describe('TaskListComponent', () => {
|
|||||||
|
|
||||||
fixture = TestBed.createComponent(TaskListComponent);
|
fixture = TestBed.createComponent(TaskListComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
taskListService = TestBed.get(TaskListService);
|
||||||
|
|
||||||
appConfig.config = Object.assign(appConfig.config, {
|
appConfig.config = Object.assign(appConfig.config, {
|
||||||
'adf-task-list': {
|
'adf-task-list': {
|
||||||
@@ -532,6 +534,28 @@ describe('TaskListComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show the updated list when pagination changes', async(() => {
|
||||||
|
spyOn(taskListService, 'findTasksByState').and.returnValues(of(fakeGlobalTask), of(paginatedTask));
|
||||||
|
const state = new SimpleChange(null, 'open', true);
|
||||||
|
const processDefinitionKey = new SimpleChange(null, null, true);
|
||||||
|
const assignment = new SimpleChange(null, 'fake-assignee', true);
|
||||||
|
component.ngAfterContentInit();
|
||||||
|
component.ngOnChanges({ 'state': state, 'processDefinitionKey': processDefinitionKey, 'assignment': assignment });
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
let rows = Array.from(fixture.debugElement.nativeElement.querySelectorAll('.adf-datatable-body adf-datatable-row'));
|
||||||
|
expect(rows.length).toEqual(2);
|
||||||
|
component.updatePagination({ skipCount: 0, maxItems: 5 });
|
||||||
|
fixture.detectChanges();
|
||||||
|
rows = Array.from(fixture.debugElement.nativeElement.querySelectorAll('.adf-datatable-body adf-datatable-row'));
|
||||||
|
expect(rows.length).toEqual(5);
|
||||||
|
expect(taskListService.findTasksByState).toHaveBeenCalledTimes(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
Reference in New Issue
Block a user