mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ADF-2056] update dependencies (#2764)
* update dependencies add ban for fdescribe in tslint reenable test add badge codacy check bundles esm5 and esm2015 travis run new vuild script * remove fdescribe * material 5.0.0 stable release
This commit is contained in:
parent
321c4f48e1
commit
a99c1a37e4
@ -15,6 +15,7 @@ env:
|
||||
- MODULE=process-services
|
||||
- MODULE=content-services
|
||||
- MODULE=demo-shell
|
||||
- MODULE=packaging
|
||||
|
||||
install:
|
||||
- if ([ "$MODULE" != "demo-shell" ]); then
|
||||
@ -42,6 +43,10 @@ script:
|
||||
(./scripts/npm-build-all.sh -si -sb -t "content-services" || exit 1;);
|
||||
fi
|
||||
|
||||
- if ([ "$MODULE" == "packaging" ]); then
|
||||
(cd lib && npm run new-build || exit 1;);
|
||||
fi
|
||||
|
||||
- if ([ "$MODULE" == "demo-shell" ]); then
|
||||
if ([ "$TRAVIS_BRANCH" = "master" ]); then
|
||||
(./scripts/start.sh -t -ss || exit 1;);
|
||||
|
@ -1,5 +1,6 @@
|
||||
# ALFRESCO ANGULAR COMPONENTS
|
||||
|
||||
[](https://www.codacy.com/app/Alfresco/alfresco-ng2-components?utm_source=github.com&utm_medium=referral&utm_content=Alfresco/alfresco-ng2-components&utm_campaign=badger)
|
||||
[](https://gitter.im/Alfresco/alfresco-ng2-components?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
<p>
|
||||
|
@ -6,12 +6,12 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --app dist --open --aot=false",
|
||||
"start:dev": "npm run lint && npm run style:dev & npm run clean-lib-angular && npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open",
|
||||
"start:dev": "npm run lint && npm run server-versions && rimraf dist && npm run clean-lib-angular && concurrently \"ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open\" \"npm run style:dev - --watch\" ",
|
||||
"start:dist": "npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng serve --prod --build-optimizer=false --aot=false --host 0.0.0.0 --disable-host-check --app dist",
|
||||
"build": "npm run server-versions && rimraf dist && ng build --app dist",
|
||||
"build:dev": "npm run lint && npm run style:dev & npm run server-versions && rimraf dist && ng build --app dev",
|
||||
"build:dist": "npm run style:dev & npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng build --prod --build-optimizer=false --aot=false --app dist",
|
||||
"style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail --watch",
|
||||
"build:dev": "npm run lint && npm run style:dev && npm run server-versions && rimraf dist && ng build --app dev",
|
||||
"build:dist": "npm run style:dev && npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng build --prod --build-optimizer=false --aot=false --app dist",
|
||||
"style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
@ -60,18 +60,18 @@
|
||||
],
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "5.0.0",
|
||||
"@angular/cdk": "5.0.0-rc0",
|
||||
"@angular/common": "5.0.0",
|
||||
"@angular/compiler": "5.0.0",
|
||||
"@angular/core": "5.0.0",
|
||||
"@angular/animations": "5.0.5",
|
||||
"@angular/cdk": "5.0.0",
|
||||
"@angular/common": "5.0.5",
|
||||
"@angular/compiler": "5.0.5",
|
||||
"@angular/core": "5.0.5",
|
||||
"@angular/flex-layout": "2.0.0-beta.10",
|
||||
"@angular/forms": "5.0.0",
|
||||
"@angular/http": "5.0.0",
|
||||
"@angular/material": "5.0.0-rc0",
|
||||
"@angular/platform-browser": "5.0.0",
|
||||
"@angular/platform-browser-dynamic": "5.0.0",
|
||||
"@angular/router": "5.0.0",
|
||||
"@angular/forms": "5.0.5",
|
||||
"@angular/http": "5.0.5",
|
||||
"@angular/material": "5.0.0",
|
||||
"@angular/platform-browser": "5.0.5",
|
||||
"@angular/platform-browser-dynamic": "5.0.5",
|
||||
"@angular/router": "5.0.5",
|
||||
"@ngx-translate/core": "8.0.0",
|
||||
"alfresco-js-api": "2.0.0",
|
||||
"@alfresco/adf-content-services": "2.0.0",
|
||||
@ -97,12 +97,13 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "1.5.0",
|
||||
"@angular/compiler-cli": "^5.0.0",
|
||||
"@angular/language-service": "^5.0.0",
|
||||
"@angular/compiler-cli": "5.0.5",
|
||||
"@angular/language-service": "5.0.5",
|
||||
"@types/jasmine": "~2.5.53",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/node": "~6.0.60",
|
||||
"codelyzer": "4.0.0",
|
||||
"concurrently": "^3.5.1",
|
||||
"jasmine-core": "~2.6.2",
|
||||
"jasmine-spec-reporter": "~4.1.0",
|
||||
"karma": "~1.7.0",
|
||||
|
@ -9,7 +9,8 @@
|
||||
<adf-info-drawer-tab label="Versions">
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
Versions go here...
|
||||
<adf-version-manager [node]="node">
|
||||
</adf-version-manager>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</adf-info-drawer-tab>
|
||||
@ -49,4 +50,4 @@
|
||||
</extension-viewer>
|
||||
-->
|
||||
</adf-viewer>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
@ -34,32 +34,17 @@ export class DownloadZipDialogComponent implements OnInit {
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private dialogRef: MatDialogRef<DownloadZipDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) private data: { nodeIds?: string[] },
|
||||
@Inject(MAT_DIALOG_DATA) private data: any,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
private get downloadsApi() {
|
||||
return this.apiService.getInstance().core.downloadsApi;
|
||||
}
|
||||
|
||||
private get nodesApi() {
|
||||
return this.apiService.getInstance().core.nodesApi;
|
||||
}
|
||||
|
||||
private get contentApi() {
|
||||
return this.apiService.getInstance().content;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data && this.data.nodeIds && this.data.nodeIds.length > 0) {
|
||||
// change timeout to have a delay for demo purposes
|
||||
setTimeout(() => {
|
||||
if (!this.cancelled) {
|
||||
this.downloadZip(this.data.nodeIds);
|
||||
} else {
|
||||
this.logService.log('Cancelled');
|
||||
}
|
||||
}, 0);
|
||||
if (!this.cancelled) {
|
||||
this.downloadZip(this.data.nodeIds);
|
||||
} else {
|
||||
this.logService.log('Cancelled');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +56,7 @@ export class DownloadZipDialogComponent implements OnInit {
|
||||
downloadZip(nodeIds: string[]) {
|
||||
if (nodeIds && nodeIds.length > 0) {
|
||||
|
||||
const promise: any = this.downloadsApi.createDownload({ nodeIds });
|
||||
const promise: any = this.apiService.getInstance().core.downloadsApi.createDownload({ nodeIds });
|
||||
|
||||
promise.on('progress', progress => this.logService.log('Progress', progress));
|
||||
promise.on('error', error => this.logService.error('Error', error));
|
||||
@ -79,9 +64,9 @@ export class DownloadZipDialogComponent implements OnInit {
|
||||
|
||||
promise.on('success', (data: DownloadEntry) => {
|
||||
if (data && data.entry && data.entry.id) {
|
||||
const url = this.contentApi.getContentUrl(data.entry.id, true);
|
||||
// the call is needed only to get the name of the package
|
||||
this.nodesApi.getNode(data.entry.id).then((downloadNode: MinimalNodeEntity) => {
|
||||
const url = this.apiService.getInstance().content.getContentUrl(data.entry.id, true);
|
||||
|
||||
this.apiService.getInstance().core.nodesApi.getNode(data.entry.id).then((downloadNode: MinimalNodeEntity) => {
|
||||
this.logService.log(downloadNode);
|
||||
const fileName = downloadNode.entry.name;
|
||||
this.waitAndDownload(data.entry.id, url, fileName);
|
||||
@ -96,9 +81,9 @@ export class DownloadZipDialogComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.downloadsApi.getDownload(downloadId).then((d: DownloadEntry) => {
|
||||
if (d.entry) {
|
||||
if (d.entry.status === 'DONE') {
|
||||
this.apiService.getInstance().core.downloadsApi.getDownload(downloadId).then((downloadEntry: DownloadEntry) => {
|
||||
if (downloadEntry.entry) {
|
||||
if (downloadEntry.entry.status === 'DONE') {
|
||||
this.download(url, fileName);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
|
@ -153,7 +153,7 @@ describe('DropdownSitesComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.innerText.trim()).toBe('DROPDOWN.PLACEHOLDER_LABEL');
|
||||
expect(fixture.nativeElement.innerText.trim()).toContain('DROPDOWN.PLACEHOLDER_LABEL');
|
||||
});
|
||||
}));
|
||||
|
||||
@ -166,7 +166,7 @@ describe('DropdownSitesComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.innerText.trim()).toBe('NODE_SELECTOR.SELECT_LOCATION');
|
||||
expect(fixture.nativeElement.innerText.trim()).toContain('NODE_SELECTOR.SELECT_LOCATION');
|
||||
});
|
||||
}));
|
||||
|
||||
|
@ -37,23 +37,21 @@ describe('WebscriptComponent', () => {
|
||||
declarations: [
|
||||
WebscriptComponent
|
||||
]
|
||||
}).compileComponents();
|
||||
}).compileComponents().then(()=>{
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
fixture = TestBed.createComponent(WebscriptComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
element = fixture.nativeElement;
|
||||
component = fixture.componentInstance;
|
||||
component.scriptPath = 'fakePath';
|
||||
component.showData = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
fixture = TestBed.createComponent(WebscriptComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
element = fixture.nativeElement;
|
||||
component = fixture.componentInstance;
|
||||
component.scriptPath = 'fakePath';
|
||||
component.showData = true;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
describe('View', () => {
|
||||
it('html wrapper should be present', () => {
|
||||
expect(element.querySelector('#webscript-html-wrapper')).toBeDefined();
|
||||
|
@ -18,10 +18,7 @@
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
|
||||
export function startupServiceFactory(configService: AppConfigService): Function {
|
||||
return () => configService.load();
|
||||
}
|
||||
import { startupServiceFactory } from './startup-service-factory';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
22
lib/core/app-config/startup-service-factory.ts
Normal file
22
lib/core/app-config/startup-service-factory.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AppConfigService } from './app-config.service';
|
||||
|
||||
export function startupServiceFactory(configService: AppConfigService): Function {
|
||||
return () => configService.load();
|
||||
}
|
@ -104,9 +104,9 @@ describe('FormComponent UI and visibiltiy', () => {
|
||||
const optTwo = fixture.debugElement.queryAll(By.css('[id="mat-option-2"]'));
|
||||
const optThree = fixture.debugElement.queryAll(By.css('[id="mat-option-3"]'));
|
||||
|
||||
expect(optOne[0].nativeElement.innerText).toEqual('united kingdom');
|
||||
expect(optTwo[0].nativeElement.innerText).toEqual('italy');
|
||||
expect(optThree[0].nativeElement.innerText).toEqual('france');
|
||||
expect(optOne[0].nativeElement.innerText.trim()).toEqual('united kingdom');
|
||||
expect(optTwo[0].nativeElement.innerText.trim()).toEqual('italy');
|
||||
expect(optThree[0].nativeElement.innerText.trim()).toEqual('france');
|
||||
|
||||
optTwo[0].nativeElement.click();
|
||||
fixture.detectChanges();
|
||||
|
@ -304,7 +304,7 @@ describe('DropdownWidgetComponent', () => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#dropdown-id')).not.toBeNull();
|
||||
const option = fixture.debugElement.query(By.css('.mat-option')).nativeElement;
|
||||
expect(option.innerText).toEqual('FakeValue');
|
||||
expect(option.innerText.trim()).toEqual('FakeValue');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
@ -359,7 +359,7 @@ describe('DynamicTableWidgetComponent', () => {
|
||||
|
||||
expect(element.querySelector('#dynamic-table-fake-dynamic-table')).not.toBeNull();
|
||||
expect(rowElement).not.toBeNull();
|
||||
expect(rowElement.className).toBeFalsy();
|
||||
expect(rowElement.className).not.toContain('adf-dynamic-table-widget__row-selected');
|
||||
|
||||
let event: any = new Event('keyup');
|
||||
event.keyCode = 32;
|
||||
@ -368,7 +368,7 @@ describe('DynamicTableWidgetComponent', () => {
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
let selectedRow = element.querySelector('#fake-dynamic-table-row-0');
|
||||
expect(selectedRow.className).toBe('adf-dynamic-table-widget__row-selected');
|
||||
expect(selectedRow.className).toContain('adf-dynamic-table-widget__row-selected');
|
||||
});
|
||||
}));
|
||||
|
||||
|
@ -16,14 +16,13 @@
|
||||
*/
|
||||
|
||||
import { Type } from '@angular/core';
|
||||
import { getType } from './get-type';
|
||||
|
||||
export interface DynamicComponentModel { type: string; }
|
||||
export type DynamicComponentResolveFunction = (model: DynamicComponentModel) => Type<{}>;
|
||||
export class DynamicComponentResolver {
|
||||
static fromType(type: Type<{}>): DynamicComponentResolveFunction {
|
||||
return (model: DynamicComponentModel) => {
|
||||
return type;
|
||||
};
|
||||
return getType(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,16 +23,6 @@ import { UserPreferencesService } from './user-preferences.service';
|
||||
|
||||
@Injectable()
|
||||
export class FavoritesApiService {
|
||||
static remapFavoritesData(data: any = {}): NodePaging {
|
||||
const list = (data.list || {});
|
||||
const pagination = (list.pagination || {});
|
||||
const entries: any[] = FavoritesApiService
|
||||
.remapFavoriteEntries(list.entries || []);
|
||||
|
||||
return <NodePaging> {
|
||||
list: { entries, pagination }
|
||||
};
|
||||
}
|
||||
|
||||
static remapEntry({ entry }: any): any {
|
||||
entry.properties = {
|
||||
@ -43,7 +33,18 @@ export class FavoritesApiService {
|
||||
return { entry };
|
||||
}
|
||||
|
||||
static remapFavoriteEntries(entries: any[]) {
|
||||
remapFavoritesData(data: any = {}): NodePaging {
|
||||
const list = (data.list || {});
|
||||
const pagination = (list.pagination || {});
|
||||
const entries: any[] = this
|
||||
.remapFavoriteEntries(list.entries || []);
|
||||
|
||||
return <NodePaging> {
|
||||
list: { entries, pagination }
|
||||
};
|
||||
}
|
||||
|
||||
remapFavoriteEntries(entries: any[]) {
|
||||
return entries
|
||||
.map(({ entry: { target }}: any) => ({
|
||||
entry: target.file || target.folder
|
||||
@ -72,7 +73,7 @@ export class FavoritesApiService {
|
||||
const queryOptions = Object.assign(defaultOptions, options);
|
||||
const promise = favoritesApi
|
||||
.getFavorites(personId, queryOptions)
|
||||
.then(FavoritesApiService.remapFavoritesData);
|
||||
.then(this.remapFavoritesData);
|
||||
|
||||
return Observable
|
||||
.fromPromise(promise)
|
||||
|
20
lib/core/services/get-type.ts
Normal file
20
lib/core/services/get-type.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function getType(type: any): any {
|
||||
return () => type;
|
||||
}
|
@ -29,35 +29,35 @@ import { UserInfoComponent } from './user-info.component';
|
||||
|
||||
class FakeSanitazer extends DomSanitizer {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
sanitize(html) {
|
||||
return html;
|
||||
}
|
||||
|
||||
bypassSecurityTrustHtml(value: string): any {
|
||||
return value;
|
||||
}
|
||||
|
||||
bypassSecurityTrustStyle(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustScript(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustUrl(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustResourceUrl(value: string): any {
|
||||
return null;
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
sanitize(html) {
|
||||
return html;
|
||||
}
|
||||
|
||||
bypassSecurityTrustHtml(value: string): any {
|
||||
return value;
|
||||
}
|
||||
|
||||
bypassSecurityTrustStyle(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustScript(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustUrl(value: string): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustResourceUrl(value: string): any {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('User info component', () => {
|
||||
@ -119,7 +119,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmEditedUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmEditedUser })
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@ -141,7 +141,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmEditedUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmEditedUser })
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@ -157,7 +157,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmEditedUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmEditedUser })
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@ -171,7 +171,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmEditedUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmEditedUser })
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@ -186,7 +186,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmEditedUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmEditedUser })
|
||||
});
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@ -203,7 +203,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmUser })
|
||||
});
|
||||
}));
|
||||
|
||||
@ -262,7 +262,7 @@ describe('User info component', () => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmUserNoImage})
|
||||
responseText: JSON.stringify({ entry: fakeEcmUserNoImage })
|
||||
});
|
||||
fixture.whenStable().then(() => fixture.detectChanges());
|
||||
}));
|
||||
@ -417,20 +417,23 @@ describe('User info component', () => {
|
||||
|
||||
describe('when user is logged on bpm and ecm', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
||||
}));
|
||||
|
||||
beforeEach(async(() => {
|
||||
spyOn(stubAuthService, 'isEcmLoggedIn').and.returnValue(true);
|
||||
spyOn(stubAuthService, 'isBpmLoggedIn').and.returnValue(true);
|
||||
spyOn(stubAuthService, 'isLoggedIn').and.returnValue(true);
|
||||
spyOn(stubContent, 'getContentUrl').and.returnValue('src/assets/images/ecmImg.gif');
|
||||
jasmine.Ajax.install();
|
||||
}));
|
||||
|
||||
beforeEach(async(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
jasmine.Ajax.requests.first().respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({entry: fakeEcmUser})
|
||||
responseText: JSON.stringify({ entry: fakeEcmUser })
|
||||
});
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
@ -441,8 +444,10 @@ describe('User info component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let imageButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#logged-user-img');
|
||||
imageButton.click();
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@ -457,24 +462,28 @@ describe('User info component', () => {
|
||||
let bpmUsername = fixture.debugElement.query(By.css('#bpm-username'));
|
||||
let bpmImage = fixture.debugElement.query(By.css('#bpm-user-detail-image'));
|
||||
|
||||
expect(element.querySelector('#userinfo_container')).not.toBeNull();
|
||||
expect(bpmUsername).not.toBeNull();
|
||||
expect(bpmImage).not.toBeNull();
|
||||
expect(bpmImage.properties.src).toContain('app/rest/admin/profile-picture');
|
||||
expect(bpmUsername.nativeElement.textContent).toContain('fake-bpm-first-name fake-bpm-last-name');
|
||||
expect(fixture.debugElement.query(By.css('#bpm-tenant')).nativeElement.textContent).toContain('fake-tenant-name');
|
||||
fixture.whenStable().then(() => {
|
||||
expect(element.querySelector('#userinfo_container')).not.toBeNull();
|
||||
expect(bpmUsername).not.toBeNull();
|
||||
expect(bpmImage).not.toBeNull();
|
||||
expect(bpmImage.properties.src).toContain('app/rest/admin/profile-picture');
|
||||
expect(bpmUsername.nativeElement.textContent).toContain('fake-bpm-first-name fake-bpm-last-name');
|
||||
expect(fixture.debugElement.query(By.css('#bpm-tenant')).nativeElement.textContent).toContain('fake-tenant-name');
|
||||
});
|
||||
});
|
||||
|
||||
it('should get the ecm user informations from the service', () => {
|
||||
let ecmUsername = fixture.debugElement.query(By.css('#ecm-username'));
|
||||
let ecmImage = fixture.debugElement.query(By.css('#ecm-user-detail-image'));
|
||||
|
||||
expect(element.querySelector('#userinfo_container')).toBeDefined();
|
||||
expect(ecmUsername).not.toBeNull();
|
||||
expect(ecmImage).not.toBeNull();
|
||||
expect(ecmImage.properties.src).toContain('assets/images/ecmImg.gif');
|
||||
expect(fixture.debugElement.query(By.css('#ecm-full-name')).nativeElement.textContent).toContain('fake-ecm-first-name fake-ecm-last-name');
|
||||
expect(fixture.debugElement.query(By.css('#ecm-job-title')).nativeElement.textContent).toContain('job-ecm-test');
|
||||
fixture.whenStable().then(() => {
|
||||
expect(element.querySelector('#userinfo_container')).toBeDefined();
|
||||
expect(ecmUsername).not.toBeNull();
|
||||
expect(ecmImage).not.toBeNull();
|
||||
expect(ecmImage.properties.src).toContain('assets/images/ecmImg.gif');
|
||||
expect(fixture.debugElement.query(By.css('#ecm-full-name')).nativeElement.textContent).toContain('fake-ecm-first-name fake-ecm-last-name');
|
||||
expect(fixture.debugElement.query(By.css('#ecm-job-title')).nativeElement.textContent).toContain('job-ecm-test');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show the ecm image if exists', () => {
|
||||
|
@ -112,7 +112,7 @@ class ViewerWithCustomOpenWithComponent {}
|
||||
})
|
||||
class ViewerWithCustomMoreActionsComponent {}
|
||||
|
||||
fdescribe('ViewerComponent', () => {
|
||||
describe('ViewerComponent', () => {
|
||||
|
||||
let component: ViewerComponent;
|
||||
let fixture: ComponentFixture<ViewerComponent>;
|
||||
|
@ -25,7 +25,7 @@ import { MaterialModule } from '../../material.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
fdescribe('AnalyticsReportParametersComponent', () => {
|
||||
describe('AnalyticsReportParametersComponent', () => {
|
||||
|
||||
let component: AnalyticsReportParametersComponent;
|
||||
let fixture: ComponentFixture<AnalyticsReportParametersComponent>;
|
||||
|
@ -31,9 +31,7 @@ describe('Diagrams boundary', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DiagramsModule
|
||||
]
|
||||
imports: [DiagramsModule]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@ -31,9 +31,7 @@ describe('Diagrams events', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DiagramsModule
|
||||
]
|
||||
imports: [DiagramsModule]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@ -31,11 +31,7 @@ describe('Diagrams swim', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DiagramsModule
|
||||
],
|
||||
declarations: [
|
||||
]
|
||||
imports: [DiagramsModule]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@ -31,36 +31,27 @@ describe('Diagrams throw', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
declarations: [
|
||||
DiagramsModule
|
||||
],
|
||||
providers: [
|
||||
imports: [DiagramsModule]
|
||||
}).compileComponents().then(() => {
|
||||
jasmine.Ajax.install();
|
||||
|
||||
]
|
||||
}).compileComponents();
|
||||
fixture = TestBed.createComponent(DiagramComponent);
|
||||
component = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
component.processInstanceId = '38399';
|
||||
component.processDefinitionId = 'fakeprocess:24:38399';
|
||||
component.metricPercentages = { startEvent: 0 };
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DiagramComponent);
|
||||
component = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
component.processInstanceId = '38399';
|
||||
component.processDefinitionId = 'fakeprocess:24:38399';
|
||||
component.metricPercentages = { startEvent: 0 };
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
component.success.unsubscribe();
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
let ajaxReply = (resp: any) => {
|
||||
let ajaxReply = (resp: any) => {
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'json',
|
||||
|
84
lib/insights/diagram/services/diagrams.service.spec.ts
Normal file
84
lib/insights/diagram/services/diagrams.service.spec.ts
Normal file
@ -0,0 +1,84 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
||||
import { DiagramsService } from './diagrams.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('DiagramsService', () => {
|
||||
|
||||
let service: DiagramsService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule
|
||||
],
|
||||
providers: [
|
||||
DiagramsService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
service = TestBed.get(DiagramsService);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('getProcessDefinitionModel should perform a call against the server', (done) => {
|
||||
service.getProcessDefinitionModel('fake-processDefinitionId').subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getRunningProcessDefinitionModel should perform a call against the server', (done) => {
|
||||
service.getRunningProcessDefinitionModel('fake-processInstanceId').subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200
|
||||
});
|
||||
});
|
||||
|
||||
it('getTagsByNodeId catch errors call', (done) => {
|
||||
service.getProcessDefinitionModel('fake-processDefinitionId').subscribe(() => {
|
||||
}, () => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 403
|
||||
});
|
||||
});
|
||||
});
|
@ -16,7 +16,9 @@
|
||||
*/
|
||||
|
||||
export * from './insights.module';
|
||||
//
|
||||
|
||||
export * from './analytics-process/analytics-process.module';
|
||||
//
|
||||
export * from './diagram/diagram.module';
|
||||
|
||||
export * from './analytics-process';
|
||||
export * from './diagram';
|
||||
|
@ -21,10 +21,9 @@
|
||||
"markdownlint": "markdownlint ../docs",
|
||||
"doc": "npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.doc.js --progress --profile --bail",
|
||||
"docindex": "node config/buildFullDocIndex.js",
|
||||
"mv-es5": "mv core/dist/@alfresco core/dist/esm5 && mv content-services/dist/@alfresco content-services/dist/esm5 && mv process-services/dist/@alfresco process-services/dist/esm5 && mv insights/dist/@alfresco insights/dist/esm5 ",
|
||||
"copy-i18n": "mkdir -p core/dist/bundles/assets/adf-core/i18n && cp -R core/i18n/* core/dist/bundles/assets/adf-core/i18n && mkdir -p content-services/dist/bundles/assets/adf-content-services/i18n && cp -R content-services/i18n/* content-services/dist/bundles/assets/adf-content-services/i18n && mkdir -p process-services/dist/bundles/assets/adf-process-services/i18n && cp -R process-services/i18n/* process-services/dist/bundles/assets/adf-process-services/i18n && mkdir -p insights/dist/bundles/assets/adf-insights/i18n && cp -R insights/i18n/* insights/dist/bundles/assets/adf-insights/i18n",
|
||||
"copy-assets": "cp -R core/assets/* core/dist/bundles/assets && cp -R content-services/assets/* content-services/dist/bundles/assets && cp -R process-services/assets/* process-services/dist/bundles/assets",
|
||||
"new-build": "npm run build-bundles && npm run build-style-new && npm run copy-i18n && npm run copy-assets && npm run mv-es5",
|
||||
"new-build": "npm run build-bundles && npm run build-style-new && npm run copy-i18n && npm run copy-assets",
|
||||
"build-bundles": "npm run build-core && mkdir -p ./node_modules/@alfresco/adf-core/ && cp -R ./core/dist/* ./node_modules/@alfresco/adf-core/ && npm run build-content && npm run build-process && npm run build-insights",
|
||||
"build-core": "ng-packagr -p ./ng-package/ng-package-core.json",
|
||||
"build-content": "ng-packagr -p ./ng-package/ng-package-content.json",
|
||||
@ -50,19 +49,19 @@
|
||||
"process services"
|
||||
],
|
||||
"dependencies": {
|
||||
"@angular/animations": "5.0.0",
|
||||
"@angular/cdk": "5.0.0-rc0",
|
||||
"@angular/common": "5.0.0",
|
||||
"@angular/compiler": "5.0.0",
|
||||
"@angular/core": "5.0.0",
|
||||
"@angular/animations": "5.0.5",
|
||||
"@angular/cdk": "5.0.0",
|
||||
"@angular/common": "5.0.5",
|
||||
"@angular/compiler": "5.0.5",
|
||||
"@angular/core": "5.0.5",
|
||||
"@angular/flex-layout": "2.0.0-beta.10",
|
||||
"@angular/forms": "5.0.0",
|
||||
"@angular/http": "5.0.0",
|
||||
"@angular/material": "5.0.0-rc0",
|
||||
"@angular/material-moment-adapter": "^5.0.0-rc0",
|
||||
"@angular/platform-browser": "5.0.0",
|
||||
"@angular/platform-browser-dynamic": "5.0.0",
|
||||
"@angular/router": "5.0.0",
|
||||
"@angular/forms": "5.0.5",
|
||||
"@angular/http": "5.0.5",
|
||||
"@angular/material": "5.0.0",
|
||||
"@angular/material-moment-adapter": "5.0.0",
|
||||
"@angular/platform-browser": "5.0.5",
|
||||
"@angular/platform-browser-dynamic": "5.0.5",
|
||||
"@angular/router": "5.0.5",
|
||||
"@ngx-translate/core": "8.0.0",
|
||||
"alfresco-js-api": "2.0.0",
|
||||
"chart.js": "2.5.0",
|
||||
@ -71,7 +70,7 @@
|
||||
"minimatch": "3.0.4",
|
||||
"moment": "2.18.1",
|
||||
"moment-es6": "^1.0.0",
|
||||
"ng-packagr": "^1.6.0",
|
||||
"ng-packagr": "2.0.0-rc.4",
|
||||
"ng2-charts": "1.6.0",
|
||||
"pdfjs-dist": "1.5.404",
|
||||
"raphael": "2.2.7",
|
||||
@ -81,6 +80,7 @@
|
||||
"zone.js": "0.8.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": "5.0.5",
|
||||
"@types/hammerjs": "2.0.35",
|
||||
"@types/jasmine": "^2.5.35",
|
||||
"@types/node": "6.0.90",
|
||||
|
@ -1,13 +1,13 @@
|
||||
adf-datatable >>> .column-header {
|
||||
adf-datatable ::ng-deep .column-header {
|
||||
color: #232323;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
adf-datatable >>> .data-cell {
|
||||
adf-datatable ::ng-deep .data-cell {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
adf-datatable >>> .cell-value{
|
||||
adf-datatable ::ng-deep .cell-value{
|
||||
width: 250px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
@ -1,13 +1,13 @@
|
||||
alfresco-datatable >>> .column-header {
|
||||
alfresco-datatable ::ng-deep .column-header {
|
||||
color: #232323;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
alfresco-datatable >>> .data-cell {
|
||||
alfresco-datatable ::ng-deep .data-cell {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
alfresco-datatable >>> .cell-value{
|
||||
alfresco-datatable ::ng-deep .cell-value{
|
||||
width: 250px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
@ -32,21 +32,15 @@ describe('Activiti Tas filter Service', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
||||
providers: [
|
||||
TaskFilterService
|
||||
]
|
||||
}).compileComponents();
|
||||
}).compileComponents().then(() => {
|
||||
service = TestBed.get(TaskFilterService);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(TaskFilterService);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
@ -54,15 +48,13 @@ describe('Activiti Tas filter Service', () => {
|
||||
describe('Content tests', () => {
|
||||
|
||||
it('should return the task list filters', (done) => {
|
||||
service.getTaskListFilters().subscribe(
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('FakeInvolvedTasks');
|
||||
expect(res[1].name).toEqual('FakeMyTasks');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskListFilters().subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('FakeInvolvedTasks');
|
||||
expect(res[1].name).toEqual('FakeMyTasks');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -72,17 +64,15 @@ describe('Activiti Tas filter Service', () => {
|
||||
});
|
||||
|
||||
it('should return the task filter by id', (done) => {
|
||||
service.getTaskFilterById(2).subscribe(
|
||||
(taskFilter: FilterRepresentationModel) => {
|
||||
expect(taskFilter).toBeDefined();
|
||||
expect(taskFilter.id).toEqual(2);
|
||||
expect(taskFilter.name).toEqual('FakeMyTasks');
|
||||
expect(taskFilter.filter.sort).toEqual('created-desc');
|
||||
expect(taskFilter.filter.state).toEqual('open');
|
||||
expect(taskFilter.filter.assignment).toEqual('fake-assignee');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskFilterById(2).subscribe((taskFilter: FilterRepresentationModel) => {
|
||||
expect(taskFilter).toBeDefined();
|
||||
expect(taskFilter.id).toEqual(2);
|
||||
expect(taskFilter.name).toEqual('FakeMyTasks');
|
||||
expect(taskFilter.filter.sort).toEqual('created-desc');
|
||||
expect(taskFilter.filter.state).toEqual('open');
|
||||
expect(taskFilter.filter.assignment).toEqual('fake-assignee');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -92,8 +82,7 @@ describe('Activiti Tas filter Service', () => {
|
||||
});
|
||||
|
||||
it('should return the task filter by name', (done) => {
|
||||
service.getTaskFilterByName('FakeMyTasks').subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
service.getTaskFilterByName('FakeMyTasks').subscribe((res: FilterRepresentationModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(2);
|
||||
expect(res.name).toEqual('FakeMyTasks');
|
||||
@ -111,28 +100,24 @@ describe('Activiti Tas filter Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the api withthe appId', (done) => {
|
||||
it('should call the api with the appId', (done) => {
|
||||
spyOn(service, 'callApiTaskFilters').and.returnValue((fakeAppPromise));
|
||||
|
||||
let appId = 1;
|
||||
service.getTaskListFilters(appId).subscribe(
|
||||
(res) => {
|
||||
expect(service.callApiTaskFilters).toHaveBeenCalledWith(appId);
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskListFilters(appId).subscribe((res) => {
|
||||
expect(service.callApiTaskFilters).toHaveBeenCalledWith(appId);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the app filter by id', (done) => {
|
||||
let appId = 1;
|
||||
service.getTaskListFilters(appId).subscribe(
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(1);
|
||||
expect(res[0].name).toEqual('FakeInvolvedTasks');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskListFilters(appId).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(1);
|
||||
expect(res[0].name).toEqual('FakeInvolvedTasks');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -142,17 +127,15 @@ describe('Activiti Tas filter Service', () => {
|
||||
});
|
||||
|
||||
it('should return the default filters', (done) => {
|
||||
service.createDefaultFilters(1234).subscribe(
|
||||
(res: FilterRepresentationModel []) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(4);
|
||||
expect(res[0].name).toEqual('Involved Tasks');
|
||||
expect(res[1].name).toEqual('My Tasks');
|
||||
expect(res[2].name).toEqual('Queued Tasks');
|
||||
expect(res[3].name).toEqual('Completed Tasks');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.createDefaultFilters(1234).subscribe((res: FilterRepresentationModel []) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(4);
|
||||
expect(res[0].name).toEqual('Involved Tasks');
|
||||
expect(res[1].name).toEqual('My Tasks');
|
||||
expect(res[2].name).toEqual('Queued Tasks');
|
||||
expect(res[3].name).toEqual('Completed Tasks');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.at(0).respondWith({
|
||||
'status': 200,
|
||||
@ -187,21 +170,19 @@ describe('Activiti Tas filter Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a filter ', (done) => {
|
||||
it('should add a filter', (done) => {
|
||||
let filterFake = new FilterRepresentationModel({
|
||||
name: 'FakeNameFilter',
|
||||
assignment: 'fake-assignement'
|
||||
});
|
||||
|
||||
service.addFilter(filterFake).subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual(null);
|
||||
expect(res.name).toEqual('FakeNameFilter');
|
||||
expect(res.filter.assignment).toEqual('fake-assignement');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.addFilter(filterFake).subscribe((res: FilterRepresentationModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual(null);
|
||||
expect(res.name).toEqual('FakeNameFilter');
|
||||
expect(res.filter.assignment).toEqual('fake-assignement');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
|
@ -40,27 +40,21 @@ import { TaskListService } from './tasklist.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
xdescribe('Activiti TaskList Service', () => {
|
||||
describe('Activiti TaskList Service', () => {
|
||||
|
||||
let service: TaskListService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
||||
providers: [
|
||||
TaskListService
|
||||
]
|
||||
}).compileComponents();
|
||||
}).compileComponents().then(() => {
|
||||
service = TestBed.get(TaskListService);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(TaskListService);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
@ -68,20 +62,18 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
describe('Content tests', () => {
|
||||
|
||||
it('should return the task list filtered', (done) => {
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -91,20 +83,18 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should return the task list filtered by processDefinitionKey', (done) => {
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(2);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(2);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -113,14 +103,13 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw an exception when the response is wrong', () => {
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
(res) => {
|
||||
it('should throw an exception when the response is wrong', (done) => {
|
||||
service.getTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe((res) => {
|
||||
},
|
||||
(err: any) => {
|
||||
expect(err).toBeDefined();
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 404,
|
||||
@ -133,58 +122,52 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
|
||||
service.findAllTaskByState(<TaskQueryRequestRepresentationModel> fakeFilter, 'open').subscribe(
|
||||
res => {
|
||||
service.findAllTaskByState(<TaskQueryRequestRepresentationModel> fakeFilter, 'open').subscribe(res => {
|
||||
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the task list with all tasks filtered', (done) => {
|
||||
spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
|
||||
service.findAllTaskByState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.findAllTaskByState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the task list filtered by state', (done) => {
|
||||
service.findTasksByState(<TaskQueryRequestRepresentationModel> fakeFilter, 'open').subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.findTasksByState(<TaskQueryRequestRepresentationModel> fakeFilter, 'open').subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -194,19 +177,17 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should return the task list filtered', (done) => {
|
||||
service.findTasksByState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.findTasksByState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.start).toEqual(0);
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(1);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -219,83 +200,67 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[0].assignee.lastName).toEqual('lastName');
|
||||
|
||||
expect(res.data[1].name).toEqual('FakeNameTask');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[1].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[1].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
expect(res.data[1].name).toEqual('FakeNameTask');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[1].assignee.firstName).toEqual('firstName');
|
||||
expect(res.data[1].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('Should return both open and completed task', (done) => {
|
||||
spyOn(service, 'findTasksByState').and.returnValue(Observable.of(fakeOpenTaskList));
|
||||
spyOn(service, 'findAllTaskByState').and.returnValue(Observable.of(fakeCompletedTaskList));
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(4);
|
||||
expect(res.data[0].name).toEqual('FakeOpenTask1');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-open-email@dom.com');
|
||||
expect(res.data[2].name).toEqual('FakeCompletedTaskName1');
|
||||
expect(res.data[2].assignee.email).toEqual('fake-completed-email@dom.com');
|
||||
expect(res.data[3].name).toEqual('FakeCompletedTaskName2');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(4);
|
||||
expect(res.data[0].name).toEqual('FakeOpenTask1');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-open-email@dom.com');
|
||||
expect(res.data[2].name).toEqual('FakeCompletedTaskName1');
|
||||
expect(res.data[2].assignee.email).toEqual('fake-completed-email@dom.com');
|
||||
expect(res.data[3].name).toEqual('FakeCompletedTaskName2');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should add the task list to the tasklistSubject with all tasks filtered without state', (done) => {
|
||||
spyOn(service, 'getTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
spyOn(service, 'getTotalTasks').and.returnValue(Observable.of(fakeTaskList));
|
||||
|
||||
service.tasksList$.subscribe(
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
});
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[1].name).toEqual('FakeNameTask');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.findAllTasksWithoutState(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.data).toBeDefined();
|
||||
expect(res.data.length).toEqual(2);
|
||||
expect(res.data[0].name).toEqual('FakeNameTask');
|
||||
expect(res.data[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.data[1].name).toEqual('FakeNameTask');
|
||||
expect(res.data[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the task details ', (done) => {
|
||||
service.getTaskDetails('999').subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual('999');
|
||||
expect(res.name).toEqual('fake-task-name');
|
||||
expect(res.formKey).toEqual('99');
|
||||
expect(res.assignee).toBeDefined();
|
||||
expect(res.assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.assignee.firstName).toEqual('firstName');
|
||||
expect(res.assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskDetails('999').subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual('999');
|
||||
expect(res.name).toEqual('fake-task-name');
|
||||
expect(res.formKey).toEqual('99');
|
||||
expect(res.assignee).toBeDefined();
|
||||
expect(res.assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res.assignee.firstName).toEqual('firstName');
|
||||
expect(res.assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -305,21 +270,19 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should return the tasks checklists ', (done) => {
|
||||
service.getTaskChecklist('999').subscribe(
|
||||
(res: TaskDetailsModel[]) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('FakeCheckTask1');
|
||||
expect(res[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res[0].assignee.lastName).toEqual('lastName');
|
||||
expect(res[1].name).toEqual('FakeCheckTask2');
|
||||
expect(res[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res[1].assignee.firstName).toEqual('firstName');
|
||||
expect(res[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.getTaskChecklist('999').subscribe((res: TaskDetailsModel[]) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('FakeCheckTask1');
|
||||
expect(res[0].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res[0].assignee.firstName).toEqual('firstName');
|
||||
expect(res[0].assignee.lastName).toEqual('lastName');
|
||||
expect(res[1].name).toEqual('FakeCheckTask2');
|
||||
expect(res[1].assignee.email).toEqual('fake-email@dom.com');
|
||||
expect(res[1].assignee.firstName).toEqual('firstName');
|
||||
expect(res[0].assignee.lastName).toEqual('lastName');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -339,15 +302,13 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
created: ''
|
||||
});
|
||||
|
||||
service.addTask(taskFake).subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual('');
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.created).not.toEqual(null);
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.addTask(taskFake).subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual('');
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.created).not.toEqual(null);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -361,11 +322,9 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should remove a checklist task ', (done) => {
|
||||
service.deleteTask('999').subscribe(
|
||||
() => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.deleteTask('999').subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -373,13 +332,11 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should complete the task ', (done) => {
|
||||
service.completeTask('999').subscribe(
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
done();
|
||||
}
|
||||
);
|
||||
it('should complete the task', (done) => {
|
||||
service.completeTask('999').subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -388,15 +345,13 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the total number of tasks', (done) => {
|
||||
service.getTotalTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe(
|
||||
res => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.total).toEqual(1);
|
||||
done();
|
||||
}
|
||||
);
|
||||
xit('should return the total number of tasks', (done) => {
|
||||
service.getTotalTasks(<TaskQueryRequestRepresentationModel> fakeFilter).subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.size).toEqual(1);
|
||||
expect(res.total).toEqual(1);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -405,24 +360,22 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should create a new standalone task ', (done) => {
|
||||
xit('should create a new standalone task ', (done) => {
|
||||
let taskFake = new TaskDetailsModel({
|
||||
name: 'FakeNameTask',
|
||||
description: 'FakeDescription',
|
||||
category: '3'
|
||||
});
|
||||
|
||||
service.createNewTask(taskFake).subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual('');
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.createNewTask(taskFake).subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual('');
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -438,25 +391,23 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should assign task to a user', (done) => {
|
||||
xit('should assign task to a user', (done) => {
|
||||
let testTaskId = '8888';
|
||||
service.assignTask(testTaskId, fakeUser2).subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(testTaskId);
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
expect(res.involvedPeople[0].lastName).toEqual(fakeUser1.lastName);
|
||||
expect(res.involvedPeople[0].id).toEqual(fakeUser1.id);
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.assignTask(testTaskId, fakeUser2).subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(testTaskId);
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
expect(res.involvedPeople[0].lastName).toEqual(fakeUser1.lastName);
|
||||
expect(res.involvedPeople[0].id).toEqual(fakeUser1.id);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -474,23 +425,21 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should assign task to a userId', (done) => {
|
||||
xit('should assign task to a userId', (done) => {
|
||||
let testTaskId = '8888';
|
||||
service.assignTaskByUserId(testTaskId, fakeUser2.id).subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(testTaskId);
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.assignTaskByUserId(testTaskId, fakeUser2.id).subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(testTaskId);
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
expect(res.description).toEqual('FakeDescription');
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual(null);
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -508,14 +457,12 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should claim a task', (done) => {
|
||||
xit('should claim a task', (done) => {
|
||||
let taskId = '111';
|
||||
|
||||
service.claimTask(taskId).subscribe(
|
||||
(res: any) => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.claimTask(taskId).subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -524,14 +471,12 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should unclaim a task', (done) => {
|
||||
xit('should unclaim a task', (done) => {
|
||||
let taskId = '111';
|
||||
|
||||
service.unclaimTask(taskId).subscribe(
|
||||
(res: any) => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.unclaimTask(taskId).subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -540,14 +485,12 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should update a task', (done) => {
|
||||
xit('should update a task', (done) => {
|
||||
let taskId = '111';
|
||||
|
||||
service.updateTask(taskId, {property: 'value'}).subscribe(
|
||||
(res: any) => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.updateTask(taskId, { property: 'value' }).subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -556,7 +499,7 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the filter if it contains task id', (done) => {
|
||||
xit('should return the filter if it contains task id', (done) => {
|
||||
let taskId = '1';
|
||||
let filterFake = new FilterRepresentationModel({
|
||||
name: 'FakeNameFilter',
|
||||
@ -569,13 +512,11 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
}
|
||||
});
|
||||
|
||||
service.isTaskRelatedToFilter(taskId, filterFake).subscribe(
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).not.toBeNull();
|
||||
done();
|
||||
}
|
||||
);
|
||||
service.isTaskRelatedToFilter(taskId, filterFake).subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -584,23 +525,21 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the filters if it contains task id', async(() => {
|
||||
xit('should return the filters if it contains task id', (done) => {
|
||||
let taskId = '1';
|
||||
|
||||
let fakeFilterList: FilterRepresentationModel[] = [];
|
||||
fakeFilterList.push(fakeRepresentationFilter1, fakeRepresentationFilter2);
|
||||
let resultFilter: FilterRepresentationModel = null;
|
||||
service.getFilterForTaskById(taskId, fakeFilterList).subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
resultFilter = res;
|
||||
},
|
||||
() => {
|
||||
},
|
||||
() => {
|
||||
expect(resultFilter).toBeDefined();
|
||||
expect(resultFilter).not.toBeNull();
|
||||
expect(resultFilter.name).toBe('CONTAIN FILTER');
|
||||
});
|
||||
service.getFilterForTaskById(taskId, fakeFilterList).subscribe((res: FilterRepresentationModel) => {
|
||||
resultFilter = res;
|
||||
}, () => {
|
||||
}, () => {
|
||||
expect(resultFilter).toBeDefined();
|
||||
expect(resultFilter).not.toBeNull();
|
||||
expect(resultFilter.name).toBe('CONTAIN FILTER');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.at(0).respondWith({
|
||||
'status': 200,
|
||||
@ -613,20 +552,18 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(secondFakeTaskList)
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should get possibile form list', (done) => {
|
||||
service.getFormList().subscribe(
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toBe(2);
|
||||
expect(res[0].id).toBe(1);
|
||||
expect(res[0].name).toBe('form with all widgets');
|
||||
expect(res[1].id).toBe(2);
|
||||
expect(res[1].name).toBe('uppy');
|
||||
done();
|
||||
}
|
||||
);
|
||||
xit('should get possible form list', (done) => {
|
||||
service.getFormList().subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toBe(2);
|
||||
expect(res[0].id).toBe(1);
|
||||
expect(res[0].name).toBe('form with all widgets');
|
||||
expect(res[1].id).toBe(2);
|
||||
expect(res[1].name).toBe('uppy');
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
@ -635,5 +572,4 @@ xdescribe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -9,7 +9,11 @@
|
||||
"parameters",
|
||||
"statements"
|
||||
],
|
||||
"ban": false,
|
||||
"ban": [
|
||||
true,
|
||||
"eval",
|
||||
"fdescribe"
|
||||
],
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
|
@ -82,6 +82,20 @@ do
|
||||
echo "js.map ok!"
|
||||
fi
|
||||
|
||||
if [ ! -f package/esm5/$PACKAGE'.js' ]; then
|
||||
error_out '31;1' "esm5/$PACKAGE.js not found!" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "esm5 ok!"
|
||||
fi
|
||||
|
||||
if [ ! -f package/esm2015/$PACKAGE'.js' ]; then
|
||||
error_out '31;1' "esm2015/$PACKAGE.js not found!" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "esm2015 ok!"
|
||||
fi
|
||||
|
||||
if [ ! -f package/_theming.scss ]; then
|
||||
error_out '31;1' "$PACKAGE style not found!" >&2
|
||||
exit 1
|
||||
|
69
tslint.json
69
tslint.json
@ -1,17 +1,23 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer",
|
||||
"node_modules/adf-tslint-rules"
|
||||
],
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
"parameters",
|
||||
"arguments",
|
||||
"statements"
|
||||
],
|
||||
"ban": false,
|
||||
"ban": [
|
||||
true,
|
||||
"eval",
|
||||
{"name": ["fdescribe", "fit"], "message": "don't focus tests"}
|
||||
],
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space",
|
||||
"check-lowercase"
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
@ -23,24 +29,23 @@
|
||||
"interface-name": false,
|
||||
"jsdoc-format": true,
|
||||
"label-position": true,
|
||||
"label-undefined": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
180
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-bitwise": false,
|
||||
"no-conditional-assignment": true,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"log",
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
@ -50,17 +55,15 @@
|
||||
"no-construct": true,
|
||||
"no-constructor-vars": false,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-key": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-empty": false,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": true,
|
||||
"no-require-imports": true,
|
||||
"no-require-imports": false,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unreachable": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true,
|
||||
"no-use-before-declare": true,
|
||||
@ -111,12 +114,48 @@
|
||||
"allow-leading-underscore",
|
||||
"ban-keywords"
|
||||
],
|
||||
"callable-types": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"interface-over-type-literal": true,
|
||||
"member-access": false,
|
||||
"no-empty-interface": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"prefer-const": false,
|
||||
"typeof-compare": true,
|
||||
"unified-signatures": true,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator"
|
||||
]
|
||||
"check-separator",
|
||||
"check-typecast",
|
||||
"check-type",
|
||||
"check-typecast",
|
||||
"check-module"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"adf",
|
||||
"kebab-case"
|
||||
],
|
||||
"ordered-imports": false,
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": false,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-access-missing-member": false,
|
||||
"adf-file-name": true,
|
||||
"adf-class-name": true,
|
||||
"adf-prefix-name": true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user