[ADF-587] upgrade components to angular 4 (#1866)

[ADF-587]  upgrade components to angular 4
This commit is contained in:
Denys Vuika
2017-05-09 09:45:11 +01:00
committed by Eugenio Romano
parent 5ba1202292
commit e29741d18d
48 changed files with 297 additions and 270 deletions

View File

@@ -35,15 +35,16 @@
"alfresco"
],
"dependencies": {
"@angular/common": "2.4.7",
"@angular/compiler": "2.4.7",
"@angular/core": "2.4.7",
"@angular/forms": "2.4.7",
"@angular/http": "2.4.7",
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"@angular/material": "2.0.0-beta.1",
"@angular/platform-browser": "2.4.7",
"@angular/platform-browser-dynamic": "2.4.7",
"@angular/router": "3.4.7",
"alfresco-js-api": "~1.4.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",

View File

@@ -53,7 +53,7 @@ describe('ActivitiFilters', () => {
it('should return the filter task list', (done) => {
spyOn(activitiService, 'getProcessFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
filterList.onSuccess.subscribe((res) => {
@@ -77,7 +77,7 @@ describe('ActivitiFilters', () => {
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
spyOn(activitiService, 'getProcessFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
let change = new SimpleChange(null, 'test');
let change = new SimpleChange(null, 'test', true);
filterList.ngOnChanges({ 'appName': change });
filterList.onSuccess.subscribe((res) => {
@@ -94,7 +94,7 @@ describe('ActivitiFilters', () => {
spyOn(activitiService, 'getProcessFilters').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
filterList.onError.subscribe((err) => {
@@ -109,7 +109,7 @@ describe('ActivitiFilters', () => {
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
const appId = 'fake-app';
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appName': change });
filterList.onError.subscribe((err) => {
@@ -137,7 +137,7 @@ describe('ActivitiFilters', () => {
spyOn(filterList, 'getFiltersByAppId').and.stub();
const appId = '1';
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -147,7 +147,7 @@ describe('ActivitiFilters', () => {
spyOn(filterList, 'getFiltersByAppId').and.stub();
const appId = null;
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.getFiltersByAppId).toHaveBeenCalledWith(appId);
@@ -157,7 +157,7 @@ describe('ActivitiFilters', () => {
spyOn(filterList, 'getFiltersByAppName').and.stub();
const appName = 'fake-app-name';
let change = new SimpleChange(null, appName);
let change = new SimpleChange(null, appName, true);
filterList.ngOnChanges({ 'appName': change });
expect(filterList.getFiltersByAppName).toHaveBeenCalledWith(appName);

View File

@@ -75,7 +75,7 @@ describe('ActivitiProcessInstanceComments', () => {
});
it('should load comments when processInstanceId specified', () => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(getCommentsSpy).toHaveBeenCalled();
});
@@ -83,7 +83,7 @@ describe('ActivitiProcessInstanceComments', () => {
it('should emit an error when an error occurs loading comments', () => {
let emitSpy = spyOn(component.error, 'emit');
getCommentsSpy.and.returnValue(Observable.throw({}));
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(emitSpy).toHaveBeenCalled();
});
@@ -94,7 +94,7 @@ describe('ActivitiProcessInstanceComments', () => {
});
it('should display comments when the process has comments', async(() => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
fixture.whenStable().then(() => {
@@ -115,8 +115,8 @@ describe('ActivitiProcessInstanceComments', () => {
describe('change detection', () => {
let change = new SimpleChange('123', '456');
let nullChange = new SimpleChange('123', null);
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.processInstanceId = '123';

View File

@@ -85,7 +85,7 @@ describe('ActivitiProcessInstanceDetails', () => {
it('should display a header when the processInstanceId is provided', async(() => {
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123') });
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123', true) });
fixture.whenStable().then(() => {
fixture.detectChanges();
let headerEl: DebugElement = fixture.debugElement.query(By.css('h2'));
@@ -97,7 +97,7 @@ describe('ActivitiProcessInstanceDetails', () => {
it('should display default details when the process instance has no name', async(() => {
getProcessSpy = getProcessSpy.and.returnValue(Observable.of(exampleProcessNoName));
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123') });
component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123', true) });
fixture.whenStable().then(() => {
fixture.detectChanges();
let headerEl: DebugElement = fixture.debugElement.query(By.css('h2'));
@@ -108,8 +108,8 @@ describe('ActivitiProcessInstanceDetails', () => {
describe('change detection', () => {
let change = new SimpleChange('123', '456');
let nullChange = new SimpleChange('123', null);
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.processInstanceId = '123';

View File

@@ -104,7 +104,7 @@ describe('ActivitiProcessInstanceTasks', () => {
});
it('should display active tasks', () => {
let change = new SimpleChange(null, exampleProcessInstance);
let change = new SimpleChange(null, exampleProcessInstance, true);
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceDetails': change });
fixture.whenStable().then(() => {
@@ -117,7 +117,7 @@ describe('ActivitiProcessInstanceTasks', () => {
});
it('should display completed tasks', () => {
let change = new SimpleChange(null, exampleProcessInstance);
let change = new SimpleChange(null, exampleProcessInstance, true);
fixture.detectChanges();
component.ngOnChanges({ 'processInstanceDetails': change });
fixture.whenStable().then(() => {

View File

@@ -145,8 +145,8 @@ describe('ActivitiProcessInstanceVariables', () => {
describe('change detection', () => {
let change = new SimpleChange('123', '456');
let nullChange = new SimpleChange('123', null);
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.processInstanceId = '123';

View File

@@ -295,7 +295,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should reload the list when the appId parameter changes', (done) => {
const appId = '1';
let change = new SimpleChange(null, appId);
let change = new SimpleChange(null, appId, true);
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
@@ -311,7 +311,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should reload the list when the processDefinitionKey parameter changes', (done) => {
const processDefinitionKey = 'fakeprocess';
let change = new SimpleChange(null, processDefinitionKey);
let change = new SimpleChange(null, processDefinitionKey, true);
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
@@ -327,7 +327,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should reload the list when the state parameter changes', (done) => {
const state = 'open';
let change = new SimpleChange(null, state);
let change = new SimpleChange(null, state, true);
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
@@ -343,7 +343,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should reload the list when the sort parameter changes', (done) => {
const sort = 'created-desc';
let change = new SimpleChange(null, sort);
let change = new SimpleChange(null, sort, true);
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
@@ -359,7 +359,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should sort the list when the sort parameter changes', (done) => {
const sort = 'created-asc';
let change = new SimpleChange(null, sort);
let change = new SimpleChange(null, sort, true);
let sortSpy = spyOn(component.data, 'setSorting');
component.onSuccess.subscribe((res) => {
@@ -374,7 +374,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
it('should reload the process list when the name parameter changes', (done) => {
const name = 'FakeTaskName';
let change = new SimpleChange(null, name);
let change = new SimpleChange(null, name, true);
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();

View File

@@ -78,7 +78,7 @@ describe('ActivitiStartProcessInstance', () => {
describe('process definitions list', () => {
it('should call service to fetch process definitions', () => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -86,7 +86,7 @@ describe('ActivitiStartProcessInstance', () => {
});
it('should call service to fetch process definitions with appId when provided', () => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -94,7 +94,7 @@ describe('ActivitiStartProcessInstance', () => {
});
it('should display the correct number of processes in the select list', () => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -103,7 +103,7 @@ describe('ActivitiStartProcessInstance', () => {
});
it('should display the correct process def details', async(() => {
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -116,7 +116,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should indicate an error to the user if process defs cannot be loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.throw({}));
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -129,7 +129,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should show no process available message when no process definition is loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of([]));
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
@@ -144,8 +144,8 @@ describe('ActivitiStartProcessInstance', () => {
describe('input changes', () => {
let change = new SimpleChange('123', '456');
let nullChange = new SimpleChange('123', null);
let change = new SimpleChange('123', '456', true);
let nullChange = new SimpleChange('123', null, true);
beforeEach(async(() => {
component.appId = '123';
@@ -177,7 +177,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(() => {
component.name = 'My new process';
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
});
@@ -247,7 +247,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(async(() => {
component.name = 'My new process';
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
component.onProcessDefChange('my:process1');
@@ -279,7 +279,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(() => {
getDefinitionsSpy.and.returnValue(Observable.of(fakeProcessDefWithForm));
let change = new SimpleChange(null, '123');
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.onProcessDefChange('my:process1');
fixture.detectChanges();