[ADF-5183] Upgrade to Angular 10 (#1506)

* upgrade preparation fixes

* remove fdescribe

* update browserlist config

* ng8

* ngrx 8

* ng9

* ngrx 9

* remove entryComponents

* unit tests

* ng 10

* latest ADF

* fix unit tests

* fix lint

* update deps and travis

* code fixes

* upgrade webdriver

* cleanup libs

* fix test

* update test

* Use browserTarget as target for lite-serve

* Use the update webdriver with CI condition

* Use version console.log('load', path

* Fix path sh

* Try to use remote env

* Add the . to export variabled

* Use hardcoded chrome version

* Remove the run remote

* Avoid to use the escape

* Skip flaky e2e and raise issue ACA-3615

* SKip failing e2e

* Skip flaky e2e and raise issue ACA-3615

* Fix close app toolbar menu and preconditions + tests of  mark-favorite.test.ts  Personal Files section

* Fix mark-favorite tests

* Fix ext-header test

* Fix new-menu tests

* Fix lint

* no message

* Fix viewer tests

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Cristina Jalba <cristina.jalba@ness.com>
This commit is contained in:
Denys Vuika
2020-07-09 09:37:06 +01:00
committed by GitHub
parent 4ac1b8d7dd
commit 2854c17cd9
139 changed files with 11641 additions and 7776 deletions

View File

@@ -375,9 +375,9 @@ export function isWriteLocked(context: RuleContext): boolean {
export function isUserWriteLockOwner(context: RuleContext): boolean {
return (
isWriteLocked(context) &&
(context.selection.file.entry.properties['cm:lockOwner'] &&
context.selection.file.entry.properties['cm:lockOwner'].id ===
context.profile.id)
context.selection.file.entry.properties['cm:lockOwner'] &&
context.selection.file.entry.properties['cm:lockOwner'].id ===
context.profile.id
);
}

View File

@@ -74,8 +74,8 @@ describe('InfoDrawerComponent', () => {
fixture = TestBed.createComponent(InfoDrawerComponent);
component = fixture.componentInstance;
appExtensionService = TestBed.get(AppExtensionService);
contentApiService = TestBed.get(ContentApiService);
appExtensionService = TestBed.inject(AppExtensionService);
contentApiService = TestBed.inject(ContentApiService);
tab = { title: 'tab1' };
spyOn(appExtensionService, 'getSidebarTabs').and.returnValue([tab]);

View File

@@ -28,7 +28,7 @@ import { CommonModule } from '@angular/common';
import { InfoDrawerComponent } from './info-drawer.component';
import { InfoDrawerModule, ToolbarModule } from '@alfresco/adf-core';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { MatProgressBarModule } from '@angular/material';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { SharedToolbarModule } from '../tool-bar/shared-toolbar.module';
@NgModule({

View File

@@ -38,12 +38,13 @@ describe('ContextActionsDirective', () => {
directive = new ContextActionsDirective(storeMock);
});
it('should not render context menu when `enabled` property is false', () => {
it('should not render context menu when `enabled` property is false', fakeAsync(() => {
spyOn(directive, 'execute').and.stub();
directive.enabled = false;
directive.onContextMenuEvent(new MouseEvent('contextmenu'));
expect(storeMock.dispatch).not.toHaveBeenCalled();
});
expect(directive.execute).not.toHaveBeenCalled();
}));
it('should call service to render context menu', fakeAsync(() => {
const el = document.createElement('div');

View File

@@ -65,10 +65,7 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
ngOnInit() {
this.execute$
.pipe(
debounceTime(300),
takeUntil(this.onDestroy$)
)
.pipe(debounceTime(300), takeUntil(this.onDestroy$))
.subscribe((event: MouseEvent) => {
this.store.dispatch(new ContextMenu(event));
});

View File

@@ -58,8 +58,8 @@ describe('PaginationDirective', () => {
]
});
preferences = TestBed.get(UserPreferencesService);
config = TestBed.get(AppConfigService);
preferences = TestBed.inject(UserPreferencesService);
config = TestBed.inject(AppConfigService);
fixture = TestBed.createComponent(PaginationComponent);
pagination = fixture.componentInstance;
directive = new PaginationDirective(pagination, preferences, config);

View File

@@ -34,7 +34,7 @@ describe('AppRouteReuseStrategy', () => {
providers: [AppRouteReuseStrategy]
});
appRouteReuse = TestBed.get(AppRouteReuseStrategy);
appRouteReuse = TestBed.inject(AppRouteReuseStrategy);
});
it('should allow detach if route is configured to be reused', () => {

View File

@@ -28,7 +28,7 @@ import {
DetachedRouteHandle,
ActivatedRouteSnapshot
} from '@angular/router';
import { ComponentRef } from '@angular/core';
import { ComponentRef, Injectable } from '@angular/core';
interface RouteData {
reuse: boolean;
@@ -39,6 +39,7 @@ interface RouteInfo {
data: RouteData;
}
@Injectable()
export class AppRouteReuseStrategy implements RouteReuseStrategy {
private routeCache = new Map<string, RouteInfo>();

View File

@@ -54,11 +54,11 @@ describe('AppExtensionService', () => {
imports: [LibTestingModule]
});
appConfigService = TestBed.get(AppConfigService);
store = TestBed.get(Store);
service = TestBed.get(AppExtensionService);
extensions = TestBed.get(ExtensionService);
components = TestBed.get(ComponentRegisterService);
appConfigService = TestBed.inject(AppConfigService);
store = TestBed.inject(Store);
service = TestBed.inject(AppExtensionService);
extensions = TestBed.inject(ExtensionService);
components = TestBed.inject(ComponentRegisterService);
});
const applyConfig = (config: ExtensionConfig) => {

View File

@@ -54,10 +54,10 @@ describe('AppService', () => {
]
});
routeReuse = TestBed.get(AppRouteReuseStrategy);
auth = TestBed.get(AuthenticationService);
appConfig = TestBed.get(AppConfigService);
searchQueryBuilderService = TestBed.get(SearchQueryBuilderService);
routeReuse = TestBed.inject(AppRouteReuseStrategy);
auth = TestBed.inject(AuthenticationService);
appConfig = TestBed.inject(AppConfigService);
searchQueryBuilderService = TestBed.inject(SearchQueryBuilderService);
spyOn(routeReuse, 'resetCache').and.stub();

View File

@@ -34,7 +34,7 @@ import { ContextActionsModule } from './directives/contextmenu/contextmenu.modul
exports: [ContextActionsModule]
})
export class SharedModule {
static forRoot(): ModuleWithProviders {
static forRoot(): ModuleWithProviders<SharedModule> {
return {
ngModule: SharedModule,
providers: [ContentApiService, NodePermissionService, AppService]

View File

@@ -33,15 +33,8 @@ export const getHeaderColor = createSelector(
state => state.headerColor
);
export const getAppName = createSelector(
selectApp,
state => state.appName
);
export const getLogoPath = createSelector(
selectApp,
state => state.logoPath
);
export const getAppName = createSelector(selectApp, state => state.appName);
export const getLogoPath = createSelector(selectApp, state => state.logoPath);
export const getHeaderImagePath = createSelector(
selectApp,
@@ -53,10 +46,7 @@ export const getLanguagePickerState = createSelector(
state => state.languagePicker
);
export const getUserProfile = createSelector(
selectApp,
state => state.user
);
export const getUserProfile = createSelector(selectApp, state => state.user);
export const getCurrentFolder = createSelector(
selectApp,
@@ -68,10 +58,7 @@ export const getAppSelection = createSelector(
state => state.selection
);
export const getSharedUrl = createSelector(
selectApp,
state => state.sharedUrl
);
export const getSharedUrl = createSelector(selectApp, state => state.sharedUrl);
export const getNavigationState = createSelector(
selectApp,
@@ -103,10 +90,7 @@ export const isQuickShareEnabled = createSelector(
info => info.status.isQuickShareEnabled
);
export const isAdmin = createSelector(
selectApp,
state => state.user.isAdmin
);
export const isAdmin = createSelector(selectApp, state => state.user.isAdmin);
export const getSideNavState = createSelector(
getAppSelection,

View File

@@ -25,7 +25,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';

View File

@@ -18,7 +18,6 @@
}
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,

View File

@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}