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

@ -561,7 +561,9 @@
"lint": { "lint": {
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-devkit/build-angular:tslint",
"options": { "options": {
"tsConfig": [], "tsConfig": [
"./e2e/tsconfig.e2e.json"
],
"exclude": [ "exclude": [
"**/node_modules/**/*" "**/node_modules/**/*"
] ]

View File

@ -18,7 +18,7 @@
import { Component, ViewEncapsulation } from '@angular/core'; import { Component, ViewEncapsulation } from '@angular/core';
import { SitePaging, SiteEntry, MinimalNodeEntryEntity } from '@alfresco/js-api'; import { SitePaging, SiteEntry, MinimalNodeEntryEntity } from '@alfresco/js-api';
import { ContentNodeDialogService, ShareDataRow, RowFilter } from '@alfresco/adf-content-services'; import { ContentNodeDialogService, ShareDataRow, RowFilter } from '@alfresco/adf-content-services';
import { DataRow, DataColumn, ThumbnailService } from '@alfresco/adf-core'; import { ThumbnailService } from '@alfresco/adf-core';
@Component({ @Component({
templateUrl: './content-node-selector.component.html', templateUrl: './content-node-selector.component.html',
@ -95,7 +95,7 @@ export class ContentNodeSelectorComponent {
return showNode; return showNode;
} }
customImageResolverExample(row: DataRow, col: DataColumn) { customImageResolverExample() {
return this.thumbnailService.getMimeTypeIcon('video/quicktime'); return this.thumbnailService.getMimeTypeIcon('video/quicktime');
} }

View File

@ -55,7 +55,7 @@ export class ExtensionPresetsComponent implements OnInit, OnDestroy {
this.onDestroy$.complete(); this.onDestroy$.complete();
} }
trackById(index: number, obj: { id: string }) { trackById(_: number, obj: { id: string }) {
return obj.id; return obj.id;
} }
} }

View File

@ -27,7 +27,7 @@ import { MinimalNodeEntity, NodePaging, Pagination, MinimalNodeEntryEntity, Site
import { import {
AlfrescoApiService, AuthenticationService, AppConfigService, AppConfigValues, ContentService, TranslationService, AlfrescoApiService, AuthenticationService, AppConfigService, AppConfigValues, ContentService, TranslationService,
FileUploadEvent, FolderCreatedEvent, LogService, NotificationService, FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
UploadService, DataColumn, DataRow, UserPreferencesService, UploadService, DataRow, UserPreferencesService,
PaginationComponent, FormValues, DisplayMode, InfinitePaginationComponent, HighlightDirective, PaginationComponent, FormValues, DisplayMode, InfinitePaginationComponent, HighlightDirective,
SharedLinksApiService SharedLinksApiService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
@ -474,7 +474,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
return this.contentService.hasAllowableOperations(selection[0].entry, 'update'); return this.contentService.hasAllowableOperations(selection[0].entry, 'update');
} }
getNodeNameTooltip(row: DataRow, col: DataColumn): string { getNodeNameTooltip(row: DataRow): string {
if (row) { if (row) {
return row.getValue('name'); return row.getValue('name');
} }

View File

@ -18,35 +18,43 @@
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import {
AppConfigService, AlfrescoApiService, EcmModelService, LogService, FormService, FormOutcomeEvent AlfrescoApiService,
EcmModelService,
LogService,
FormService,
FormOutcomeEvent
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
@Injectable() @Injectable()
export class FakeFormService extends FormService { export class FakeFormService extends FormService {
executeOutcome = new Subject<FormOutcomeEvent>(); executeOutcome = new Subject<FormOutcomeEvent>();
constructor(appConfig: AppConfigService, constructor(
ecmModelService: EcmModelService, ecmModelService: EcmModelService,
apiService: AlfrescoApiService, apiService: AlfrescoApiService,
protected logService: LogService) { protected logService: LogService
) {
super(ecmModelService, apiService, logService); super(ecmModelService, apiService, logService);
} }
public getRestFieldValues(taskId: string, fieldId: string): Observable<any> { public getRestFieldValues(
taskId: string,
fieldId: string
): Observable<any> {
if (fieldId === 'typeaheadField') { if (fieldId === 'typeaheadField') {
return of([ return of([
{ 'id': '1', 'name': 'Leanne Graham' }, { id: '1', name: 'Leanne Graham' },
{ 'id': '2', 'name': 'Ervin Howell' }, { id: '2', name: 'Ervin Howell' },
{ 'id': '3', 'name': 'Clementine Bauch' }, { id: '3', name: 'Clementine Bauch' },
{ 'id': '4', 'name': 'Patricia Lebsack' }, { id: '4', name: 'Patricia Lebsack' },
{ 'id': '5', 'name': 'Chelsey Dietrich' }, { id: '5', name: 'Chelsey Dietrich' },
{ 'id': '6', 'name': 'Mrs. Dennis Schulist' }, { id: '6', name: 'Mrs. Dennis Schulist' },
{ 'id': '7', 'name': 'Kurtis Weissnat' }, { id: '7', name: 'Kurtis Weissnat' },
{ 'id': '8', 'name': 'Nicholas Runolfsdottir V' }, { id: '8', name: 'Nicholas Runolfsdottir V' },
{ 'id': '9', 'name': 'Glenna Reichert' }, { id: '9', name: 'Glenna Reichert' },
{ 'id': '10', 'name': 'Clementina DuBuque' }]); { id: '10', name: 'Clementina DuBuque' }
]);
} else { } else {
return super.getRestFieldValues(taskId, fieldId); return super.getRestFieldValues(taskId, fieldId);
} }

View File

@ -16,7 +16,7 @@
*/ */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CoreModule, TranslationService } from '@alfresco/adf-core'; import { CoreModule } from '@alfresco/adf-core';
import { LazyLoadingRoutes } from './lazy-loading.routes'; import { LazyLoadingRoutes } from './lazy-loading.routes';
import { LazyLoadingComponent } from './lazy-loading.component'; import { LazyLoadingComponent } from './lazy-loading.component';
@ -30,7 +30,4 @@ import { LazyLoadingComponent } from './lazy-loading.component';
LazyLoadingComponent LazyLoadingComponent
] ]
}) })
export class LazyLoadingModule { export class LazyLoadingModule {}
constructor(translation: TranslationService) {
}
}

View File

@ -85,7 +85,7 @@
[showRememberMe]="showFooter && showRememberMe" [showRememberMe]="showFooter && showRememberMe"
(executeSubmit)="checkForm($event)" (executeSubmit)="checkForm($event)"
copyrightText="{{ 'application.copyright' | adfAppConfig }}" copyrightText="{{ 'application.copyright' | adfAppConfig }}"
(success)="onLogin($event)" (success)="onLogin()"
(error)="onError($event)"> (error)="onError($event)">
<div class="adf-mobile-settings"> <div class="adf-mobile-settings">
<p> <p>

View File

@ -55,7 +55,7 @@ export class LoginComponent implements OnInit {
this.alfrescoLogin.addCustomValidationError('password', 'required', 'LOGIN.MESSAGES.PASSWORD-REQUIRED'); this.alfrescoLogin.addCustomValidationError('password', 'required', 'LOGIN.MESSAGES.PASSWORD-REQUIRED');
} }
onLogin($event) { onLogin() {
this.router.navigate(['/home']); this.router.navigate(['/home']);
} }

View File

@ -5,7 +5,7 @@
(error)="showErrorMessage($event)" (error)="showErrorMessage($event)"
(updated)="onUpdatedPermissions($event)"> (updated)="onUpdatedPermissions($event)">
{{ (toggleStatus?'DEMO_PERMISSION.INHERITED_PERMISSIONS_BUTTON':'DEMO_PERMISSION.INHERIT_PERMISSION_BUTTON') | translate}}</button> {{ (toggleStatus?'DEMO_PERMISSION.INHERITED_PERMISSIONS_BUTTON':'DEMO_PERMISSION.INHERIT_PERMISSION_BUTTON') | translate}}</button>
<button mat-button color="primary" (click)="openAddPermissionDialog($event)" data-automation-id="adf-add-permission-button">Add User or Group</button> <button mat-button color="primary" (click)="openAddPermissionDialog()" data-automation-id="adf-add-permission-button">Add User or Group</button>
</div> </div>
<div> <div>

View File

@ -64,7 +64,7 @@ export class DemoPermissionComponent implements OnInit {
this.displayPermissionComponent.reload(); this.displayPermissionComponent.reload();
} }
openAddPermissionDialog(event: Event) { openAddPermissionDialog() {
this.nodePermissionDialogService this.nodePermissionDialogService
.updateNodePermissionByDialog(this.nodeId) .updateNodePermissionByDialog(this.nodeId)
.subscribe( .subscribe(

View File

@ -28,7 +28,7 @@
[appId]="appId" [appId]="appId"
[showIcon]="showTaskFilterIcon" [showIcon]="showTaskFilterIcon"
(filterClick)="onTaskFilterClick($event)" (filterClick)="onTaskFilterClick($event)"
(success)="onSuccessTaskFilterList($event)" #activitiFilter> (success)="onSuccessTaskFilterList()" #activitiFilter>
</adf-task-filters> </adf-task-filters>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
@ -48,7 +48,7 @@
[sort]="taskFilter?.filter?.sort" [sort]="taskFilter?.filter?.sort"
[landingTaskId]="currentTaskId" [landingTaskId]="currentTaskId"
(rowClick)="onTaskRowClick($event)" (rowClick)="onTaskRowClick($event)"
(success)="onSuccessTaskList($event)" (success)="onSuccessTaskList()"
(row-click)="onRowClick($event)" (row-click)="onRowClick($event)"
(row-dblclick)="onTaskRowDblClick($event)" (row-dblclick)="onTaskRowDblClick($event)"
[multiselect]="multiSelectTask" [multiselect]="multiSelectTask"
@ -76,11 +76,11 @@
[taskId]="currentTaskId" [taskId]="currentTaskId"
[fieldValidators]="fieldValidators" [fieldValidators]="fieldValidators"
[showHeaderContent]="showHeaderContent" [showHeaderContent]="showHeaderContent"
(formCompleted)="onFormCompleted($event)" (formCompleted)="onFormCompleted()"
(formContentClicked)="onContentClick($event)" (formContentClicked)="onContentClick($event)"
(taskCreated)="onTaskCreated($event)" (taskCreated)="onTaskCreated($event)"
(assignTask)="onAssignTask()" (assignTask)="onAssignTask()"
(taskDeleted)="onTaskDeleted($event)"> (taskDeleted)="onTaskDeleted()">
</adf-task-details> </adf-task-details>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div *ngIf="currentTaskId"> <div *ngIf="currentTaskId">
@ -144,7 +144,7 @@
[showIcon]="showProcessFilterIcon" [showIcon]="showProcessFilterIcon"
(filterClick)="onProcessFilterChange($event)" (filterClick)="onProcessFilterChange($event)"
(filterSelected)="onProcessFilterChange($event)" (filterSelected)="onProcessFilterChange($event)"
(success)="onSuccessProcessFilterList($event)"> (success)="onSuccessProcessFilterList()">
</adf-process-instance-filters> </adf-process-instance-filters>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
@ -164,7 +164,7 @@
(rowClick)="onProcessRowClick($event)" (rowClick)="onProcessRowClick($event)"
(row-dblclick)="onProcessRowDblClick($event)" (row-dblclick)="onProcessRowDblClick($event)"
[multiselect]="multiSelectProcess" [multiselect]="multiSelectProcess"
(success)="onSuccessProcessList($event)"> (success)="onSuccessProcessList()">
<!-- Custom column definition demo --> <!-- Custom column definition demo -->
<!-- <data-columns> <!-- <data-columns>
@ -242,7 +242,7 @@
[appId]="appId" [appId]="appId"
[reportId]="report.id" [reportId]="report.id"
[hideParameters]="false" [hideParameters]="false"
(editReport)="onEditReport($event)" (editReport)="onEditReport()"
(reportSaved)="onReportSaved($event)" (reportSaved)="onReportSaved($event)"
(reportDeleted)="onReportDeleted()"> (reportDeleted)="onReportDeleted()">
</adf-analytics> </adf-analytics>

View File

@ -30,7 +30,6 @@ import {
} from '@angular/core'; } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { import {
ProcessInstanceFilterRepresentation,
Pagination, Pagination,
UserProcessInstanceFilterRepresentation UserProcessInstanceFilterRepresentation
} from '@alfresco/js-api'; } from '@alfresco/js-api';
@ -306,7 +305,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.report = event; this.report = event;
} }
onSuccessTaskFilterList(event: any): void { onSuccessTaskFilterList(): void {
this.applyTaskFilter(this.activitiFilter.getCurrentFilter()); this.applyTaskFilter(this.activitiFilter.getCurrentFilter());
} }
@ -329,7 +328,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.reloadTaskFilters(); this.reloadTaskFilters();
} }
onSuccessTaskList(event: FilterRepresentationModel) { onSuccessTaskList() {
this.currentTaskId = this.taskList.getCurrentId(); this.currentTaskId = this.taskList.getCurrentId();
} }
@ -343,15 +342,15 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.processPage = 0; this.processPage = 0;
} }
onSuccessProcessFilterList(event: ProcessInstanceFilterRepresentation[]): void { onSuccessProcessFilterList(): void {
this.processFilter = this.activitiProcessFilter.getCurrentFilter(); this.processFilter = this.activitiProcessFilter.getCurrentFilter();
} }
onSuccessProcessList(event: any): void { onSuccessProcessList(): void {
this.currentProcessInstanceId = this.processList.getCurrentId(); this.currentProcessInstanceId = this.processList.getCurrentId();
} }
onTaskRowClick(taskId): void { onTaskRowClick(taskId: string): void {
this.currentTaskId = taskId; this.currentTaskId = taskId;
} }
@ -365,15 +364,15 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.currentProcessInstanceId = processInstanceId; this.currentProcessInstanceId = processInstanceId;
} }
onProcessRowClick(processInstanceId): void { onProcessRowClick(processInstanceId: string): void {
this.currentProcessInstanceId = processInstanceId; this.currentProcessInstanceId = processInstanceId;
} }
onEditReport(name: string): void { onEditReport(): void {
this.analyticsReportList.reload(); this.analyticsReportList.reload();
} }
onReportSaved(reportId): void { onReportSaved(reportId: number): void {
this.analyticsReportList.reload(reportId); this.analyticsReportList.reload(reportId);
} }
@ -409,12 +408,12 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
return this.currentTaskId === currentTaskIdNew; return this.currentTaskId === currentTaskIdNew;
} }
processCancelled(data: any): void { processCancelled(): void {
this.currentProcessInstanceId = null; this.currentProcessInstanceId = null;
this.processList.reload(); this.processList.reload();
} }
onFormCompleted(form): void { onFormCompleted(): void {
this.currentTaskId = null; this.currentTaskId = null;
if (this.taskListPagination) { if (this.taskListPagination) {
this.taskPage = this.taskListPagination.current - 1; this.taskPage = this.taskListPagination.current - 1;
@ -468,7 +467,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.taskList.reload(); this.taskList.reload();
} }
onTaskDeleted(data: any): void { onTaskDeleted(): void {
this.taskList.reload(); this.taskList.reload();
} }

View File

@ -11,6 +11,7 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true,
"target": "es5", "target": "es5",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"typeRoots": [ "typeRoots": [

View File

@ -24,7 +24,7 @@ const JS_BIND_INPUT = function(target) {
const input = document.createElement('input'); const input = document.createElement('input');
input.type = 'file'; input.type = 'file';
input.style.display = 'none'; input.style.display = 'none';
input.addEventListener('change', function(event) { input.addEventListener('change', function() {
target.scrollIntoView(true); target.scrollIntoView(true);
const rect = target.getBoundingClientRect(); const rect = target.getBoundingClientRect();
@ -52,7 +52,7 @@ const JS_BIND_INPUT_FOLDER = function(target) {
input.style.display = 'none'; input.style.display = 'none';
input.multiple = true; input.multiple = true;
input.webkitdirectory = true; input.webkitdirectory = true;
input.addEventListener('change', function(event) { input.addEventListener('change', function() {
target.scrollIntoView(true); target.scrollIntoView(true);
const rect = target.getBoundingClientRect(); const rect = target.getBoundingClientRect();

View File

@ -118,7 +118,7 @@ describe('Comment Component', () => {
await viewerPage.clickOnCommentsTab(); await viewerPage.clickOnCommentsTab();
await commentsPage.addComment(comments.first); await commentsPage.addComment(comments.first);
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.first); await expect(await commentsPage.getMessage(0)).toEqual(comments.first);
@ -134,7 +134,7 @@ describe('Comment Component', () => {
await viewerPage.clickOnCommentsTab(); await viewerPage.clickOnCommentsTab();
await commentsPage.addComment(comments.multiline); await commentsPage.addComment(comments.multiline);
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.multiline); await expect(await commentsPage.getMessage(0)).toEqual(comments.multiline);
@ -142,7 +142,7 @@ describe('Comment Component', () => {
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/); await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
await commentsPage.addComment(comments.second); await commentsPage.addComment(comments.second);
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (2)'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (2)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.second); await expect(await commentsPage.getMessage(0)).toEqual(comments.second);
@ -158,7 +158,7 @@ describe('Comment Component', () => {
await viewerPage.clickOnCommentsTab(); await viewerPage.clickOnCommentsTab();
await commentsPage.addComment(comments.codeType); await commentsPage.addComment(comments.codeType);
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual('First name: Last name:'); await expect(await commentsPage.getMessage(0)).toEqual('First name: Last name:');

View File

@ -35,7 +35,7 @@ export class CommentsPage {
return BrowserActions.getText(this.numberOfComments); return BrowserActions.getText(this.numberOfComments);
} }
async checkUserIconIsDisplayed(position): Promise<void> { async checkUserIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first()); await BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first());
} }

View File

@ -48,7 +48,7 @@ export class StartProcessPage {
return this.defaultProcessName.getAttribute('value'); return this.defaultProcessName.getAttribute('value');
} }
async deleteDefaultName(name) { async deleteDefaultName() {
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput); await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
await BrowserActions.clearWithBackSpace(this.processNameInput); await BrowserActions.clearWithBackSpace(this.processNameInput);
} }

View File

@ -81,7 +81,7 @@ describe('Comment component for Processes', () => {
addedComment = await this.alfrescoJsApi.activiti.commentsApi.getProcessInstanceComments(processInstanceId, { 'latestFirst': true }); addedComment = await this.alfrescoJsApi.activiti.commentsApi.getProcessInstanceComments(processInstanceId, { 'latestFirst': true });
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + addedComment.total + ')'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + addedComment.total + ')');
await expect(await commentsPage.getMessage(0)).toEqual(addedComment.data[0].message); await expect(await commentsPage.getMessage(0)).toEqual(addedComment.data[0].message);
@ -119,7 +119,7 @@ describe('Comment component for Processes', () => {
const addedTaskComment = await this.alfrescoJsApi.activiti.commentsApi.getProcessInstanceComments(processInstanceId, { 'latestFirst': true }); const addedTaskComment = await this.alfrescoJsApi.activiti.commentsApi.getProcessInstanceComments(processInstanceId, { 'latestFirst': true });
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + addedTaskComment.total + ')'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + addedTaskComment.total + ')');
await expect(await commentsPage.getMessage(0)).toEqual(addedTaskComment.data[0].message); await expect(await commentsPage.getMessage(0)).toEqual(addedTaskComment.data[0].message);

View File

@ -119,8 +119,8 @@ describe('Comment component for Processes', () => {
const thirdTaskComment = { message: 'Third Task Comment' }; const thirdTaskComment = { message: 'Third Task Comment' };
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed(1); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + totalCommentsLatest.total + ')'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + totalCommentsLatest.total + ')');
@ -145,9 +145,9 @@ describe('Comment component for Processes', () => {
const totalComments = await this.alfrescoJsApi.activiti.taskApi.getTaskComments(newTaskId, { 'latestFirst': true }); const totalComments = await this.alfrescoJsApi.activiti.taskApi.getTaskComments(newTaskId, { 'latestFirst': true });
await commentsPage.checkUserIconIsDisplayed(0); await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed(1); await commentsPage.checkUserIconIsDisplayed();
await commentsPage.checkUserIconIsDisplayed(2); await commentsPage.checkUserIconIsDisplayed();
await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + totalComments.total + ')'); await expect(await commentsPage.getTotalNumberOfComments()).toEqual('Comments (' + totalComments.total + ')');

View File

@ -163,7 +163,7 @@ describe('Start Process Component', () => {
await processFiltersPage.clickNewProcessDropdown(); await processFiltersPage.clickNewProcessDropdown();
await startProcessPage.selectFromProcessDropdown(processModelWithoutSe); await startProcessPage.selectFromProcessDropdown(processModelWithoutSe);
await startProcessPage.deleteDefaultName('My Default Name'); await startProcessPage.deleteDefaultName();
await browser.sleep(1000); await browser.sleep(1000);

View File

@ -7,8 +7,8 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noImplicitAny": true, "noImplicitAny": true,
"noImplicitThis": true, "noImplicitThis": true,
"noUnusedParameters": false, // The linter is used for these. "noUnusedParameters": true,
"noUnusedLocals": false, // The linter is used for these. "noUnusedLocals": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": ".", "rootDir": ".",
"skipLibCheck": true, "skipLibCheck": true,

View File

@ -24,7 +24,6 @@ import {
PresetConfig, PresetConfig,
ContentMetadataConfig, ContentMetadataConfig,
AspectOrientedConfig, AspectOrientedConfig,
InDifferentConfig,
LayoutOrientedConfig LayoutOrientedConfig
} from '../../interfaces/content-metadata.interfaces'; } from '../../interfaces/content-metadata.interfaces';
@ -60,7 +59,7 @@ export class ContentMetadataConfigFactory {
} else if (this.isAspectOrientedPreset(presetConfig)) { } else if (this.isAspectOrientedPreset(presetConfig)) {
config = new AspectOrientedConfigService(<AspectOrientedConfig> presetConfig); config = new AspectOrientedConfigService(<AspectOrientedConfig> presetConfig);
} else { } else {
config = new IndifferentConfigService(<InDifferentConfig> presetConfig); config = new IndifferentConfigService();
} }
Object.freeze(config); Object.freeze(config);

View File

@ -21,13 +21,11 @@ import { ContentMetadataConfig, OrganisedPropertyGroup,
export class IndifferentConfigService implements ContentMetadataConfig { export class IndifferentConfigService implements ContentMetadataConfig {
constructor(config: any) {} isGroupAllowed(): boolean {
public isGroupAllowed(groupName: string): boolean {
return true; return true;
} }
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] { reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
return Object.keys(propertyGroups) return Object.keys(propertyGroups)
.map((groupName) => { .map((groupName) => {
const propertyGroup = propertyGroups[groupName], const propertyGroup = propertyGroups[groupName],
@ -39,15 +37,15 @@ export class IndifferentConfigService implements ContentMetadataConfig {
}); });
} }
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] { filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
return propertyGroups; return propertyGroups;
} }
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] { appendAllPreset(): OrganisedPropertyGroup[] {
return[]; return[];
} }
public isIncludeAllEnabled(): boolean { isIncludeAllEnabled(): boolean {
return true; return true;
} }
} }

View File

@ -202,7 +202,7 @@ describe('ContentNodeDialogService', () => {
let testContentNodeSelectorComponentData; let testContentNodeSelectorComponentData;
beforeEach(() => { beforeEach(() => {
spyOnDialogOpen.and.callFake((contentNodeSelectorComponent: any, config: any) => { spyOnDialogOpen.and.callFake((_: any, config: any) => {
testContentNodeSelectorComponentData = config.data; testContentNodeSelectorComponentData = config.data;
return { componentInstance: {} }; return { componentInstance: {} };
}); });

View File

@ -21,7 +21,7 @@ import { ContentService, ThumbnailService } from '@alfresco/adf-core';
import { Subject, Observable, throwError } from 'rxjs'; import { Subject, Observable, throwError } from 'rxjs';
import { ShareDataRow } from '../document-list/data/share-data-row.model'; import { ShareDataRow } from '../document-list/data/share-data-row.model';
import { Node, NodeEntry, SitePaging } from '@alfresco/js-api'; import { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
import { DataColumn, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListService } from '../document-list/services/document-list.service';
import { ContentNodeSelectorComponent } from './content-node-selector.component'; import { ContentNodeSelectorComponent } from './content-node-selector.component';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface'; import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
@ -222,7 +222,7 @@ export class ContentNodeDialogService {
this.dialog.open(ContentNodeSelectorComponent, { data, panelClass: currentPanelClass, width: chosenWidth }); this.dialog.open(ContentNodeSelectorComponent, { data, panelClass: currentPanelClass, width: chosenWidth });
} }
private imageResolver(row: ShareDataRow, col: DataColumn): string | null { private imageResolver(row: ShareDataRow): string | null {
const entry: Node = row.node.entry; const entry: Node = row.node.entry;
if (!this.contentService.hasAllowableOperations(entry, 'create')) { if (!this.contentService.hasAllowableOperations(entry, 'create')) {
return this.thumbnailService.getMimeTypeIcon('disable/folder'); return this.thumbnailService.getMimeTypeIcon('disable/folder');

View File

@ -65,7 +65,7 @@ describe('LibraryDialogComponent', () => {
it('should set library id automatically on title input', fakeAsync(() => { it('should set library id automatically on title input', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -80,7 +80,7 @@ describe('LibraryDialogComponent', () => {
it('should translate library title space character to dash for library id', fakeAsync(() => { it('should translate library title space character to dash for library id', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -95,7 +95,7 @@ describe('LibraryDialogComponent', () => {
it('should not change custom library id on title input', fakeAsync(() => { it('should not change custom library id on title input', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -134,7 +134,7 @@ describe('LibraryDialogComponent', () => {
Promise.resolve() Promise.resolve()
); );
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -194,10 +194,10 @@ describe('LibraryDialogComponent', () => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
const error = { message: '{ "error": { "statusCode": 409 } }' }; const error = { message: '{ "error": { "statusCode": 409 } }' };
spyOn(alfrescoApi.sitesApi, 'createSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'createSite').and.callFake(() => {
return new Promise((resolve, reject) => reject(error)); return Promise.reject(error);
}); });
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -218,7 +218,7 @@ describe('LibraryDialogComponent', () => {
it('should not translate library title if value is not a valid id', fakeAsync(() => { it('should not translate library title if value is not a valid id', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -233,7 +233,7 @@ describe('LibraryDialogComponent', () => {
it('should translate library title partially for library id', fakeAsync(() => { it('should translate library title partially for library id', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -248,7 +248,7 @@ describe('LibraryDialogComponent', () => {
it('should translate library title multiple space character to one dash for library id', fakeAsync(() => { it('should translate library title multiple space character to one dash for library id', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();
@ -263,7 +263,7 @@ describe('LibraryDialogComponent', () => {
it('should invalidate library title if is too short', fakeAsync(() => { it('should invalidate library title if is too short', fakeAsync(() => {
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse)); findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => { spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
return new Promise((resolve, reject) => reject()); return Promise.reject();
}); });
fixture.detectChanges(); fixture.detectChanges();

View File

@ -227,7 +227,7 @@ describe('ContentAction', () => {
}); });
it('should find document action handler via service', () => { it('should find document action handler via service', () => {
const handler = <ContentActionHandler> function (obj: any, target?: any) { const handler = <ContentActionHandler> function () {
}; };
const action = new ContentActionComponent(actionList, documentActions, null); const action = new ContentActionComponent(actionList, documentActions, null);
spyOn(documentActions, 'getHandler').and.returnValue(handler); spyOn(documentActions, 'getHandler').and.returnValue(handler);
@ -235,7 +235,7 @@ describe('ContentAction', () => {
}); });
it('should find folder action handler via service', () => { it('should find folder action handler via service', () => {
const handler = <ContentActionHandler> function (obj: any, target?: any) { const handler = <ContentActionHandler> function () {
}; };
const action = new ContentActionComponent(actionList, null, folderActions); const action = new ContentActionComponent(actionList, null, folderActions);
spyOn(folderActions, 'getHandler').and.returnValue(handler); spyOn(folderActions, 'getHandler').and.returnValue(handler);

View File

@ -852,7 +852,7 @@ describe('DocumentList', () => {
let called = false; let called = false;
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
documentList.preview.subscribe((val) => called = true); documentList.preview.subscribe(() => called = true);
documentList.onNodeClick(file); documentList.onNodeClick(file);
expect(called).toBeFalsy(); expect(called).toBeFalsy();
@ -1025,7 +1025,7 @@ describe('DocumentList', () => {
it('should emit node-click DOM event', (done) => { it('should emit node-click DOM event', (done) => {
const node = new NodeMinimalEntry(); const node = new NodeMinimalEntry();
document.addEventListener('node-click', (customEvent: CustomEvent) => { document.addEventListener('node-click', () => {
done(); done();
}); });
@ -1043,7 +1043,7 @@ describe('DocumentList', () => {
it('should emit node-dblclick DOM event', (done) => { it('should emit node-dblclick DOM event', (done) => {
const node = new NodeMinimalEntry(); const node = new NodeMinimalEntry();
document.addEventListener('node-dblclick', (customEvent: CustomEvent) => { document.addEventListener('node-dblclick', () => {
done(); done();
}); });

View File

@ -97,7 +97,7 @@ export class ShareDataRow implements DataRow {
return ObjectUtils.getValue(this.obj.entry, key); return ObjectUtils.getValue(this.obj.entry, key);
} }
imageErrorResolver(event: Event): any { imageErrorResolver(): any {
if (this.obj.entry.content) { if (this.obj.entry.content) {
return this.thumbnailService.getMimeTypeIcon(this.obj.entry.content.mimeType); return this.thumbnailService.getMimeTypeIcon(this.obj.entry.content.mimeType);
} }

View File

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

View File

@ -57,7 +57,7 @@ describe('DocumentActionsService', () => {
}); });
it('should register custom action handler', () => { it('should register custom action handler', () => {
const handler: ContentActionHandler = function (obj: any) { const handler: ContentActionHandler = function () {
}; };
service.setHandler('<key>', handler); service.setHandler('<key>', handler);
expect(service.getHandler('<key>')).toBe(handler); expect(service.getHandler('<key>')).toBe(handler);
@ -68,7 +68,7 @@ describe('DocumentActionsService', () => {
}); });
it('should be case insensitive for keys', () => { it('should be case insensitive for keys', () => {
const handler: ContentActionHandler = function (obj: any) { const handler: ContentActionHandler = function () {
}; };
service.setHandler('<key>', handler); service.setHandler('<key>', handler);
expect(service.getHandler('<KEY>')).toBe(handler); expect(service.getHandler('<KEY>')).toBe(handler);
@ -94,7 +94,7 @@ describe('DocumentActionsService', () => {
}); });
it('should set new handler only by key', () => { it('should set new handler only by key', () => {
const handler: ContentActionHandler = function (obj: any) { const handler: ContentActionHandler = function () {
}; };
expect(service.setHandler(null, handler)).toBeFalsy(); expect(service.setHandler(null, handler)).toBeFalsy();
expect(service.setHandler('', handler)).toBeFalsy(); expect(service.setHandler('', handler)).toBeFalsy();

View File

@ -89,27 +89,27 @@ export class DocumentActionsService {
this.handlers['lock'] = this.lockNode.bind(this); this.handlers['lock'] = this.lockNode.bind(this);
} }
private lockNode(node: NodeEntry, target?: any, permission?: string) { private lockNode(node: NodeEntry) {
return this.contentNodeDialogService.openLockNodeDialog(node.entry); return this.contentNodeDialogService.openLockNodeDialog(node.entry);
} }
private downloadNode(obj: NodeEntry, target?: any, permission?: string) { private downloadNode(obj: NodeEntry) {
this.nodeActionsService.downloadNode(obj); this.nodeActionsService.downloadNode(obj);
} }
private copyNode(node: NodeEntry, target?: any, permission?: string) { private copyNode(node: NodeEntry, _target?: any, permission?: string) {
const actionObservable = this.nodeActionsService.copyContent(node.entry, permission); const actionObservable = this.nodeActionsService.copyContent(node.entry, permission);
this.prepareHandlers(actionObservable, 'content', 'copy', target, permission); this.prepareHandlers(actionObservable);
return actionObservable; return actionObservable;
} }
private moveNode(node: NodeEntry, target?: any, permission?: string) { private moveNode(node: NodeEntry, _target?: any, permission?: string) {
const actionObservable = this.nodeActionsService.moveContent(node.entry, permission); const actionObservable = this.nodeActionsService.moveContent(node.entry, permission);
this.prepareHandlers(actionObservable, 'content', 'move', target, permission); this.prepareHandlers(actionObservable);
return actionObservable; return actionObservable;
} }
private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void { private prepareHandlers(actionObservable): void {
actionObservable.subscribe( actionObservable.subscribe(
(fileOperationMessage) => { (fileOperationMessage) => {
this.success.next(fileOperationMessage); this.success.next(fileOperationMessage);
@ -118,7 +118,7 @@ export class DocumentActionsService {
); );
} }
private deleteNode(node: NodeEntry, target?: any, permission?: string): Observable<any> { private deleteNode(node: NodeEntry, _target?: any, permission?: string): Observable<any> {
let handlerObservable; let handlerObservable;
if (this.canExecuteAction(node)) { if (this.canExecuteAction(node)) {

View File

@ -92,17 +92,17 @@ export class FolderActionsService {
private copyNode(nodeEntry: NodeEntry, target?: any, permission?: string) { private copyNode(nodeEntry: NodeEntry, target?: any, permission?: string) {
const actionObservable = this.nodeActionsService.copyFolder(nodeEntry.entry, permission); const actionObservable = this.nodeActionsService.copyFolder(nodeEntry.entry, permission);
this.prepareHandlers(actionObservable, 'folder', 'copy', target, permission); this.prepareHandlers(actionObservable, target);
return actionObservable; return actionObservable;
} }
private moveNode(nodeEntry: NodeEntry, target?: any, permission?: string) { private moveNode(nodeEntry: NodeEntry, target?: any, permission?: string) {
const actionObservable = this.nodeActionsService.moveFolder(nodeEntry.entry, permission); const actionObservable = this.nodeActionsService.moveFolder(nodeEntry.entry, permission);
this.prepareHandlers(actionObservable, 'folder', 'move', target, permission); this.prepareHandlers(actionObservable, target);
return actionObservable; return actionObservable;
} }
private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void { private prepareHandlers(actionObservable, target?: any): void {
actionObservable.subscribe( actionObservable.subscribe(
(fileOperationMessage) => { (fileOperationMessage) => {
if (target && typeof target.reload === 'function') { if (target && typeof target.reload === 'function') {

View File

@ -104,7 +104,7 @@ describe('NodeActionsService', () => {
spyOn(documentListService, 'copyNode').and.returnValue(throwError('FAKE-KO')); spyOn(documentListService, 'copyNode').and.returnValue(throwError('FAKE-KO'));
spyOn(contentDialogService, 'openCopyMoveDialog').and.returnValue(of([fakeNode])); spyOn(contentDialogService, 'openCopyMoveDialog').and.returnValue(of([fakeNode]));
service.copyFolder(fakeNode, '!allowed').subscribe((value) => { service.copyFolder(fakeNode, '!allowed').subscribe(() => {
}, (error) => { }, (error) => {
expect(error).toBe('FAKE-KO'); expect(error).toBe('FAKE-KO');
}); });

View File

@ -152,7 +152,7 @@ export let errorJson = {
this.message = event; this.message = event;
} }
elementClicked(event: any) { elementClicked() {
this.message = 'element clicked'; this.message = 'element clicked';
} }

View File

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

View File

@ -57,7 +57,7 @@ describe('InheritPermissionDirective', () => {
it('should be able to add inherited permission', async(() => { it('should be able to add inherited permission', async(() => {
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeNoInherit)); spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeNoInherit));
spyOn(nodeService, 'updateNode').and.callFake((nodeId, nodeBody) => { spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
if (nodeBody.permissions.isInheritanceEnabled) { if (nodeBody.permissions.isInheritanceEnabled) {
return of(fakeNodeWithInherit); return of(fakeNodeWithInherit);
} else { } else {
@ -77,7 +77,7 @@ describe('InheritPermissionDirective', () => {
it('should be able to remove inherited permission', async(() => { it('should be able to remove inherited permission', async(() => {
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeWithInherit)); spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeWithInherit));
spyOn(nodeService, 'updateNode').and.callFake((nodeId, nodeBody) => { spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
if (nodeBody.permissions.isInheritanceEnabled) { if (nodeBody.permissions.isInheritanceEnabled) {
return of(fakeNodeWithInherit); return of(fakeNodeWithInherit);
} else { } else {

View File

@ -110,7 +110,7 @@ describe('NodePermissionDialogService', () => {
it('should return the updated node', (done) => { it('should return the updated node', (done) => {
spyOn(contentService, 'getNode').and.returnValue(of(fakeForbiddenNode)); spyOn(contentService, 'getNode').and.returnValue(of(fakeForbiddenNode));
service.updateNodePermissionByDialog('fake-node-id', 'fake-title').subscribe((node) => { service.updateNodePermissionByDialog('fake-node-id', 'fake-title').subscribe(() => {
throwError('This call should fail'); throwError('This call should fail');
}, },
(error) => { (error) => {

View File

@ -51,7 +51,7 @@ describe('NodePermissionService', () => {
TestBed.resetTestingModule(); TestBed.resetTestingModule();
}); });
function returnUpdatedNode(nodeId, nodeBody) { function returnUpdatedNode(_, nodeBody) {
const fakeNode: Node = new Node({}); const fakeNode: Node = new Node({});
fakeNode.id = 'fake-updated-node'; fakeNode.id = 'fake-updated-node';
fakeNode.permissions = nodeBody.permissions; fakeNode.permissions = nodeBody.permissions;
@ -185,7 +185,7 @@ describe('NodePermissionService', () => {
}]; }];
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority, ['Contributor']) service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority, ['Contributor'])
.subscribe((node: Node) => { .subscribe(() => {
}, (errorMessage) => { }, (errorMessage) => {
expect(errorMessage).not.toBeNull(); expect(errorMessage).not.toBeNull();

View File

@ -514,7 +514,7 @@ describe('SearchControlComponent', () => {
it('should set deactivate the search after element is clicked', (done) => { it('should set deactivate the search after element is clicked', (done) => {
spyOn(component, 'isSearchBarActive').and.returnValue(true); spyOn(component, 'isSearchBarActive').and.returnValue(true);
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results)))); searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
const clickDisposable = component.optionClicked.subscribe((item) => { const clickDisposable = component.optionClicked.subscribe(() => {
expect(component.subscriptAnimationState.value).toBe('inactive'); expect(component.subscriptAnimationState.value).toBe('inactive');
clickDisposable.unsubscribe(); clickDisposable.unsubscribe();
done(); done();
@ -533,7 +533,7 @@ describe('SearchControlComponent', () => {
it('should NOT reset the search term after element is clicked', (done) => { it('should NOT reset the search term after element is clicked', (done) => {
spyOn(component, 'isSearchBarActive').and.returnValue(true); spyOn(component, 'isSearchBarActive').and.returnValue(true);
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results)))); searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
const clickDisposable = component.optionClicked.subscribe((item) => { const clickDisposable = component.optionClicked.subscribe(() => {
expect(component.searchTerm).not.toBeFalsy(); expect(component.searchTerm).not.toBeFalsy();
expect(component.searchTerm).toBe('TEST'); expect(component.searchTerm).toBe('TEST');
clickDisposable.unsubscribe(); clickDisposable.unsubscribe();

View File

@ -178,14 +178,14 @@ export class SearchTriggerDirective implements ControlValueAccessor, OnDestroy {
let isPanelOption: boolean = false; let isPanelOption: boolean = false;
if ( event ) { if ( event ) {
const clickTarget = event.target as HTMLElement; const clickTarget = event.target as HTMLElement;
isPanelOption = !this.isNoResultOption(event) && isPanelOption = !this.isNoResultOption() &&
!!this.searchPanel.panel && !!this.searchPanel.panel &&
!!this.searchPanel.panel.nativeElement.contains(clickTarget); !!this.searchPanel.panel.nativeElement.contains(clickTarget);
} }
return isPanelOption; return isPanelOption;
} }
private isNoResultOption(event: MouseEvent) { private isNoResultOption() {
return this.searchPanel.results.list ? this.searchPanel.results.list.entries.length === 0 : true; return this.searchPanel.results.list ? this.searchPanel.results.list.entries.length === 0 : true;
} }

View File

@ -218,7 +218,7 @@ describe('TreeViewComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
fixture = TestBed.createComponent(TreeViewComponent); fixture = TestBed.createComponent(TreeViewComponent);
treeService = TestBed.get(TreeViewService); treeService = TestBed.get(TreeViewService);
spyOn(treeService, 'getTreeNodes').and.callFake((nodeId) => throwError('Invalid Node Id')); spyOn(treeService, 'getTreeNodes').and.callFake(() => throwError('Invalid Node Id'));
fixture.componentInstance.nodeId = 'Poopoovic'; fixture.componentInstance.nodeId = 'Poopoovic';
})); }));

View File

@ -67,7 +67,7 @@ export class TreeViewComponent implements OnChanges {
isExpandable = (node: TreeBaseNode) => node.expandable; isExpandable = (node: TreeBaseNode) => node.expandable;
hasChild = (level: number, nodeData: TreeBaseNode) => nodeData.expandable; hasChild = (_: number, nodeData: TreeBaseNode) => nodeData.expandable;
private loadTreeNode() { private loadTreeNode() {
this.treeViewService.getTreeNodes(this.nodeId) this.treeViewService.getTreeNodes(this.nodeId)

View File

@ -18,7 +18,7 @@
import { Component, Input, ViewEncapsulation, ViewChild, Output, EventEmitter } from '@angular/core'; import { Component, Input, ViewEncapsulation, ViewChild, Output, EventEmitter } from '@angular/core';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { VersionListComponent } from './version-list.component'; import { VersionListComponent } from './version-list.component';
import { AppConfigService, ContentService, AlfrescoApiService } from '@alfresco/adf-core'; import { ContentService, AlfrescoApiService } from '@alfresco/adf-core';
import { trigger, state, style, animate, transition } from '@angular/animations'; import { trigger, state, style, animate, transition } from '@angular/animations';
@Component({ @Component({
@ -68,8 +68,7 @@ export class VersionManagerComponent {
uploadState: string = 'close'; uploadState: string = 'close';
constructor(config: AppConfigService, constructor(private contentService: ContentService,
private contentService: ContentService,
private alfrescoApiService: AlfrescoApiService) { private alfrescoApiService: AlfrescoApiService) {
} }

View File

@ -81,7 +81,7 @@ describe('WebscriptComponent', () => {
it('url should be the one configured by the input param', (done) => { it('url should be the one configured by the input param', (done) => {
component.scriptPath = 'sample/folder/Company%20Home'; component.scriptPath = 'sample/folder/Company%20Home';
component.ngOnChanges(null).then(() => { component.ngOnChanges().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:9876/ecm/alfresco/service/sample/folder/Company%20Home'); expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:9876/ecm/alfresco/service/sample/folder/Company%20Home');
done(); done();
@ -98,7 +98,7 @@ describe('WebscriptComponent', () => {
component.scriptPath = 'sample/folder/Company%20Home'; component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'TEXT'; component.contentType = 'TEXT';
component.ngOnChanges(null).then(() => { component.ngOnChanges().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(element.querySelector('#webscript-data-TEXT').innerHTML) expect(element.querySelector('#webscript-data-TEXT').innerHTML)
.toBe('text test'); .toBe('text test');
@ -116,7 +116,7 @@ describe('WebscriptComponent', () => {
component.scriptPath = 'sample/folder/Company%20Home'; component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'JSON'; component.contentType = 'JSON';
component.ngOnChanges(null).then(() => { component.ngOnChanges().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[0].name).toBe('Name 1'); expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[0].name).toBe('Name 1');
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[1].name).toBe('Name 2'); expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[1].name).toBe('Name 2');
@ -138,7 +138,7 @@ describe('WebscriptComponent', () => {
component.scriptPath = 'sample/folder/Company%20Home'; component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE'; component.contentType = 'DATATABLE';
component.ngOnChanges(null).then(() => { component.ngOnChanges().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined(); expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
done(); done();
@ -176,7 +176,7 @@ describe('WebscriptComponent', () => {
component.scriptPath = 'sample/folder/Company%20Home'; component.scriptPath = 'sample/folder/Company%20Home';
component.contentType = 'DATATABLE'; component.contentType = 'DATATABLE';
component.ngOnChanges(null).then(() => { component.ngOnChanges().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined(); expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
done(); done();

View File

@ -85,7 +85,7 @@ export class WebscriptComponent implements OnChanges {
private logService: LogService) { private logService: LogService) {
} }
ngOnChanges(changes) { ngOnChanges() {
if (this.showData) { if (this.showData) {
this.clean(); this.clean();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -161,7 +161,7 @@ describe('NodeService', () => {
testdata: 'testdata' 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(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toBeDefined(); expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toBeDefined();
done(); 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) => { it('should retrieve the value for the right field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.rightValue = 'test_value_2'; visibilityObjTest.rightValue = 'test_value_2';
const rightValue = service.getRightValue(formTest, visibilityObjTest); 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) => { it('should retrieve the value for the left field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftValue = 'TEST_VAR_2'; visibilityObjTest.leftValue = 'TEST_VAR_2';
visibilityObjTest.leftType = WidgetTypeEnum.field; visibilityObjTest.leftType = WidgetTypeEnum.field;
const leftValue = service.getLeftValue(formTest, visibilityObjTest); 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) => { it('should evaluate the visibility for the field between form value and process var', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftType = 'LEFT_FORM_FIELD_ID'; visibilityObjTest.leftType = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!='; visibilityObjTest.operator = '!=';
visibilityObjTest.rightValue = 'TEST_VAR_2'; visibilityObjTest.rightValue = 'TEST_VAR_2';
@ -324,7 +324,7 @@ describe('WidgetVisibilityCloudService', () => {
it('should evaluate visibility with multiple conditions', (done) => { it('should evaluate visibility with multiple conditions', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftType = 'field'; visibilityObjTest.leftType = 'field';
visibilityObjTest.leftValue = 'TEST_VAR_2'; visibilityObjTest.leftValue = 'TEST_VAR_2';
visibilityObjTest.operator = '!='; 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) => { it('should retrieve the value for the right field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2'; visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
const rightValue = service.getRightValue(formTest, visibilityObjTest); 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) => { it('should retrieve the value for the left field when it is a process variable', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftRestResponseId = 'TEST_VAR_2'; visibilityObjTest.leftRestResponseId = 'TEST_VAR_2';
const leftValue = service.getLeftValue(formTest, visibilityObjTest); 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) => { it('should evaluate the visibility for the field between form value and process var', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID'; visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!='; visibilityObjTest.operator = '!=';
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2'; visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
@ -307,7 +307,7 @@ describe('WidgetVisibilityService', () => {
it('should evaluate visibility with multiple conditions', (done) => { it('should evaluate visibility with multiple conditions', (done) => {
service.getTaskProcessVariable('9999').subscribe( service.getTaskProcessVariable('9999').subscribe(
(res: TaskProcessVariableModel[]) => { () => {
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID'; visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!='; visibilityObjTest.operator = '!=';
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2'; visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ export class AuthGuardBpm extends AuthGuardBase {
super(authenticationService, router, appConfigService); 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) { if (this.authenticationService.isBpmLoggedIn() || this.withCredentials) {
return true; return true;
} }

View File

@ -35,7 +35,7 @@ export class AuthGuardEcm extends AuthGuardBase {
super(authenticationService, router, appConfigService); 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) { if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) {
return true; return true;
} }

View File

@ -46,7 +46,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] }; 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(() => { 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(); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] }; router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeFalsy(); expect(authGuard.canActivate(router)).toBeFalsy();
})); }));
it('Should not redirect if canActivate is', async(() => { it('Should not redirect if canActivate is', async(() => {
@ -67,7 +67,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] }; router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeTruthy(); expect(authGuard.canActivate(router)).toBeTruthy();
expect(routerService.navigate).not.toHaveBeenCalled(); expect(routerService.navigate).not.toHaveBeenCalled();
})); }));
@ -77,7 +77,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); 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(() => { 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(); 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(() => { 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(); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'], 'redirectUrl': 'no-role-url' }; 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']); expect(routerService.navigate).toHaveBeenCalledWith(['/no-role-url']);
})); }));
@ -109,7 +109,7 @@ describe('Auth Guard SSO role service', () => {
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
router.data = { 'roles': ['role1', 'role2'] }; router.data = { 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(router, null)).toBeFalsy(); expect(authGuard.canActivate(router)).toBeFalsy();
expect(routerService.navigate).not.toHaveBeenCalled(); expect(routerService.navigate).not.toHaveBeenCalled();
})); }));
@ -121,7 +121,7 @@ describe('Auth Guard SSO role service', () => {
route.params = { appName: 'fakeapp' }; route.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] }; 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', () => { 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.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['fakeapp'], 'roles': ['role1', 'role2'] }; 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', () => { 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.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] }; 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', () => { 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.params = { appName: 'fakeapp' };
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] }; route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
expect(authGuard.canActivate(route, null)).toBeFalsy(); expect(authGuard.canActivate(route)).toBeFalsy();
}); });
describe('ClientRole ', () => { describe('ClientRole ', () => {

View File

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

View File

@ -66,7 +66,7 @@ export class AuthGuard extends AuthGuardBase {
window.removeEventListener('storage', this.ticketChangeBind); 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) { if (this.authenticationService.isLoggedIn() || this.withCredentials) {
return true; return true;
} }

View File

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

View File

@ -179,7 +179,7 @@ describe('Log Service', () => {
appConfigService.config['logLevel'] = 'trace'; appConfigService.config['logLevel'] = 'trace';
providesLogComponent = TestBed.createComponent(ProvidesLogComponent); providesLogComponent = TestBed.createComponent(ProvidesLogComponent);
providesLogComponent.componentInstance.logService.onMessage.subscribe((message) => { providesLogComponent.componentInstance.logService.onMessage.subscribe(() => {
done(); 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) => { 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().method).toBe('POST');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions'); expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
done(); done();
@ -114,8 +114,8 @@ describe('RenditionsService', () => {
}); });
it('Get rendition service should catch the error', (done) => { it('Get rendition service should catch the error', (done) => {
service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => { service.getRenditionsListByNodeId('fake-node-id').subscribe(() => {
}, (res) => { }, () => {
done(); done();
} }
); );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,6 @@
import { import {
Component, Component,
Input, Input,
SimpleChanges,
OnChanges, OnChanges,
SimpleChange, SimpleChange,
ComponentFactoryResolver ComponentFactoryResolver
@ -40,7 +39,7 @@ export class TestComponent implements OnChanges {
@Input() data: any; @Input() data: any;
public onChangesCalled = 0; public onChangesCalled = 0;
ngOnChanges(changes: SimpleChanges) { ngOnChanges() {
this.onChangesCalled++; this.onChangesCalled++;
} }
} }

View File

@ -77,7 +77,7 @@ export class AnalyticsReportListComponent implements OnInit {
/** /**
* Reload the component * Reload the component
*/ */
reload(reportId?) { reload(reportId?: number) {
this.reset(); this.reset();
this.getReportList(this.appId, reportId); this.getReportList(this.appId, reportId);
} }
@ -85,7 +85,7 @@ export class AnalyticsReportListComponent implements OnInit {
/** /**
* Get the report list * Get the report list
*/ */
getReportList(appId: number, reportId?: string) { getReportList(appId: number, reportId?: number) {
this.analyticsService.getReportList(appId).subscribe( this.analyticsService.getReportList(appId).subscribe(
(res: ReportParametersModel[]) => { (res: ReportParametersModel[]) => {
if (res && res.length === 0) { if (res && res.length === 0) {
@ -152,7 +152,7 @@ export class AnalyticsReportListComponent implements OnInit {
this.reportClick.emit(report); this.reportClick.emit(report);
} }
public selectReportByReportId(reportId) { public selectReportByReportId(reportId: number) {
const reportFound = this.reports.find((report) => report.id === reportId); const reportFound = this.reports.find((report) => report.id === reportId);
if (reportFound) { if (reportFound) {
this.currentReport = reportFound; this.currentReport = reportFound;

View File

@ -316,7 +316,7 @@ describe('AnalyticsReportParametersComponent', () => {
}); });
it('Should create an empty valid form when there are no parameters definitions', () => { it('Should create an empty valid form when there are no parameters definitions', () => {
component.success.subscribe((res) => { component.success.subscribe(() => {
expect(component.reportForm).toBeDefined(); expect(component.reportForm).toBeDefined();
expect(component.reportForm.valid).toEqual(true); expect(component.reportForm.valid).toEqual(true);
expect(component.reportForm.controls).toEqual({}); expect(component.reportForm.controls).toEqual({});

View File

@ -199,7 +199,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
}); });
this.reportForm = this.formBuilder.group(formBuilderGroup); this.reportForm = this.formBuilder.group(formBuilderGroup);
this.reportForm.valueChanges.subscribe((data) => this.onValueChanged(data)); this.reportForm.valueChanges.subscribe((data) => this.onValueChanged(data));
this.reportForm.statusChanges.subscribe((data) => this.onStatusChanged(data)); this.reportForm.statusChanges.subscribe(() => this.onStatusChanged());
} }
public getReportParams(reportId: string) { public getReportParams(reportId: string) {
@ -251,7 +251,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
} }
} }
onStatusChanged(status: any) { onStatusChanged() {
if (this.reportForm && !this.reportForm.pending && this.reportForm.dirty) { if (this.reportForm && !this.reportForm.pending && this.reportForm.dirty) {
this.formValidState = this.reportForm.valid; this.formValidState = this.reportForm.valid;
} }

Some files were not shown because too many files have changed in this diff Show More