enable prefer-const rule for tslint, fix issues (#4409)

* enable prefer-const rule for tslint, fix issues

* Update content-node-selector.component.spec.ts

* Update content-node-selector.component.spec.ts

* fix const

* fix lint issues

* update tests

* update tests

* update tests

* fix code

* fix page class
This commit is contained in:
Denys Vuika
2019-03-25 12:19:33 +00:00
committed by Eugenio Romano
parent 26c5982a1a
commit a7a48e8b2b
581 changed files with 5435 additions and 5402 deletions

View File

@@ -32,7 +32,7 @@ describe('AddPermissionDialog', () => {
let fixture: ComponentFixture<AddPermissionDialogComponent>;
let element: HTMLElement;
let data: AddPermissionDialogData = {
const data: AddPermissionDialogData = {
title: 'dead or alive you are coming with me',
nodeId: 'fake-node-id',
confirm: new Subject<NodeEntry[]> ()

View File

@@ -50,7 +50,7 @@ describe('AddPermissionPanelComponent', () => {
});
function typeWordIntoSearchInput(word: string): void {
let inputDebugElement = debugElement.query(By.css('#searchInput'));
const inputDebugElement = debugElement.query(By.css('#searchInput'));
inputDebugElement.nativeElement.value = word;
inputDebugElement.nativeElement.focus();
inputDebugElement.nativeElement.dispatchEvent(new Event('input'));

View File

@@ -104,7 +104,7 @@ describe('AddPermissionComponent', () => {
fixture.componentInstance.currentNode = new Node({ id: 'fake-node-id' });
spyOn(nodePermissionService, 'updateNodePermissions').and.returnValue(of({ id: 'fake-node-id' }));
let spySuccess = spyOn(fixture.componentInstance, 'success');
const spySuccess = spyOn(fixture.componentInstance, 'success');
fixture.componentInstance.applySelection();
expect(spySuccess).not.toHaveBeenCalled();
});

View File

@@ -98,7 +98,7 @@ describe('InheritPermissionDirective', () => {
it('should not update the node when node has no permission', async(() => {
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeWithInheritNoPermission));
let spyUpdateNode = spyOn(nodeService, 'updateNode');
const spyUpdateNode = spyOn(nodeService, 'updateNode');
component.updatedNode = true;
fixture.detectChanges();
const buttonPermission: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#sample-button-permission');

View File

@@ -120,7 +120,7 @@ describe('PermissionDisplayComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let options: any = fixture.debugElement.queryAll(By.css('mat-option'));
const options: any = fixture.debugElement.queryAll(By.css('mat-option'));
expect(options).not.toBeNull();
expect(options.length).toBe(4);
expect(options[0].nativeElement.innerText).toContain('SiteCollaborator');
@@ -145,7 +145,7 @@ describe('PermissionDisplayComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let options: any = fixture.debugElement.queryAll(By.css('mat-option'));
const options: any = fixture.debugElement.queryAll(By.css('mat-option'));
expect(options).not.toBeNull();
expect(options.length).toBe(5);
expect(options[0].nativeElement.innerText).toContain('Contributor');
@@ -178,7 +178,7 @@ describe('PermissionDisplayComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let options: any = fixture.debugElement.queryAll(By.css('mat-option'));
const options: any = fixture.debugElement.queryAll(By.css('mat-option'));
expect(options).not.toBeNull();
expect(options.length).toBe(5);
options[3].triggerEventHandler('click', {});

View File

@@ -69,16 +69,16 @@ export class PermissionListComponent implements OnInit {
}
private getPermissionList(node: Node): PermissionDisplayModel[] {
let allPermissions: PermissionDisplayModel[] = [];
const allPermissions: PermissionDisplayModel[] = [];
if (node.permissions.locallySet) {
node.permissions.locallySet.map((permissionElement: PermissionElement) => {
let permission = new PermissionDisplayModel(permissionElement);
const permission = new PermissionDisplayModel(permissionElement);
allPermissions.push(permission);
});
}
if (node.permissions.inherited) {
node.permissions.inherited.map((permissionElement: PermissionElement) => {
let permissionInherited = new PermissionDisplayModel(permissionElement);
const permissionInherited = new PermissionDisplayModel(permissionElement);
permissionInherited.isInherited = true;
allPermissions.push(permissionInherited);
});
@@ -87,7 +87,7 @@ export class PermissionListComponent implements OnInit {
}
saveNewRole(event: any, permissionRow: PermissionDisplayModel) {
let updatedPermissionRole: PermissionElement = this.buildUpdatedPermission(event.value, permissionRow);
const updatedPermissionRole: PermissionElement = this.buildUpdatedPermission(event.value, permissionRow);
this.nodePermissionService.updatePermissionRole(this.actualNode, updatedPermissionRole)
.subscribe((node: Node) => {
this.update.emit(updatedPermissionRole);
@@ -95,7 +95,7 @@ export class PermissionListComponent implements OnInit {
}
private buildUpdatedPermission(newRole: string, permissionRow: PermissionDisplayModel): PermissionElement {
let permissionRole: PermissionElement = {};
const permissionRole: PermissionElement = {};
permissionRole.accessStatus = permissionRow.accessStatus;
permissionRole.name = newRole;
permissionRole.authorityId = permissionRow.authorityId;