[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:
Eugenio Romano
2017-12-07 11:58:16 +00:00
committed by GitHub
parent 321c4f48e1
commit a99c1a37e4
32 changed files with 666 additions and 584 deletions

View File

@@ -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: [

View 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();
}

View File

@@ -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();

View File

@@ -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');
});
}));
});

View File

@@ -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');
});
}));

View File

@@ -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);
}
}

View File

@@ -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)

View 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;
}

View File

@@ -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', () => {

View File

@@ -112,7 +112,7 @@ class ViewerWithCustomOpenWithComponent {}
})
class ViewerWithCustomMoreActionsComponent {}
fdescribe('ViewerComponent', () => {
describe('ViewerComponent', () => {
let component: ViewerComponent;
let fixture: ComponentFixture<ViewerComponent>;