fix "ng lint" command (#5012)

* update to latest js-api

* fix the "ng lint" command

* fix linting issues

* fix lint issues

* lint fixes

* code fixes

* fix html

* fix html

* update tests

* test fixes

* update tests

* fix tests and api

* fix code
This commit is contained in:
Denys Vuika
2019-08-29 16:35:30 +01:00
committed by Eugenio Romano
parent 140c64b79f
commit edc0945f39
162 changed files with 537 additions and 530 deletions

View File

@@ -200,7 +200,7 @@ describe('CardViewDateItemComponent', () => {
component.onDateChanged({ value: expectedDate });
fixture.whenStable().then(
(updateNotification) => {
() => {
expect(component.property.value).toEqual(expectedDate.toDate());
}
);
@@ -246,7 +246,7 @@ describe('CardViewDateItemComponent', () => {
component.onDateClear();
fixture.whenStable().then(
(updateNotification) => {
() => {
expect(component.property.value).toBeNull();
}
);
@@ -261,7 +261,7 @@ describe('CardViewDateItemComponent', () => {
component.onDateClear();
fixture.whenStable().then(
(updateNotification) => {
() => {
expect(component.property.default).toBeNull();
}
);
@@ -277,7 +277,7 @@ describe('CardViewDateItemComponent', () => {
component.onDateClear();
fixture.whenStable().then(
(updateNotification) => {
() => {
expect(component.property.value).toBeNull();
expect(component.property.default).toBeNull();
}

View File

@@ -156,7 +156,7 @@ describe('CommentListComponent', () => {
commentList.selectedComment = commentOne;
commentList.comments = [commentOne, commentTwo];
commentList.clickRow.subscribe((selectedComment) => {
commentList.clickRow.subscribe(() => {
fixture.detectChanges();
const commentSelectedList = fixture.nativeElement.querySelectorAll('.adf-is-selected');
expect(commentSelectedList.length).toBe(1);

View File

@@ -61,8 +61,8 @@ export class ContextMenuHolderComponent implements OnInit, OnDestroy {
}
}
@HostListener('window:resize', ['$event'])
onResize(event) {
@HostListener('window:resize')
onResize() {
if (this.mdMenuElement) {
this.updatePosition();
}

View File

@@ -96,7 +96,7 @@
role="gridcell"
class=" adf-datatable-cell adf-datatable-cell--{{col.type || 'text'}} {{col.cssClass}}"
[attr.title]="col.title | translate"
[attr.data-automation-id]="getAutomationValue(row, col)"
[attr.data-automation-id]="getAutomationValue(row)"
[attr.aria-selected]="row.isSelected ? true : false"
[attr.aria-label]="col.title ? (col.title | translate) : null"
tabindex="0"

View File

@@ -33,7 +33,7 @@ class FakeDataRow implements DataRow {
isDropTarget = false;
isSelected = true;
hasValue(key: any) {
hasValue() {
return true;
}
@@ -374,7 +374,7 @@ describe('DataTable', () => {
dataTable.ngOnChanges({});
dataTable.rowClick.subscribe((event) => {
dataTable.rowClick.subscribe(() => {
expect(rows[0].isSelected).toBeFalsy();
expect(rows[1].isSelected).toBeTruthy();
done();
@@ -396,7 +396,7 @@ describe('DataTable', () => {
dataTable.ngOnChanges({});
dataTable.rowClick.subscribe((event) => {
dataTable.rowClick.subscribe(() => {
expect(rows[0].isSelected).toBeFalsy();
expect(rows[1].isSelected).toBeTruthy();
done();
@@ -463,7 +463,7 @@ describe('DataTable', () => {
const rows = dataTable.data.getRows();
dataTable.ngOnChanges({});
dataTable.rowClick.subscribe((event) => {
dataTable.rowClick.subscribe(() => {
expect(rows[0].isSelected).toBeTruthy();
expect(rows[1].isSelected).toBeFalsy();
done();
@@ -827,49 +827,49 @@ describe('DataTable', () => {
it('should use special material url scheme', () => {
const column = <DataColumn> {};
const row = {
getValue: function (key: string) {
const row: any = {
getValue: function () {
return 'material-icons://android';
}
};
expect(dataTable.isIconValue(<DataRow> row, column)).toBeTruthy();
expect(dataTable.isIconValue(row, column)).toBeTruthy();
});
it('should not use special material url scheme', () => {
const column = <DataColumn> {};
const row = {
getValue: function (key: string) {
const row: any = {
getValue: function () {
return 'http://www.google.com';
}
};
expect(dataTable.isIconValue(<DataRow> row, column)).toBeFalsy();
expect(dataTable.isIconValue(row, column)).toBeFalsy();
});
it('should parse icon value', () => {
const column = <DataColumn> {};
const row = {
getValue: function (key: string) {
const row: any = {
getValue: function () {
return 'material-icons://android';
}
};
expect(dataTable.asIconValue(<DataRow> row, column)).toBe('android');
expect(dataTable.asIconValue(row, column)).toBe('android');
});
it('should not parse icon value', () => {
const column = <DataColumn> {};
const row = {
getValue: function (key: string) {
const row: any = {
getValue: function () {
return 'http://www.google.com';
}
};
expect(dataTable.asIconValue(<DataRow> row, column)).toBe(null);
expect(dataTable.asIconValue(row, column)).toBe(null);
});
it('should parse icon values to a valid i18n key', () => {
@@ -966,8 +966,8 @@ describe('DataTable', () => {
});
const column = <DataColumn> {};
const row = <DataRow> {
getValue: function (key: string) {
const row: any = {
getValue: function () {
return 'id';
}
};

View File

@@ -701,7 +701,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
});
}
getAutomationValue(row: DataRow, col: DataColumn) {
getAutomationValue(row: DataRow): any {
const name = this.getNameColumnValue();
return name ? row.getValue(name.key) : '';
}

View File

@@ -36,7 +36,7 @@ export class ObjectDataRow implements DataRow {
return this.getValue(key) !== undefined;
}
imageErrorResolver(event: Event): string {
imageErrorResolver(): string {
return '';
}
}

View File

@@ -29,7 +29,7 @@ import { TranslationMock } from '../mock/translation.service.mock';
@Component({
template: `
<div id="delete-component" [adf-delete]="selection"
(delete)="onDelete($event)">
(delete)="onDelete()">
</div>`
})
class TestComponent {
@@ -38,7 +38,7 @@ class TestComponent {
@ViewChild(NodeDeleteDirective)
deleteDirective: NodeDeleteDirective;
onDelete(event) {
onDelete() {
}
}

View File

@@ -39,14 +39,14 @@ describe('UploadDirective', () => {
it('should update drag status on dragenter', () => {
expect(directive.isDragging).toBeFalsy();
directive.enabled = true;
directive.onDragEnter(null);
directive.onDragEnter();
expect(directive.isDragging).toBeTruthy();
});
it('should not update drag status on dragenter when disabled', () => {
expect(directive.isDragging).toBeFalsy();
directive.enabled = false;
directive.onDragEnter(null);
directive.onDragEnter();
expect(directive.isDragging).toBeFalsy();
});
@@ -75,14 +75,14 @@ describe('UploadDirective', () => {
it('should update drag status on dragleave', () => {
directive.enabled = true;
directive.isDragging = true;
directive.onDragLeave(null);
directive.onDragLeave();
expect(directive.isDragging).toBeFalsy();
});
it('should not update drag status on dragleave when disabled', () => {
directive.enabled = false;
directive.isDragging = true;
directive.onDragLeave(null);
directive.onDragLeave();
expect(directive.isDragging).toBeTruthy();
});

View File

@@ -108,7 +108,7 @@ export class UploadDirective implements OnInit, OnDestroy {
}
}
onDragEnter(event: Event) {
onDragEnter() {
if (this.isDropMode()) {
this.element.classList.add(this.cssClassName);
this.isDragging = true;
@@ -124,7 +124,7 @@ export class UploadDirective implements OnInit, OnDestroy {
return false;
}
onDragLeave(event) {
onDragLeave() {
if (this.isDropMode()) {
this.element.classList.remove(this.cssClassName);
this.isDragging = false;

View File

@@ -56,7 +56,7 @@ describe('TaskAttachmentList', () => {
{ name: 'FakeName-2', lastUpdatedByFullName: 'FakeUser-2', lastUpdated: '2017-01-03' }
]));
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';
import { FormService } from './../services/form.service';
@Component({
@@ -33,7 +33,7 @@ export class FormListComponent implements OnChanges {
constructor(protected formService: FormService) {
}
ngOnChanges(changes: SimpleChanges) {
ngOnChanges() {
this.getForms();
}

View File

@@ -195,7 +195,7 @@ describe('ContentWidgetComponent', () => {
const change = new SimpleChange(null, contentId, true);
component.ngOnChanges({ 'id': change });
component.contentLoaded.subscribe((res) => {
component.contentLoaded.subscribe(() => {
fixture.detectChanges();
fixture.whenStable()
.then(() => {

View File

@@ -16,7 +16,6 @@
*/
import { ValidateFormFieldEvent } from './../../../events/validate-form-field.event';
import { ValidateFormEvent } from './../../../events/validate-form.event';
import { FormService } from './../../../services/form.service';
import { ContainerModel } from './container.model';
import { FormFieldTypes } from './form-field-types';
@@ -298,7 +297,7 @@ describe('FormModel', () => {
let validated = false;
formService.validateForm.subscribe((event: ValidateFormEvent) => {
formService.validateForm.subscribe(() => {
validated = true;
});
@@ -316,7 +315,7 @@ describe('FormModel', () => {
let validated = false;
formService.validateFormField.subscribe((event: ValidateFormFieldEvent) => {
formService.validateFormField.subscribe(() => {
validated = true;
});
@@ -333,7 +332,7 @@ describe('FormModel', () => {
let validated = false;
formService.validateFormField.subscribe((event: ValidateFormFieldEvent) => {
formService.validateFormField.subscribe(() => {
validated = true;
});
@@ -385,10 +384,10 @@ describe('FormModel', () => {
spyOn(form, 'getFormFields').and.returnValue([testField]);
const validator = <FormFieldValidator> {
isSupported(field: FormFieldModel): boolean {
isSupported(): boolean {
return true;
},
validate(field: FormFieldModel): boolean {
validate(): boolean {
return true;
}
};

View File

@@ -60,10 +60,10 @@ describe('RowEditorComponent', () => {
spyOn(component.table, 'validateRow').and.returnValue(
<DynamicRowValidationSummary> {isValid: true, message: null}
);
component.save.subscribe((e) => {
expect(e.table).toBe(component.table);
expect(e.row).toBe(component.row);
expect(e.column).toBe(component.column);
component.save.subscribe((event) => {
expect(event.table).toBe(component.table);
expect(event.row).toBe(component.row);
expect(event.column).toBe(component.column);
done();
});
component.onSaveChanges();
@@ -74,7 +74,7 @@ describe('RowEditorComponent', () => {
<DynamicRowValidationSummary> {isValid: false, message: 'error'}
);
let raised = false;
component.save.subscribe((e) => raised = true);
component.save.subscribe(() => raised = true);
component.onSaveChanges();
expect(raised).toBeFalsy();
});

View File

@@ -179,7 +179,7 @@ describe('RadioButtonsWidgetComponent', () => {
expect(element.querySelector('#radio-id')).not.toBeNull();
expect(option).not.toBeNull();
option.click();
widget.fieldChanged.subscribe((field) => {
widget.fieldChanged.subscribe(() => {
expect(element.querySelector('#radio-id')).toBeNull();
expect(element.querySelector('#radio-id-opt-1-input')).toBeNull();
});

View File

@@ -126,7 +126,7 @@ describe('TabsWidgetComponent', () => {
tick(500);
tabWidgetComponent.formTabChanged.subscribe((res) => {
tabWidgetComponent.formTabChanged.subscribe(() => {
tabWidgetComponent.tabs[1].isVisible = true;
tick(500);
@@ -144,7 +144,7 @@ describe('TabsWidgetComponent', () => {
tick(500);
tabWidgetComponent.formTabChanged.subscribe((res) => {
tabWidgetComponent.formTabChanged.subscribe(() => {
tabWidgetComponent.tabs[0].isVisible = false;
tick(500);

View File

@@ -93,7 +93,7 @@ describe('Form service', () => {
const simpleResponseBody = { id: 1, modelType: 'test' };
it('should fetch and parse process definitions', (done) => {
service.getProcessDefinitions().subscribe((result) => {
service.getProcessDefinitions().subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/process-definitions')).toBeTruthy();
expect( [ { id: '1' }, { id: '2' } ]).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data);
done();
@@ -107,7 +107,7 @@ describe('Form service', () => {
});
it('should fetch and parse tasks', (done) => {
service.getTasks().subscribe((result) => {
service.getTasks().subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/tasks/query')).toBeTruthy();
expect( [ { id: '1' }, { id: '2' } ]).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data);
done();
@@ -240,7 +240,7 @@ describe('Form service', () => {
});
processApiSpy.getProcessDefinitionStartForm.and.returnValue(Promise.resolve({ id: '1' }));
service.getStartFormDefinition('myprocess:1').subscribe((result) => {
service.getStartFormDefinition('myprocess:1').subscribe(() => {
expect(processApiSpy.getProcessDefinitionStartForm).toHaveBeenCalledWith('myprocess:1');
done();
});
@@ -344,7 +344,7 @@ describe('Form service', () => {
});
it('should create a Form with modelType=2', (done) => {
service.createForm('testName').subscribe((result) => {
service.createForm('testName').subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/models')).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).modelType).toEqual(2);
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toEqual('testName');

View File

@@ -161,7 +161,7 @@ describe('NodeService', () => {
testdata: 'testdata'
};
service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary').subscribe((result) => {
service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary').subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toBeDefined();
done();

View File

@@ -268,7 +268,7 @@ describe('WidgetVisibilityCloudService', () => {
it('should retrieve the value for the right field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.rightValue = 'test_value_2';
const rightValue = service.getRightValue(formTest, visibilityObjTest);
@@ -286,7 +286,7 @@ describe('WidgetVisibilityCloudService', () => {
it('should retrieve the value for the left field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftValue = 'TEST_VAR_2';
visibilityObjTest.leftType = WidgetTypeEnum.field;
const leftValue = service.getLeftValue(formTest, visibilityObjTest);
@@ -305,7 +305,7 @@ describe('WidgetVisibilityCloudService', () => {
it('should evaluate the visibility for the field between form value and process var', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftType = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!=';
visibilityObjTest.rightValue = 'TEST_VAR_2';
@@ -324,7 +324,7 @@ describe('WidgetVisibilityCloudService', () => {
it('should evaluate visibility with multiple conditions', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftType = 'field';
visibilityObjTest.leftValue = 'TEST_VAR_2';
visibilityObjTest.operator = '!=';

View File

@@ -252,7 +252,7 @@ describe('WidgetVisibilityService', () => {
it('should retrieve the value for the right field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
const rightValue = service.getRightValue(formTest, visibilityObjTest);
@@ -270,7 +270,7 @@ describe('WidgetVisibilityService', () => {
it('should retrieve the value for the left field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftRestResponseId = 'TEST_VAR_2';
const leftValue = service.getLeftValue(formTest, visibilityObjTest);
@@ -288,7 +288,7 @@ describe('WidgetVisibilityService', () => {
it('should evaluate the visibility for the field between form value and process var', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!=';
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
@@ -307,7 +307,7 @@ describe('WidgetVisibilityService', () => {
it('should evaluate visibility with multiple conditions', (done) => {
service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => {
() => {
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!=';
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';

View File

@@ -282,7 +282,7 @@ export class WidgetVisibilityService {
this.processVarList = <TaskProcessVariableModel[]> jsonRes;
return jsonRes;
}),
catchError((err) => this.handleError(err))
catchError(() => this.handleError())
);
}
@@ -298,7 +298,7 @@ export class WidgetVisibilityService {
return !!(condition && condition.operator);
}
private handleError(err) {
private handleError() {
this.logService.error('Error while performing a call');
return throwError('Error while performing a call - Server error');
}

View File

@@ -18,7 +18,7 @@
/* tslint:disable:adf-file-name */
export class AlfrescoApiMock {
login(username: string, password: string) {
login() {
return new Promise((resolve) => {
resolve('TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
});

View File

@@ -132,7 +132,7 @@ export let deleteGroupMappingApi = {
export let returnCallQueryParameters = {
oauth2Auth: {
callCustomApi: (queryUrl, operation, context, queryParams) => {
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
return Promise.resolve(queryParams);
}
}
@@ -140,7 +140,7 @@ export let returnCallQueryParameters = {
export let returnCallUrl = {
oauth2Auth: {
callCustomApi: (queryUrl, operation, context, queryParams) => {
callCustomApi: (queryUrl) => {
return Promise.resolve(queryUrl);
}
}

View File

@@ -57,7 +57,7 @@ export let mockError = {
export let searchMockApi = {
core: {
queriesApi: {
findNodes: (term, opts) => Promise.resolve(fakeSearch)
findNodes: () => Promise.resolve(fakeSearch)
}
}
};

View File

@@ -42,11 +42,11 @@ export class TranslationMock implements TranslationService {
loadTranslation() {}
get(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> {
get(key: string | Array<string>): Observable<string | any> {
return of(key);
}
instant(key: string | Array<string>, interpolateParams?: Object): string | any {
instant(key: string | Array<string>): string | any {
return key;
}

View File

@@ -170,7 +170,7 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
get pages(): number[] {
return Array(this.lastPage)
.fill('n')
.map((item, index) => (index + 1));
.map((_, index) => (index + 1));
}
goNext() {

View File

@@ -33,19 +33,19 @@ class FakeSanitizer extends DomSanitizer {
return value;
}
bypassSecurityTrustStyle(value: string): any {
bypassSecurityTrustStyle(): any {
return null;
}
bypassSecurityTrustScript(value: string): any {
bypassSecurityTrustScript(): any {
return null;
}
bypassSecurityTrustUrl(value: string): any {
bypassSecurityTrustUrl(): any {
return null;
}
bypassSecurityTrustResourceUrl(value: string): any {
bypassSecurityTrustResourceUrl(): any {
return null;
}
}

View File

@@ -33,7 +33,7 @@ export class AuthGuardBpm extends AuthGuardBase {
super(authenticationService, router, appConfigService);
}
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
if (this.authenticationService.isBpmLoggedIn() || this.withCredentials) {
return true;
}

View File

@@ -35,7 +35,7 @@ export class AuthGuardEcm extends AuthGuardBase {
super(authenticationService, router, appConfigService);
}
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) {
return true;
}

View File

@@ -46,7 +46,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeTruthy();
expect(authGuard.canActivate(router)).toBeTruthy();
}));
it('Should canActivate be false if the Role is not present int the JWT token', async(() => {
@@ -56,7 +56,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeFalsy();
expect(authGuard.canActivate(router)).toBeFalsy();
}));
it('Should not redirect if canActivate is', async(() => {
@@ -67,7 +67,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeTruthy();
expect(authGuard.canActivate(router)).toBeTruthy();
expect(routerService.navigate).not.toHaveBeenCalled();
}));
@@ -77,7 +77,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
expect(authGuard.canActivate(router, null)).toBeFalsy();
expect(authGuard.canActivate(router)).toBeFalsy();
}));
it('Should canActivate return false if the realm_access is not present', async(() => {
@@ -86,7 +86,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
expect(authGuard.canActivate(router, null)).toBeFalsy();
expect(authGuard.canActivate(router)).toBeFalsy();
}));
it('Should redirect to the redirectURL if canActivate is false and redirectUrl is in data', async(() => {
@@ -97,7 +97,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'], 'redirectUrl': 'no-role-url' };
expect(authGuard.canActivate(router, null)).toBeFalsy();
expect(authGuard.canActivate(router)).toBeFalsy();
expect(routerService.navigate).toHaveBeenCalledWith(['/no-role-url']);
}));
@@ -109,7 +109,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeFalsy();
expect(authGuard.canActivate(router)).toBeFalsy();
expect(routerService.navigate).not.toHaveBeenCalled();
}));
@@ -121,7 +121,7 @@ describe('Auth Guard SSO role service', () => {
route.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(route, null)).toBeFalsy();
expect(authGuard.canActivate(route)).toBeFalsy();
});
it('Should canActivate be false if hasRealm is false and hasClientRole is true', () => {
@@ -132,7 +132,7 @@ describe('Auth Guard SSO role service', () => {
route.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['fakeapp'], 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(route, null)).toBeFalsy();
expect(authGuard.canActivate(route)).toBeFalsy();
});
it('Should canActivate be true if both Real Role and Client Role are present int the JWT token', () => {
@@ -147,7 +147,7 @@ describe('Auth Guard SSO role service', () => {
route.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(route, null)).toBeTruthy();
expect(authGuard.canActivate(route)).toBeTruthy();
});
it('Should canActivate be false if the Client Role is not present int the JWT token with the correct role', () => {
@@ -162,7 +162,7 @@ describe('Auth Guard SSO role service', () => {
route.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(route, null)).toBeFalsy();
expect(authGuard.canActivate(route)).toBeFalsy();
});
describe('ClientRole ', () => {

View File

@@ -17,14 +17,14 @@
import { Injectable } from '@angular/core';
import { JwtHelperService } from './jwt-helper.service';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class AuthGuardSsoRoleService implements CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
canActivate(route: ActivatedRouteSnapshot): boolean {
let hasRole;
let hasRealmRole = false;
let hasClientRole = true;

View File

@@ -66,7 +66,7 @@ export class AuthGuard extends AuthGuardBase {
window.removeEventListener('storage', this.ticketChangeBind);
}
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
if (this.authenticationService.isLoggedIn() || this.withCredentials) {
return true;
}

View File

@@ -209,7 +209,7 @@ describe('AuthenticationService', () => {
});
it('[BPM] should return an BPM ticket after the login done', (done) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe((response) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(() => {
expect(authService.isLoggedIn()).toBe(true);
// cspell: disable-next
expect(authService.getTicketBpm()).toEqual('Basic ZmFrZS11c2VybmFtZTpmYWtlLXBhc3N3b3Jk');
@@ -247,7 +247,7 @@ describe('AuthenticationService', () => {
it('[BPM] should return an error when the logout return error', (done) => {
authService.logout().subscribe(
(res) => {
() => {
},
(err: any) => {
expect(err).toBeDefined();
@@ -344,9 +344,8 @@ describe('AuthenticationService', () => {
it('[ECM] should not save the remember me cookie after failed login', (done) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
(err: any) => {
() => {},
() => {
expect(cookie['ALFRESCO_REMEMBER_ME']).toBeUndefined();
disposableLogin.unsubscribe();
done();
@@ -401,9 +400,8 @@ describe('AuthenticationService', () => {
it('[ALL] should return login fail if only ECM call fail', (done) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
(err: any) => {
() => {},
() => {
expect(authService.isLoggedIn()).toBe(false, 'isLoggedIn');
expect(authService.getTicketEcm()).toBe(null, 'getTicketEcm');
// cspell: disable-next
@@ -424,9 +422,8 @@ describe('AuthenticationService', () => {
it('[ALL] should return login fail if only BPM call fail', (done) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
(err: any) => {
() => {},
() => {
expect(authService.isLoggedIn()).toBe(false);
expect(authService.getTicketEcm()).toBe(null);
expect(authService.getTicketBpm()).toBe(null);
@@ -448,9 +445,8 @@ describe('AuthenticationService', () => {
it('[ALL] should return ticket undefined when the credentials are wrong', (done) => {
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
(res) => {
},
(err: any) => {
() => {},
() => {
expect(authService.isLoggedIn()).toBe(false);
expect(authService.getTicketEcm()).toBe(null);
expect(authService.getTicketBpm()).toBe(null);

View File

@@ -179,7 +179,7 @@ describe('Log Service', () => {
appConfigService.config['logLevel'] = 'trace';
providesLogComponent = TestBed.createComponent(ProvidesLogComponent);
providesLogComponent.componentInstance.logService.onMessage.subscribe((message) => {
providesLogComponent.componentInstance.logService.onMessage.subscribe(() => {
done();
});

View File

@@ -89,7 +89,7 @@ describe('RenditionsService', () => {
});
it('Create rendition service should call the server with the ID passed and the asked encoding', (done) => {
service.createRendition('fake-node-id', 'pdf').subscribe((res) => {
service.createRendition('fake-node-id', 'pdf').subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
done();
@@ -114,8 +114,8 @@ describe('RenditionsService', () => {
});
it('Get rendition service should catch the error', (done) => {
service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => {
}, (res) => {
service.getRenditionsListByNodeId('fake-node-id').subscribe(() => {
}, () => {
done();
}
);

View File

@@ -63,7 +63,7 @@ export class SharedLinksApiService {
* @returns The shared link just created
*/
createSharedLinks(nodeId: string, options: any = {}): Observable<SharedLinkEntry> {
const promise = this.sharedLinksApi.addSharedLink({ nodeId: nodeId });
const promise = this.sharedLinksApi.addSharedLink({ nodeId: nodeId }, options);
return from(promise).pipe(
catchError((err) => of(err))

View File

@@ -158,7 +158,7 @@ export class TranslateLoaderService implements TranslateLoader {
observer.complete();
}
},
(err) => {
() => {
observer.error('Failed to load some resources');
});
} else {

View File

@@ -222,8 +222,7 @@ export class UploadService {
emitter.emit({ value: data });
}
})
.catch((err) => {
});
.catch(() => {});
return promise;
}

View File

@@ -89,7 +89,7 @@ describe('ErrorContentComponent', () => {
}));
it('should hide secondary button if this one has no value', async(() => {
spyOn(translateService, 'instant').and.callFake((inputString) => {
spyOn(translateService, 'instant').and.callFake(() => {
return '';
});
fixture.detectChanges();
@@ -100,7 +100,7 @@ describe('ErrorContentComponent', () => {
}));
it('should render secondary button with its value from the translate file', async(() => {
spyOn(translateService, 'instant').and.callFake((inputString) => {
spyOn(translateService, 'instant').and.callFake(() => {
return 'Secondary Button';
});
fixture.detectChanges();

View File

@@ -46,19 +46,19 @@ class FakeSanitizer extends DomSanitizer {
return value;
}
bypassSecurityTrustStyle(value: string): any {
bypassSecurityTrustStyle(): any {
return null;
}
bypassSecurityTrustScript(value: string): any {
bypassSecurityTrustScript(): any {
return null;
}
bypassSecurityTrustUrl(value: string): any {
bypassSecurityTrustUrl(): any {
return null;
}
bypassSecurityTrustResourceUrl(value: string): any {
bypassSecurityTrustResourceUrl(): any {
return null;
}
}

View File

@@ -360,7 +360,7 @@ describe('IdentityGroupService', () => {
it('should be able to create group', (done) => {
const createCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(createGroupMappingApi);
service.createGroup(mockIdentityGroup1).subscribe((res) => {
service.createGroup(mockIdentityGroup1).subscribe(() => {
expect(createCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -390,7 +390,7 @@ describe('IdentityGroupService', () => {
it('should be able to update group', (done) => {
const updateCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(updateGroupMappingApi);
service.updateGroup('mock-group-id', mockIdentityGroup1).subscribe((res) => {
service.updateGroup('mock-group-id', mockIdentityGroup1).subscribe(() => {
expect(updateCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -420,7 +420,7 @@ describe('IdentityGroupService', () => {
it('should be able to delete group', (done) => {
const deleteCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(deleteGroupMappingApi);
service.deleteGroup('mock-group-id').subscribe((res) => {
service.deleteGroup('mock-group-id').subscribe(() => {
expect(deleteCustomApiSpy).toHaveBeenCalled();
done();
});

View File

@@ -330,7 +330,7 @@ describe('IdentityUserService', () => {
it('should be able to create user', (done) => {
const createCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(createUserMockApi);
service.createUser(mockIdentityUser1).subscribe((res) => {
service.createUser(mockIdentityUser1).subscribe(() => {
expect(createCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -360,7 +360,7 @@ describe('IdentityUserService', () => {
it('should be able to update user', (done) => {
const updateCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(updateUserMockApi);
service.updateUser('mock-id-2', mockIdentityUser2).subscribe((res) => {
service.updateUser('mock-id-2', mockIdentityUser2).subscribe(() => {
expect(updateCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -390,7 +390,7 @@ describe('IdentityUserService', () => {
it('should be able to delete group', (done) => {
const deleteCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(deleteUserMockApi);
service.deleteUser('mock-user-id').subscribe((res) => {
service.deleteUser('mock-user-id').subscribe(() => {
expect(deleteCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -456,7 +456,7 @@ describe('IdentityUserService', () => {
it('should be able to join the group', (done) => {
const joinGroupCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(joinGroupMockApi);
service.joinGroup(mockJoinGroupRequest).subscribe((res) => {
service.joinGroup(mockJoinGroupRequest).subscribe(() => {
expect(joinGroupCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -486,7 +486,7 @@ describe('IdentityUserService', () => {
it('should be able to leave the group', (done) => {
const leaveGroupCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(leaveGroupMockApi);
service.leaveGroup('mock-user-id', 'mock-group-id').subscribe((res) => {
service.leaveGroup('mock-user-id', 'mock-group-id').subscribe(() => {
expect(leaveGroupCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -630,7 +630,7 @@ describe('IdentityUserService', () => {
it('should be able to assign roles to the user', (done) => {
const assignRolesCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(assignRolesMockApi);
service.assignRoles('mock-user-id', [mockIdentityRole]).subscribe((res) => {
service.assignRoles('mock-user-id', [mockIdentityRole]).subscribe(() => {
expect(assignRolesCustomApiSpy).toHaveBeenCalled();
done();
});
@@ -660,7 +660,7 @@ describe('IdentityUserService', () => {
it('should be able to remove roles', (done) => {
const removeRolesCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(removeRolesMockApi);
service.removeRoles('mock-user-id', [mockIdentityRole]).subscribe((res) => {
service.removeRoles('mock-user-id', [mockIdentityRole]).subscribe(() => {
expect(removeRolesCustomApiSpy).toHaveBeenCalled();
done();
});

View File

@@ -39,8 +39,7 @@ export class PdfThumbComponent implements OnInit {
private getThumb(page): Promise<string> {
const viewport = page.getViewport(1);
const pageRatio = viewport.width / viewport.height;
const canvas = this.getCanvas(pageRatio);
const canvas = this.getCanvas();
const scale = Math.min((canvas.height / viewport.height), (canvas.width / viewport.width));
return page.render({
@@ -53,7 +52,7 @@ export class PdfThumbComponent implements OnInit {
});
}
private getCanvas(pageRatio): HTMLCanvasElement {
private getCanvas(): HTMLCanvasElement {
const canvas = document.createElement('canvas');
canvas.width = this.page.getWidth();
canvas.height = this.page.getHeight();

View File

@@ -47,7 +47,7 @@ describe('PdfThumbListComponent', () => {
return this._currentPageNumber;
},
pdfDocument: {
getPage: (pageNum) => Promise.resolve({
getPage: () => Promise.resolve({
getViewport: () => ({ height: 421, width: 335 }),
render: jasmine.createSpy('render').and.returnValue(Promise.resolve())
})

View File

@@ -43,8 +43,8 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
@ContentChild(TemplateRef)
template: any;
@HostListener('window:resize', ['$event'])
onResize(event) {
@HostListener('window:resize')
onResize() {
this.calculateItems();
}
@@ -74,7 +74,7 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
this.pdfViewer.eventBus.off('pagechange', this.onPageChange);
}
trackByFn(index: number, item: any): number {
trackByFn(_: number, item: any): number {
return item.id;
}

View File

@@ -336,7 +336,7 @@ describe('Test PdfViewer component', () => {
fixtureUrlTestPasswordComponent = TestBed.createComponent(UrlTestPasswordComponent);
componentUrlTestPasswordComponent = fixtureUrlTestPasswordComponent.componentInstance;
spyOn(dialog, 'open').and.callFake((comp, context) => {
spyOn(dialog, 'open').and.callFake((_, context) => {
if (context.data.reason === pdfjsLib.PasswordResponses.NEED_PASSWORD) {
return {
afterClosed: () => of('wrong_password')

View File

@@ -487,7 +487,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
*
* @param event
*/
onPagesLoaded(event) {
onPagesLoaded() {
this.isPanelDisabled = false;
}

View File

@@ -170,7 +170,7 @@ describe('ViewerComponent', () => {
it('should extension file pdf be loaded', (done) => {
component.urlFile = 'fake-test-file.pdf';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -182,7 +182,7 @@ describe('ViewerComponent', () => {
it('should extension file png be loaded', (done) => {
component.urlFile = 'fake-url-file.png';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -194,7 +194,7 @@ describe('ViewerComponent', () => {
it('should extension file mp4 be loaded', (done) => {
component.urlFile = 'fake-url-file.mp4';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -206,7 +206,7 @@ describe('ViewerComponent', () => {
it('should extension file txt be loaded', (done) => {
component.urlFile = 'fake-test-file.txt';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -219,7 +219,7 @@ describe('ViewerComponent', () => {
it('should display [unknown format] for unsupported extensions', (done) => {
component.urlFile = 'fake-url-file.unsupported';
component.mimeType = '';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -240,7 +240,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-img';
component.mimeType = 'image/png';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -253,7 +253,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-img.bin';
component.mimeType = 'image/png';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -266,7 +266,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-txt.bin';
component.mimeType = 'text/plain';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -292,7 +292,7 @@ describe('ViewerComponent', () => {
component.displayName = null;
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('adf-viewer-unknown-format')).toBeDefined();
@@ -304,7 +304,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-video.bin';
component.mimeType = 'video/mp4';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -317,7 +317,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-video';
component.mimeType = 'video/mp4';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -330,7 +330,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-content-pdf';
component.mimeType = 'application/pdf';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -343,7 +343,7 @@ describe('ViewerComponent', () => {
it('should display a PDF file identified by mimetype when the file extension is wrong', (done) => {
component.urlFile = 'fake-content-pdf.bin';
component.mimeType = 'application/pdf';
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -366,13 +366,13 @@ describe('ViewerComponent', () => {
component.showViewer = true;
component.nodeId = 'id1';
component.ngOnChanges({});
component.ngOnChanges();
tick();
expect(component.fileTitle).toBe('file1');
component.nodeId = 'id2';
component.ngOnChanges({});
component.ngOnChanges();
tick();
expect(component.fileTitle).toBe('file2');
@@ -601,7 +601,7 @@ describe('ViewerComponent', () => {
};
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(component.nodeEntry).toBe(node);
@@ -642,7 +642,7 @@ describe('ViewerComponent', () => {
component.urlFile = null;
component.mimeType = null;
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('[data-automation-id="adf-toolbar-back"]')).toBeNull();
@@ -666,7 +666,7 @@ describe('ViewerComponent', () => {
});
it('should Name File be present if is overlay mode ', (done) => {
component.ngOnChanges(null);
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -733,7 +733,7 @@ describe('ViewerComponent', () => {
component.urlFile = undefined;
expect(() => {
component.ngOnChanges(null);
component.ngOnChanges();
}).toThrow();
});
@@ -743,7 +743,7 @@ describe('ViewerComponent', () => {
component.urlFile = undefined;
expect(() => {
component.ngOnChanges(null);
component.ngOnChanges();
}).not.toThrow();
});
@@ -752,7 +752,7 @@ describe('ViewerComponent', () => {
component.nodeId = undefined;
expect(() => {
component.ngOnChanges(null);
component.ngOnChanges();
}).not.toThrow();
});
@@ -778,7 +778,7 @@ describe('ViewerComponent', () => {
component.urlFile = null;
component.mimeType = null;
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
@@ -794,7 +794,7 @@ describe('ViewerComponent', () => {
component.urlFile = null;
component.mimeType = null;
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
@@ -815,7 +815,7 @@ describe('ViewerComponent', () => {
component.urlFile = null;
component.mimeType = null;
component.ngOnChanges(null);
component.ngOnChanges();
});
});
@@ -831,7 +831,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-url-file.png';
component.ngOnChanges(null);
component.ngOnChanges();
});
});
@@ -841,7 +841,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-test-file.pdf';
component.displayName = 'test name';
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -854,7 +854,7 @@ describe('ViewerComponent', () => {
component.urlFile = 'fake-test-file.pdf';
component.displayName = null;
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -870,7 +870,7 @@ describe('ViewerComponent', () => {
component.displayName = 'blob file display name';
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -883,7 +883,7 @@ describe('ViewerComponent', () => {
component.displayName = null;
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
fixture.detectChanges();
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@@ -911,7 +911,7 @@ describe('ViewerComponent', () => {
component.displayName = null;
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
component.ngOnChanges(null);
component.ngOnChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual(displayName);

View File

@@ -17,7 +17,7 @@
import {
Component, ContentChild, EventEmitter, HostListener, ElementRef,
Input, OnChanges, Output, SimpleChanges, TemplateRef,
Input, OnChanges, Output, TemplateRef,
ViewEncapsulation, OnInit, OnDestroy
} from '@angular/core';
import { RenditionPaging, SharedLinkEntry, Node, RenditionEntry, NodeEntry } from '@alfresco/js-api';
@@ -278,7 +278,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
}
ngOnChanges(changes: SimpleChanges) {
ngOnChanges() {
if (this.showViewer) {
if (!this.isSourceDefined()) {
throw new Error('A content source attribute value is missing.');
@@ -299,7 +299,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
this.isLoading = false;
});
},
(error) => {
() => {
this.isLoading = false;
this.logService.error('This node does not exist');
}