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

@@ -46,7 +46,7 @@ describe('Breadcrumb', () => {
});
it('should prevent default click behavior', () => {
let event = jasmine.createSpyObj('event', ['preventDefault']);
const event = jasmine.createSpyObj('event', ['preventDefault']);
component.onRoutePathClick(null, event);
expect(event.preventDefault).toHaveBeenCalled();
});
@@ -60,7 +60,7 @@ describe('Breadcrumb', () => {
});
it('should emit navigation event', (done) => {
let node = <PathElementEntity> { id: '-id-', name: 'name' };
const node = <PathElementEntity> { id: '-id-', name: 'name' };
component.navigate.subscribe((val) => {
expect(val).toBe(node);
done();
@@ -72,7 +72,7 @@ describe('Breadcrumb', () => {
it('should update document list on click', (done) => {
spyOn(documentList, 'loadFolderByNodeId').and.stub();
let node = <PathElementEntity> { id: '-id-', name: 'name' };
const node = <PathElementEntity> { id: '-id-', name: 'name' };
component.target = documentList;
component.onRoutePathClick(node, null);

View File

@@ -108,7 +108,7 @@ export class BreadcrumbComponent implements OnInit, OnChanges {
}
protected recalculateNodes(): void {
let node: Node = this.transform ? this.transform(this.folderNode) : this.folderNode;
const node: Node = this.transform ? this.transform(this.folderNode) : this.folderNode;
this.route = this.parseRoute(node);

View File

@@ -63,7 +63,7 @@ describe('DropdownBreadcrumb', () => {
}
it('should display only the current folder name if there is no previous folders', (done) => {
let fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [];
triggerComponentChange(fakeNodeWithCreatePermissionInstance);
@@ -83,7 +83,7 @@ describe('DropdownBreadcrumb', () => {
});
it('should display only the path in the selectBox', (done) => {
let fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [
{ id: '1', name: 'Stark Industries' },
{ id: '2', name: 'User Homes' },
@@ -105,7 +105,7 @@ describe('DropdownBreadcrumb', () => {
});
xit('should display the path in reverse order', (done) => {
let fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [
{ id: '1', name: 'Stark Industries' },
{ id: '2', name: 'User Homes' },
@@ -130,7 +130,7 @@ describe('DropdownBreadcrumb', () => {
});
it('should emit navigation event when clicking on an option', (done) => {
let fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [{ id: '1', name: 'Stark Industries' }];
triggerComponentChange(fakeNodeWithCreatePermissionInstance);
@@ -153,7 +153,7 @@ describe('DropdownBreadcrumb', () => {
it('should update document list when clicking on an option', (done) => {
spyOn(documentList, 'loadFolderByNodeId').and.stub();
component.target = documentList;
let fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
fakeNodeWithCreatePermissionInstance.path.elements = [{ id: '1', name: 'Stark Industries' }];
triggerComponentChange(fakeNodeWithCreatePermissionInstance);

View File

@@ -41,7 +41,7 @@ export class DropdownBreadcrumbComponent extends BreadcrumbComponent implements
* Calculate the current and previous nodes from the route array
*/
protected recalculateNodes(): void {
let node: Node = this.transform ? this.transform(this.folderNode) : this.folderNode;
const node: Node = this.transform ? this.transform(this.folderNode) : this.folderNode;
this.route = this.parseRoute(node);
this.currentNode = this.route[this.route.length - 1];