[ADF-5146] Upgrade to Angular 10 (#5834)

* remove useless module

* upgrade to angular 8

* upgrade material to v8

* upgrade adf libs

* migrate demo shell to v8

* upgrade to angular 9

* upgrade material to v9

* remove hammer

* upgrade nx

* upgrade datetime picker

* upgrade flex layout

* update core api

* remove entry components

* code fixes

* upgrade testbed usage

* code fixes

* remove unnecessary core-js from tests

* upgrade CLI

* ts config fixes

* fix builds

* fix testing config

* compile fixes

* fix demo shell dev setup

* fix core tests

* fix card view import

* upgrade nx

* disable smart builds for now

* remove fdescribe

* restore smart builds

* fix issues

* unify tsconfigs and fix newly found issues

* fix configuration and cleanup package scripts

* improved production build from the same config

* use ADF libs directly instead of node_modules

* disable smart build

* single app configuration (angular)

* fix core build

* fix build scripts

* lint fixes

* fix linting setup

* fix linting rules

* various fixes

* disable affected libs for unit tests

* cleanup insights package.json

* simplify smart-build

* fix content tests

* fix tests

* test fixes

* fix tests

* fix test

* fix tests

* disable AppExtensionsModule (monaco example)

* remove monaco extension module

* upgrade bundle check rules

* fix insights tests and karma config

* fix protractor config

* e2e workaround

* upgrade puppeteer and split linting and build

* reusable resources config

* update protractor config

* fix after rebase

* fix protractor config

* fix e2e tsconfig

* update e2e setup

* Save demoshell artifact on S3 and remove travis cache

* Push the libs on S3 and fetch before releasing it

* Add deps

* Add dependencies among libs and run only affected unit test and build

* fix the travis stage name

* fix after renaming dev to demoshell

* force the order of the projects

* remove unused dependencies

* fix content e2e script

* exit codes fix

* add extra exit codes to core e2e

* postinstall hook and package cleanup

* cleanup packages

* remove deprecated code and dependency on router

* improve bundle analyzer script

* minor code fixes

* update spec

* fix code after rebase

* upgrade protractor after rebase

* fix e2e mapping lib

* Update tsconfig.e2e.json

* update e2e tsconfig

* fix angular config

* fix protractor runs

* cache dist folder for libs

* update material selectors for dropdowns

* selector fixes

* remove duplicated e2e that have unit tests already

* fix login selector

* fix e2e

* fix test

* fix import issues

* fix selector

* cleanup old monaco extension files

* cleanup demo shell login

* add protractor max retries

* disable customisations of protractor

* fix login validation

* fix after rebase

* fix after rebase, disable latest versions of libs

* Hide the report tab and rollback the localstorage

* rename protractor config back to js

* restore lint as part of build

* cleanup code

* do not copy anything to node_modules on dist test

* fix unit tests

* config fixes

* fix code

* fix code after rebase

* fix tests

* remove existing words from spellcheck

* remove useless directive decorators

* update package.json after rebase

* add js-api back

* code fixes

* add missing export

* update configs

* fix code

* try fix the sso login test

* fix

* remove puppeteer unit

* fix e2e script

* fix

* make provider easy

* fix routes module before upgrade

* fix unit tests

* upgrade angular cli

* upgrade to angular 10

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
Denys Vuika
2020-07-03 13:01:05 +01:00
committed by GitHub
co-authored by maurizio vitale Eugenio Romano Eugenio Romano
parent 2f0a585273
commit cd2b489100
579 changed files with 15689 additions and 10745 deletions
-4
View File
@@ -1,7 +1,5 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) {
config.set({
basePath: '../../',
@@ -9,8 +7,6 @@ module.exports = function (config) {
files: [
{pattern: 'node_modules/core-js/client/core.js', included: true, watched: false},
{pattern: 'node_modules/tslib/tslib.js', included: true, watched: false},
{pattern: 'node_modules/hammerjs/hammer.min.js', included: true, watched: false},
{pattern: 'node_modules/hammerjs/hammer.min.js.map', included: false, watched: false},
// pdf-js
{pattern: 'node_modules/pdfjs-dist/build/pdf.js', included: true, watched: false},
-2
View File
@@ -6,14 +6,12 @@
"flatModuleFile": "adf-content-services",
"umdModuleIds": {
"@alfresco/js-api": "@alfresco/js-api",
"minimatch": "minimatch",
"@angular/platform-browser/animations": "@angular/platform-browser/animations",
"@angular/material": "@angular/material",
"@mat-datetimepicker/core": "@mat-datetimepicker/core",
"@mat-datetimepicker/moment": "@mat-datetimepicker/moment",
"@angular/flex-layout": "@angular/flex-layout",
"@alfresco/adf-core": "@alfresco/adf-core",
"@angular/material-moment-adapter": "@angular/material-moment-adapter",
"@angular/animations": "@angular/animations",
"@angular/cdk/platform": "@angular/cdk/platform",
"@angular/material/core": "@angular/material/core",
+12 -20
View File
@@ -12,26 +12,18 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"peerDependencies": {
"@angular/animations": ">=7.0.3",
"@angular/cdk": ">=7.0.3",
"@angular/common": ">=7.0.3",
"@angular/compiler": ">=7.0.3",
"@angular/core": ">=7.0.3",
"@angular/flex-layout": ">=7.0.0-beta.19",
"@angular/forms": ">=7.0.3",
"@angular/material": ">=7.0.3",
"@angular/material-moment-adapter": ">=7.0.3",
"@angular/platform-browser": ">=7.0.3",
"@angular/platform-browser-dynamic": ">=7.0.3",
"@angular/router": ">=7.0.3",
"@alfresco/js-api": "3.9.0",
"rxjs": ">=6.2.2",
"@alfresco/adf-core": "3.9.0",
"@ngx-translate/core": ">=11.0.0",
"hammerjs": ">=2.0.8",
"moment": ">=2.22.2",
"reflect-metadata": ">=0.1.10",
"zone.js": ">=0.8.26"
"@angular/animations": ">=9.1.9",
"@angular/cdk": ">=9.2.4",
"@angular/common": ">=9.1.9",
"@angular/core": ">=9.1.9",
"@angular/flex-layout": ">=9.0.0-beta.31",
"@angular/forms": ">=9.1.9",
"@angular/material": ">=9.2.4",
"@angular/router": ">=9.1.9",
"@alfresco/js-api": ">=3.8.0",
"@alfresco/adf-core": ">=3.8.0",
"@ngx-translate/core": ">=12.1.2",
"moment": ">=2.22.2"
},
"keywords": [
"content-services",
@@ -49,7 +49,7 @@ describe('Breadcrumb', () => {
fixture = TestBed.createComponent(BreadcrumbComponent);
component = fixture.componentInstance;
documentListComponent = TestBed.createComponent<DocumentListComponent>(DocumentListComponent).componentInstance;
documentListService = TestBed.get(DocumentListService);
documentListService = TestBed.inject(DocumentListService);
});
afterEach(() => {
@@ -26,7 +26,7 @@ import {
ViewEncapsulation,
OnDestroy
} from '@angular/core';
import { MatSelect } from '@angular/material';
import { MatSelect } from '@angular/material/select';
import { Node, PathElementEntity } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list';
import { Subject } from 'rxjs';
@@ -46,7 +46,7 @@ describe('DropdownBreadcrumb', () => {
fixture = TestBed.createComponent(DropdownBreadcrumbComponent);
component = fixture.componentInstance;
documentList = TestBed.createComponent<DocumentListComponent>(DocumentListComponent).componentInstance;
documentListService = TestBed.get(DocumentListService);
documentListService = TestBed.inject(DocumentListService);
}));
afterEach(async(() => {
@@ -16,7 +16,7 @@
*/
import { Component, OnChanges, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatSelect } from '@angular/material';
import { MatSelect } from '@angular/material/select';
import { PathElementEntity, Node } from '@alfresco/js-api';
import { BreadcrumbComponent } from './breadcrumb.component';
@@ -51,9 +51,9 @@ describe('ContentMetadataComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(ContentMetadataComponent);
component = fixture.componentInstance;
contentMetadataService = TestBed.get(ContentMetadataService);
updateService = TestBed.get(CardViewUpdateService);
nodesApiService = TestBed.get(NodesApiService);
contentMetadataService = TestBed.inject(ContentMetadataService);
updateService = TestBed.inject(CardViewUpdateService);
nodesApiService = TestBed.inject(NodesApiService);
node = <Node> {
id: 'node-id',
@@ -145,7 +145,7 @@ describe('ContentMetadataComponent', () => {
}));
it('should throw error on unsuccessful save', fakeAsync(async (done) => {
const logService: LogService = TestBed.get(LogService);
const logService: LogService = TestBed.inject(LogService);
component.editable = true;
const property = <CardViewBaseItemModel> { key: 'properties.property-key', value: 'original-value' };
updateService.update(property, 'updated-value');
@@ -44,8 +44,8 @@ describe('ContentMetadataConfigFactory', () => {
});
beforeEach(async(() => {
factory = TestBed.get(ContentMetadataConfigFactory);
appConfig = TestBed.get(AppConfigService);
factory = TestBed.inject(ContentMetadataConfigFactory);
appConfig = TestBed.inject(AppConfigService);
}));
describe('get', () => {
@@ -53,7 +53,7 @@ describe('ContentMetadataConfigFactory', () => {
let logService: LogService;
beforeEach(async(() => {
logService = TestBed.get(LogService);
logService = TestBed.inject(LogService);
spyOn(logService, 'error').and.stub();
}));
@@ -63,10 +63,10 @@ describe('ContentMetaDataService', () => {
}
beforeEach(() => {
service = TestBed.get(ContentMetadataService);
const alfrescoApiService = TestBed.get(AlfrescoApiService);
service = TestBed.inject(ContentMetadataService);
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
classesApi = alfrescoApiService.classesApi;
appConfig = TestBed.get(AppConfigService);
appConfig = TestBed.inject(AppConfigService);
});
it('should return all the properties of the node', () => {
@@ -37,8 +37,8 @@ describe('PropertyDescriptorLoaderService', () => {
});
beforeEach(() => {
service = TestBed.get(PropertyDescriptorsService);
const alfrescoApiService = TestBed.get(AlfrescoApiService);
service = TestBed.inject(PropertyDescriptorsService);
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
classesApi = alfrescoApiService.classesApi;
});
@@ -48,8 +48,8 @@ describe('PropertyGroupTranslatorService', () => {
});
beforeEach(() => {
logService = TestBed.get(LogService);
service = TestBed.get(PropertyGroupTranslatorService);
logService = TestBed.inject(LogService);
service = TestBed.inject(PropertyGroupTranslatorService);
property = {
name: 'FAS:PLAGUE',
@@ -20,7 +20,7 @@ import { NodeEntry, Node, SitePaging, Site } from '@alfresco/js-api';
import { AppConfigService, SitesService, setupTestBed } from '@alfresco/adf-core';
import { DocumentListService } from '../document-list/services/document-list.service';
import { ContentNodeDialogService } from './content-node-dialog.service';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { Subject, of } from 'rxjs';
import { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
@@ -75,13 +75,13 @@ describe('ContentNodeDialogService', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
service = TestBed.get(ContentNodeDialogService);
documentListService = TestBed.get(DocumentListService);
materialDialog = TestBed.get(MatDialog);
sitesService = TestBed.get(SitesService);
service = TestBed.inject(ContentNodeDialogService);
documentListService = TestBed.inject(DocumentListService);
materialDialog = TestBed.inject(MatDialog);
sitesService = TestBed.inject(SitesService);
afterOpenObservable = new Subject<any>();
spyOnDialogOpen = spyOn(materialDialog, 'open').and.returnValue({
afterOpen: () => afterOpenObservable,
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { EventEmitter, Injectable, Output } from '@angular/core';
import { ContentService, ThumbnailService, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { Subject, Observable, throwError } from 'rxjs';
@@ -30,6 +30,7 @@ import { switchMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
export class ContentNodeDialogService {
static nonDocumentSiteContent = [
'blog',
@@ -88,10 +88,10 @@ describe('ContentNodeSelectorComponent', () => {
component = fixture.componentInstance;
component.debounceSearch = 0;
searchService = TestBed.get(SearchService);
nodeService = TestBed.get(NodesApiService);
contentNodeSelectorService = TestBed.get(ContentNodeSelectorService);
sitesService = TestBed.get(SitesService);
searchService = TestBed.inject(SearchService);
nodeService = TestBed.inject(NodesApiService);
contentNodeSelectorService = TestBed.inject(ContentNodeSelectorService);
sitesService = TestBed.inject(SitesService);
spyOn(nodeService, 'getNode').and.returnValue(of({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } }));
cnSearchSpy = spyOn(contentNodeSelectorService, 'search').and.callThrough();
@@ -113,7 +113,7 @@ describe('ContentNodeSelectorComponent', () => {
let documentListService: DocumentListService;
beforeEach(() => {
documentListService = TestBed.get(DocumentListService);
documentListService = TestBed.inject(DocumentListService);
spyOn(documentListService, 'getFolderNode').and.returnValue(of(<NodeEntry> { entry: { path: { elements: [] } } }));
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
@@ -218,7 +218,7 @@ describe('ContentNodeSelectorComponent', () => {
let documentListService: DocumentListService;
beforeEach(() => {
documentListService = TestBed.get(DocumentListService);
documentListService = TestBed.inject(DocumentListService);
spyOn(documentListService, 'getFolderNode').and.returnValue(of(<NodeEntry> { entry: { path: { elements: [] } } }));
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
@@ -423,7 +423,7 @@ describe('ContentNodeSelectorComponent', () => {
};
beforeEach(() => {
const documentListService = TestBed.get(DocumentListService);
const documentListService = TestBed.inject(DocumentListService);
const expectedDefaultFolderNode = <NodeEntry> { entry: { path: { elements: [] } } };
spyOn(documentListService, 'getFolderNode').and.returnValue(of(expectedDefaultFolderNode));
@@ -437,7 +437,7 @@ describe('ContentNodeSelectorComponent', () => {
spyOn(sitesService, 'getSites').and.returnValue(of({ list: { entries: [] } }));
const customResourcesService = TestBed.get(CustomResourcesService);
const customResourcesService = TestBed.inject(CustomResourcesService);
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and
.callFake((id) => {
if (id === '-sites-') {
@@ -38,7 +38,7 @@ import { Subject } from 'rxjs';
export type ValidationFunction = (entry: Node) => boolean;
const defaultValidation = () => true;
export const defaultValidation = () => true;
@Component({
selector: 'adf-content-node-selector-panel',
@@ -182,10 +182,10 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
@Output()
siteChange: EventEmitter<string> = new EventEmitter<string>();
@ViewChild('documentList')
@ViewChild('documentList', { static: true })
documentList: DocumentListComponent;
@ViewChild(HighlightDirective)
@ViewChild(HighlightDirective, { static: true })
highlighter: HighlightDirective;
nodePaging: NodePaging | null = null;
@@ -201,7 +201,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
pagination: PaginationModel = this.DEFAULT_PAGINATION;
@ViewChild(InfinitePaginationComponent)
@ViewChild(InfinitePaginationComponent, { static: true })
infinitePaginationComponent: InfinitePaginationComponent;
infiniteScroll: boolean = false;
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MAT_DIALOG_DATA } from '@angular/material';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { CUSTOM_ELEMENTS_SCHEMA, EventEmitter } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentNodeSelectorComponent } from './content-node-selector.component';
@@ -55,8 +55,8 @@ describe('ContentNodeSelectorDialogComponent', () => {
});
beforeEach(() => {
const documentListService: DocumentListService = TestBed.get(DocumentListService);
const sitesService: SitesService = TestBed.get(SitesService);
const documentListService: DocumentListService = TestBed.inject(DocumentListService);
const sitesService: SitesService = TestBed.inject(SitesService);
spyOn(documentListService, 'getFolder').and.returnValue(of({ list: [] }));
spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: {} }));
spyOn(sitesService, 'getSites').and.returnValue(of({ list: { entries: [] } }));
@@ -16,7 +16,7 @@
*/
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { TranslationService } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
@@ -44,10 +44,6 @@ import { NameLocationCellComponent } from './name-location-cell/name-location-ce
NameLocationCellComponent,
ContentNodeSelectorComponent
],
entryComponents: [
ContentNodeSelectorPanelComponent,
ContentNodeSelectorComponent
],
declarations: [
ContentNodeSelectorPanelComponent,
NameLocationCellComponent,
@@ -16,17 +16,19 @@
*/
import { TestBed } from '@angular/core/testing';
import { QueryBody } from '@alfresco/js-api';
import { QueryBody, ResultSetPaging } from '@alfresco/js-api';
import { SearchService, setupTestBed } from '@alfresco/adf-core';
import { ContentNodeSelectorService } from './content-node-selector.service';
import { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { Observable, of } from 'rxjs';
class SearchServiceMock {
class SearchServiceMock extends SearchService {
public query: QueryBody;
searchByQueryBody(query: QueryBody) {
this.query = query;
searchByQueryBody(queryBody: QueryBody): Observable<ResultSetPaging> {
this.query = queryBody;
return of({});
}
}
@@ -46,8 +48,8 @@ describe('ContentNodeSelectorService', () => {
});
beforeEach(() => {
service = TestBed.get(ContentNodeSelectorService);
search = TestBed.get(SearchService);
service = TestBed.inject(ContentNodeSelectorService);
search = TestBed.inject(SearchService) as SearchServiceMock;
});
it('should have the proper main query for search string', () => {
@@ -16,7 +16,7 @@
*/
import { TestBed, fakeAsync, ComponentFixture, tick } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import { of, empty } from 'rxjs';
import {
setupTestBed,
@@ -61,11 +61,11 @@ describe('ShareDialogComponent', () => {
component = fixture.componentInstance;
component.maxDebounceTime = 0;
matDialog = TestBed.get(MatDialog);
sharedLinksApiService = TestBed.get(SharedLinksApiService);
renditionService = TestBed.get(RenditionsService);
nodesApiService = TestBed.get(NodesApiService);
appConfigService = TestBed.get(AppConfigService);
matDialog = TestBed.inject(MatDialog);
sharedLinksApiService = TestBed.inject(SharedLinksApiService);
renditionService = TestBed.inject(RenditionsService);
nodesApiService = TestBed.inject(NodesApiService);
appConfigService = TestBed.inject(AppConfigService);
node = {
entry: {
@@ -158,7 +158,7 @@ describe('ShareDialogComponent', () => {
});
it('should open a confirmation dialog when unshare button is triggered', () => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
@@ -179,7 +179,7 @@ describe('ShareDialogComponent', () => {
});
it('should unshare file when confirmation dialog returns true', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) });
spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(true) });
spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of({}));
node.entry.properties['qshare:sharedId'] = 'sharedId';
@@ -199,7 +199,7 @@ describe('ShareDialogComponent', () => {
}));
it('should not unshare file when confirmation dialog returns false', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
@@ -23,7 +23,8 @@ import {
ViewChild,
OnDestroy
} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog, MatSlideToggleChange } from '@angular/material';
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog } from '@angular/material/dialog';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { FormGroup, FormControl, AbstractControl } from '@angular/forms';
import { Observable, Subject } from 'rxjs';
import {
@@ -63,10 +64,10 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
type: DatePickerType = 'datetime';
maxDebounceTime = 500;
@ViewChild('slideToggleExpirationDate')
@ViewChild('slideToggleExpirationDate', { static: true })
slideToggleExpirationDate;
@ViewChild('dateTimePickerInput')
@ViewChild('dateTimePickerInput', { static: true })
dateTimePickerInput;
private onDestroy$ = new Subject<boolean>();
@@ -172,7 +173,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
minWidth: '250px',
closeOnNavigation: true
})
.beforeClose()
.beforeClosed()
.subscribe((deleteSharedLink) => {
if (deleteSharedLink) {
this.deleteSharedLink(this.sharedId);
@@ -64,7 +64,7 @@ describe('NodeSharedDirective', () => {
beforeEach(() => {
fixture = TestBed.createComponent(NodeShareTestComponent);
document = TestBed.get(DOCUMENT);
document = TestBed.inject(DOCUMENT);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -16,7 +16,7 @@
*/
import { Directive, Input, HostListener, OnChanges, NgZone, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { NodeEntry, Node } from '@alfresco/js-api';
import { ShareDialogComponent } from './content-node-share.dialog';
@@ -35,19 +35,16 @@ import { NodeSharedDirective } from './content-node-share.directive';
exports: [
ShareDialogComponent,
NodeSharedDirective
],
entryComponents: [
ShareDialogComponent
]
})
export class ContentNodeShareModule {
static forRoot(): ModuleWithProviders {
static forRoot(): ModuleWithProviders<ContentNodeShareModule> {
return {
ngModule: ContentNodeShareModule
};
}
static forChild(): ModuleWithProviders {
static forChild(): ModuleWithProviders<ContentNodeShareModule> {
return {
ngModule: ContentNodeShareModule
};
@@ -96,7 +96,7 @@ import { TreeViewModule } from './tree-view/tree-view.module';
]
})
export class ContentModule {
static forRoot(): ModuleWithProviders {
static forRoot(): ModuleWithProviders<ContentModule> {
return {
ngModule: ContentModule,
providers: [
@@ -112,7 +112,7 @@ export class ContentModule {
};
}
static forChild(): ModuleWithProviders {
static forChild(): ModuleWithProviders<ContentModule> {
return {
ngModule: ContentModule
};
@@ -16,7 +16,7 @@
*/
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { setupTestBed } from '@alfresco/adf-core';
import { ConfirmDialogComponent } from './confirm.dialog';
import { ContentTestingModule } from '../testing/content.testing.module';
@@ -16,7 +16,7 @@
*/
import { Component, Inject, ViewEncapsulation, SecurityContext } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { DomSanitizer } from '@angular/platform-browser';
export interface ConfirmDialogComponentProps {
@@ -49,12 +49,6 @@ import { LibraryDialogComponent } from './library/library.dialog';
NodeLockDialogComponent,
ConfirmDialogComponent,
LibraryDialogComponent
],
entryComponents: [
FolderDialogComponent,
NodeLockDialogComponent,
ConfirmDialogComponent,
LibraryDialogComponent
]
})
export class DialogModule {}
@@ -16,7 +16,7 @@
*/
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material';
import { MatDialogRef } from '@angular/material/dialog';
import { NodesApiService, setupTestBed } from '@alfresco/adf-core';
import { FolderDialogComponent } from './folder.dialog';
import { of, throwError } from 'rxjs';
@@ -47,7 +47,7 @@ describe('FolderDialogComponent', () => {
dialogRef.close.calls.reset();
fixture = TestBed.createComponent(FolderDialogComponent);
component = fixture.componentInstance;
nodesApi = TestBed.get(NodesApiService);
nodesApi = TestBed.inject(NodesApiService);
});
afterEach(() => {
@@ -19,7 +19,7 @@ import { Observable } from 'rxjs';
import { Component, Inject, OnInit, Optional, EventEmitter, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api';
import { NodesApiService, TranslationService } from '@alfresco/adf-core';
@@ -18,7 +18,7 @@
import { LibraryDialogComponent } from './library.dialog';
import { TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { MatDialogRef } from '@angular/material';
import { MatDialogRef } from '@angular/material/dialog';
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
@@ -47,7 +47,7 @@ describe('LibraryDialogComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(LibraryDialogComponent);
component = fixture.componentInstance;
alfrescoApi = TestBed.get(AlfrescoApiService);
alfrescoApi = TestBed.inject(AlfrescoApiService);
findSitesSpy = spyOn(alfrescoApi.getInstance().core.queriesApi, 'findSites');
});
@@ -31,7 +31,7 @@ import {
FormControl,
AbstractControl
} from '@angular/forms';
import { MatDialogRef } from '@angular/material';
import { MatDialogRef } from '@angular/material/dialog';
import { SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { debounceTime, mergeMap, takeUntil } from 'rxjs/operators';
@@ -18,7 +18,7 @@
import moment from 'moment-es6';
import { TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material';
import { MatDialogRef } from '@angular/material/dialog';
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
import { NodeBodyLock } from '@alfresco/js-api';
import { NodeLockDialogComponent } from './node-lock.dialog';
@@ -48,7 +48,7 @@ describe('NodeLockDialogComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(NodeLockDialogComponent);
component = fixture.componentInstance;
alfrescoApi = TestBed.get(AlfrescoApiService);
alfrescoApi = TestBed.inject(AlfrescoApiService);
});
afterEach(() => {
@@ -18,7 +18,7 @@
import moment from 'moment-es6';
import { Component, Inject, OnInit, Optional } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FormBuilder, FormGroup } from '@angular/forms';
import { NodeBodyLock, Node, NodeEntry } from '@alfresco/js-api';
@@ -59,7 +59,7 @@ describe('NodeLock Directive', () => {
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
element = fixture.debugElement.query(By.directive(NodeLockDirective));
contentNodeDialogService = TestBed.get(ContentNodeDialogService);
contentNodeDialogService = TestBed.inject(ContentNodeDialogService);
});
it('should call openLockNodeDialog method on click', () => {
@@ -48,7 +48,7 @@ describe('ContentAction', () => {
});
beforeEach(() => {
contentService = TestBed.get(ContentService);
contentService = TestBed.inject(ContentService);
nodeActionsService = new NodeActionsService(null, null, null);
documentActions = new DocumentActionsService(nodeActionsService, null, null, null);
folderActions = new FolderActionsService(nodeActionsService, null, contentService, null);
@@ -82,9 +82,9 @@ describe('DocumentList', () => {
element = fixture.nativeElement;
documentList = fixture.componentInstance;
documentListService = TestBed.get(DocumentListService);
apiService = TestBed.get(AlfrescoApiService);
customResourcesService = TestBed.get(CustomResourcesService);
documentListService = TestBed.inject(DocumentListService);
apiService = TestBed.inject(AlfrescoApiService);
customResourcesService = TestBed.inject(CustomResourcesService);
spyFolder = spyOn(documentListService, 'getFolder').and.callFake(() => {
return Promise.resolve({ list: {} });
@@ -1573,7 +1573,7 @@ describe('DocumentListComponent rendering', () => {
component.customDocumentList.dataTable.data = data;
fixture.detectChanges();
const rows = fixture.nativeElement.querySelectorAll('div[class="adf-datatable-body"] adf-datatable-row');
const rows = fixture.nativeElement.querySelectorAll('.adf-datatable-body adf-datatable-row');
expect(rows).toBeDefined();
expect(rows.length).toBe(3);
const cell1 = fixture.nativeElement.querySelector('div[title="Name"][data-automation-id="Name 1"]');
@@ -304,7 +304,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Output()
error: EventEmitter<any> = new EventEmitter();
@ViewChild('dataTable')
@ViewChild('dataTable', { static: true })
dataTable: DataTableComponent;
actions: ContentActionModel[] = [];
@@ -38,8 +38,8 @@ describe('ShareDataTableAdapter', () => {
beforeEach(() => {
const imageUrl: string = 'http://<addresss>';
contentService = TestBed.get(ContentService);
thumbnailService = TestBed.get(ThumbnailService);
contentService = TestBed.inject(ContentService);
thumbnailService = TestBed.inject(ThumbnailService);
spyOn(thumbnailService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
});
@@ -61,13 +61,6 @@ import { NameColumnComponent } from './components/name-column/name-column.compon
NameColumnComponent,
ContentActionComponent,
ContentActionListComponent
],
entryComponents: [
TrashcanNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
LibraryNameColumnComponent,
NameColumnComponent
]
})
export class DocumentListModule {}
@@ -47,7 +47,7 @@ describe('DocumentActionsService', () => {
beforeEach(() => {
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
const contentService = TestBed.get(ContentService);
const contentService = TestBed.inject(ContentService);
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService);
@@ -73,7 +73,7 @@ describe('DocumentListService', () => {
beforeEach(() => {
const logService = new LogService(new AppConfigServiceMock(null));
const contentService = TestBed.get(ContentService);
const contentService = TestBed.inject(ContentService);
alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
const customActionService = new CustomResourcesService(alfrescoApiService, logService);
service = new DocumentListService(contentService, alfrescoApiService, logService, customActionService);
@@ -38,10 +38,10 @@ describe('FolderActionsService', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
const contentService = TestBed.get(ContentService);
const contentService = TestBed.inject(ContentService);
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
service = new FolderActionsService(null, documentListService, contentService, new TranslationMock());
@@ -22,7 +22,7 @@ import { DocumentListService } from './document-list.service';
import { NodeActionsService } from './node-actions.service';
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
import { of, throwError } from 'rxjs';
import { MatDialogRef } from '@angular/material';
import { MatDialogRef } from '@angular/material/dialog';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
@@ -50,12 +50,12 @@ describe('NodeActionsService', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
service = TestBed.get(NodeActionsService);
documentListService = TestBed.get(DocumentListService);
contentDialogService = TestBed.get(ContentNodeDialogService);
service = TestBed.inject(NodeActionsService);
documentListService = TestBed.inject(DocumentListService);
contentDialogService = TestBed.inject(ContentNodeDialogService);
});
it('should be able to copy content', async(() => {
@@ -19,7 +19,7 @@ import { Injectable, Output, EventEmitter } from '@angular/core';
import { Node, NodeEntry } from '@alfresco/js-api';
import { Subject } from 'rxjs';
import { AlfrescoApiService, ContentService, NodeDownloadDirective, DownloadService } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { DocumentListService } from './document-list.service';
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
@@ -27,6 +27,7 @@ import { ContentNodeDialogService } from '../../content-node-selector/content-no
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
export class NodeActionsService {
@Output()
@@ -17,7 +17,7 @@
import { Component } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { By } from '@angular/platform-browser';
import { Subject, of } from 'rxjs';
@@ -76,8 +76,8 @@ describe('FolderCreateDirective', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TestComponent);
element = fixture.debugElement.query(By.directive(FolderCreateDirective));
dialog = TestBed.get(MatDialog);
contentService = TestBed.get(ContentService);
dialog = TestBed.inject(MatDialog);
contentService = TestBed.inject(ContentService);
});
beforeEach(() => {
@@ -95,8 +95,8 @@ describe('FolderCreateDirective', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TestTypeComponent);
element = fixture.debugElement.query(By.directive(FolderCreateDirective));
dialog = TestBed.get(MatDialog);
contentService = TestBed.get(ContentService);
dialog = TestBed.inject(MatDialog);
contentService = TestBed.inject(ContentService);
spyOn(dialog, 'open').and.returnValue(dialogRefMock);
});
@@ -144,8 +144,8 @@ describe('FolderCreateDirective', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TestComponent);
element = fixture.debugElement.query(By.directive(FolderCreateDirective));
dialog = TestBed.get(MatDialog);
contentService = TestBed.get(ContentService);
dialog = TestBed.inject(MatDialog);
contentService = TestBed.inject(ContentService);
spyOn(dialog, 'open').and.returnValue(dialogRefMock);
});
@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api';
import { FolderDialogComponent } from '../dialogs/folder.dialog';
import { ContentService } from '@alfresco/adf-core';
@@ -62,7 +62,7 @@ export class FolderCreateDirective {
public content: ContentService
) {}
private get dialogConfig(): MatDialogConfig {
private get dialogConfig() {
const { DIALOG_WIDTH: width } = FolderCreateDirective;
const { parentNodeId, title: createTitle, nodeType } = this;
@@ -17,7 +17,7 @@
import { Component } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { By } from '@angular/platform-browser';
import { Subject, of } from 'rxjs';
@@ -64,8 +64,8 @@ describe('FolderEditDirective', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TestComponent);
element = fixture.debugElement.query(By.directive(FolderEditDirective));
dialog = TestBed.get(MatDialog);
contentService = TestBed.get(ContentService);
dialog = TestBed.inject(MatDialog);
contentService = TestBed.inject(ContentService);
});
beforeEach(() => {
@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api';
@@ -61,7 +61,7 @@ export class FolderEditDirective {
public content: ContentService
) {}
private get dialogConfig(): MatDialogConfig {
private get dialogConfig() {
const { DIALOG_WIDTH: width } = FolderEditDirective;
const { folder } = this;
+46 -31
View File
@@ -16,32 +16,29 @@
*/
import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatChipsModule,
MatDialogModule,
MatIconModule,
MatCardModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatOptionModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRippleModule,
MatExpansionModule,
MatSelectModule,
MatCheckboxModule,
MatDatepickerModule,
MatSlideToggleModule,
MatRadioModule,
MatSliderModule,
MatTreeModule,
MatBadgeModule
} from '@angular/material';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatChipsModule } from '@angular/material/chips';
import { MatOptionModule, MatRippleModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSliderModule } from '@angular/material/slider';
import { MatTreeModule } from '@angular/material/tree';
import { MatBadgeModule } from '@angular/material/badge';
export function modules() {
return [
@NgModule({
imports: [
MatButtonModule,
MatChipsModule,
MatDialogModule,
@@ -63,12 +60,30 @@ export function modules() {
MatSliderModule,
MatTreeModule,
MatBadgeModule
];
}
@NgModule({
imports: modules(),
exports: modules()
],
exports: [
MatButtonModule,
MatChipsModule,
MatDialogModule,
MatIconModule,
MatCardModule,
MatInputModule,
MatListModule,
MatProgressSpinnerModule,
MatProgressBarModule,
MatRippleModule,
MatMenuModule,
MatOptionModule,
MatExpansionModule,
MatSelectModule,
MatCheckboxModule,
MatDatepickerModule,
MatSlideToggleModule,
MatRadioModule,
MatSliderModule,
MatTreeModule,
MatBadgeModule
]
})
export class MaterialModule {
}
@@ -137,7 +137,7 @@ export let errorJson = {
export class SimpleSearchTestComponent {
@ViewChild('search')
@ViewChild('search', { static: true })
search: SearchComponent;
message: string = '';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { ContentTestingModule } from '../../../testing/content.testing.module';
@@ -16,7 +16,7 @@
*/
import { Component, ViewEncapsulation, Inject, ViewChild } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { NodeEntry } from '@alfresco/js-api';
import { AddPermissionDialogData } from './add-permission-dialog-data.interface';
import { AddPermissionComponent } from '../add-permission/add-permission.component';
@@ -35,7 +35,7 @@ import { NodeEntry } from '@alfresco/js-api';
})
export class AddPermissionPanelComponent {
@ViewChild('search')
@ViewChild('search', { static: true })
search: SearchComponent;
/** Emitted when a permission list item is selected. */
@@ -42,11 +42,11 @@ describe('AddPermissionComponent', () => {
});
beforeEach(() => {
nodeApiService = TestBed.get(NodesApiService);
nodeApiService = TestBed.inject(NodesApiService);
spyOn(nodeApiService, 'getNode').and.returnValue(of({ id: 'fake-node', allowableOperations: ['updatePermissions']}));
fixture = TestBed.createComponent(AddPermissionComponent);
element = fixture.nativeElement;
nodePermissionService = TestBed.get(NodePermissionService);
nodePermissionService = TestBed.inject(NodePermissionService);
fixture.detectChanges();
});
@@ -47,7 +47,7 @@ describe('InheritPermissionDirective', () => {
fixture = TestBed.createComponent(SimpleInheritedPermissionTestComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
nodeService = TestBed.get(NodesApiService);
nodeService = TestBed.inject(NodesApiService);
}));
it('should be able to render the simple component', async(() => {
@@ -51,9 +51,9 @@ describe('PermissionDisplayComponent', () => {
fixture = TestBed.createComponent(PermissionListComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
nodeService = TestBed.get(NodesApiService);
nodePermissionService = TestBed.get(NodePermissionService);
searchApiService = TestBed.get(SearchService);
nodeService = TestBed.inject(NodesApiService);
nodePermissionService = TestBed.inject(NodePermissionService);
searchApiService = TestBed.inject(SearchService);
});
afterEach(() => {
@@ -45,11 +45,6 @@ import { SearchModule } from '../search/search.module';
AddPermissionComponent,
AddPermissionDialogComponent
],
entryComponents: [
AddPermissionPanelComponent,
AddPermissionComponent,
AddPermissionDialogComponent
],
exports: [
PermissionListComponent,
NoPermissionTemplateComponent,
@@ -18,7 +18,7 @@
import { TestBed } from '@angular/core/testing';
import { AppConfigService, setupTestBed, ContentService } from '@alfresco/adf-core';
import { NodePermissionDialogService } from './node-permission-dialog.service';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { Subject, of, throwError } from 'rxjs';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { NodePermissionService } from './node-permission.service';
@@ -42,13 +42,13 @@ describe('NodePermissionDialogService', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
service = TestBed.get(NodePermissionDialogService);
materialDialog = TestBed.get(MatDialog);
service = TestBed.inject(NodePermissionDialogService);
materialDialog = TestBed.inject(MatDialog);
afterOpenObservable = new Subject<any>();
nodePermissionService = TestBed.get(NodePermissionService);
contentService = TestBed.get(ContentService);
nodePermissionService = TestBed.inject(NodePermissionService);
contentService = TestBed.inject(ContentService);
spyOnDialogOpen = spyOn(materialDialog, 'open').and.returnValue({
afterOpen: () => afterOpenObservable,
afterClosed: () => of({}),
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { Injectable } from '@angular/core';
import { Subject, Observable, throwError } from 'rxjs';
import { AddPermissionDialogComponent } from '../components/add-permission/add-permission-dialog.component';
@@ -40,9 +40,9 @@ describe('NodePermissionService', () => {
});
beforeEach(() => {
service = TestBed.get(NodePermissionService);
searchApiService = TestBed.get(SearchService);
nodeService = TestBed.get(NodesApiService);
service = TestBed.inject(NodePermissionService);
searchApiService = TestBed.inject(SearchService);
nodeService = TestBed.inject(NodesApiService);
});
afterEach(() => {
@@ -16,7 +16,7 @@
*/
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { MatCheckboxChange } from '@angular/material';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { SearchWidget } from '../../search-widget.interface';
import { SearchWidgetSettings } from '../../search-widget-settings.interface';
import { SearchQueryBuilderService } from '../../search-query-builder.service';
@@ -43,10 +43,10 @@ import { TranslateModule } from '@ngx-translate/core';
export class SimpleSearchTestCustomEmptyComponent {
customMessage = '';
@ViewChild(SearchControlComponent)
@ViewChild(SearchControlComponent, { static: true })
searchComponent: SearchControlComponent;
@ViewChild(SearchTextInputComponent)
@ViewChild(SearchTextInputComponent, { static: true })
searchTextInputComponent: SearchTextInputComponent;
}
@@ -77,9 +77,9 @@ describe('SearchControlComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(SearchControlComponent);
debugElement = fixture.debugElement;
searchService = TestBed.get(SearchService);
authService = TestBed.get(AuthenticationService);
userPreferencesService = TestBed.get(UserPreferencesService);
searchService = TestBed.inject(SearchService);
authService = TestBed.inject(AuthenticationService);
userPreferencesService = TestBed.inject(UserPreferencesService);
spyOn(authService, 'isEcmLoggedIn').and.returnValue(true);
component = fixture.componentInstance;
element = fixture.nativeElement;
@@ -21,7 +21,7 @@ import { Component, EventEmitter, Input, OnDestroy, Output,
import { NodeEntry } from '@alfresco/js-api';
import { Subject } from 'rxjs';
import { SearchComponent } from './search.component';
import { MatListItem } from '@angular/material';
import { MatListItem } from '@angular/material/list';
import { EmptySearchResultComponent } from './empty-search-result.component';
@Component({
@@ -42,7 +42,7 @@ describe('SearchDateRangeComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(SearchDateRangeComponent);
adapter = fixture.debugElement.injector.get(DateAdapter);
adapter = fixture.debugElement.injector.get(DateAdapter) as MomentDateAdapter;
component = fixture.componentInstance;
});
@@ -59,9 +59,9 @@ describe('SearchFilterComponent', () => {
});
beforeEach(() => {
queryBuilder = TestBed.inject(SearchQueryBuilderService);
fixture = TestBed.createComponent(SearchFilterComponent);
queryBuilder = fixture.componentInstance.queryBuilder;
appConfigService = TestBed.get(AppConfigService);
appConfigService = TestBed.inject(AppConfigService);
const translationService = fixture.debugElement.injector.get(TranslationService);
spyOn(translationService, 'instant').and.callFake((key) => key ? `${key}_translated` : null);
component = fixture.componentInstance;
@@ -16,7 +16,7 @@
*/
import { Component, ViewEncapsulation, OnInit, OnDestroy, Inject } from '@angular/core';
import { MatCheckboxChange } from '@angular/material';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { SearchService, TranslationService } from '@alfresco/adf-core';
import { SearchQueryBuilderService } from '../../search-query-builder.service';
import { FacetFieldBucket } from '../../facet-field-bucket.interface';
@@ -67,7 +67,7 @@ describe('SearchHeaderComponent', () => {
fixture = TestBed.createComponent(SearchHeaderComponent);
component = fixture.componentInstance;
queryBuilder = fixture.componentInstance['searchHeaderQueryBuilder'];
alfrescoApiService = TestBed.get(AlfrescoApiService);
alfrescoApiService = TestBed.inject(AlfrescoApiService);
component.col = {key: '123', type: 'text'};
spyOn(queryBuilder, 'getCategoryForColumn').and.returnValue(mockCategory);
fixture.detectChanges();
@@ -16,7 +16,7 @@
*/
import { Component, ViewEncapsulation, OnInit, Input } from '@angular/core';
import { MatRadioChange } from '@angular/material';
import { MatRadioChange } from '@angular/material/radio';
import { SearchWidget } from '../../search-widget.interface';
import { SearchWidgetSettings } from '../../search-widget-settings.interface';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { MatSliderChange } from '@angular/material';
import { MatSliderChange } from '@angular/material/slider';
import { SearchSliderComponent } from './search-slider.component';
import { setupTestBed } from '@alfresco/adf-core';
import { ContentTestingModule } from '../../../testing/content.testing.module';
@@ -19,7 +19,7 @@ import { Component, ViewEncapsulation, OnInit, Input } from '@angular/core';
import { SearchWidget } from '../../search-widget.interface';
import { SearchWidgetSettings } from '../../search-widget-settings.interface';
import { SearchQueryBuilderService } from '../../search-query-builder.service';
import { MatSliderChange } from '@angular/material';
import { MatSliderChange } from '@angular/material/slider';
@Component({
selector: 'adf-search-slider',
@@ -26,7 +26,7 @@ import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
})
export class SearchWidgetContainerComponent implements OnInit, OnDestroy {
@ViewChild('content', { read: ViewContainerRef })
@ViewChild('content', { read: ViewContainerRef, static: true })
content: ViewContainerRef;
@Input()
@@ -40,7 +40,7 @@ describe('SearchComponent', () => {
fixture = TestBed.createComponent(SimpleSearchTestComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
searchService = TestBed.get(SearchService);
searchService = TestBed.inject(SearchService);
});
describe('search results', () => {
@@ -47,7 +47,7 @@ import { debounceTime, takeUntil } from 'rxjs/operators';
})
export class SearchComponent implements SearchComponentInterface, AfterContentInit, OnChanges, OnDestroy {
@ViewChild('panel')
@ViewChild('panel', { static: true })
panel: ElementRef;
@ContentChild(TemplateRef)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ErrorStateMatcher } from '@angular/material';
import { ErrorStateMatcher } from '@angular/material/core';
import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
export class LiveErrorStateMatcher implements ErrorStateMatcher {
@@ -38,6 +38,7 @@ export * from './components/search-chip-list/search-chip-list.component';
export * from './components/search-date-range/search-date-range.component';
export * from './components/search-filter/search-filter.component';
export * from './components/search-filter/search-filter.service';
export * from './components/search-header/search-header.component';
export * from './components/search-number-range/search-number-range.component';
export * from './components/search-radio/search-radio.component';
export * from './components/search-slider/search-slider.component';
@@ -79,17 +79,9 @@ import { SearchQueryBuilderService } from './search-query-builder.service';
SearchSortingPickerComponent,
SearchHeaderComponent
],
entryComponents: [
SearchWidgetContainerComponent,
SearchTextComponent,
SearchRadioComponent,
SearchSliderComponent,
SearchNumberRangeComponent,
SearchCheckListComponent,
SearchDateRangeComponent
],
providers: [
{ provide: SEARCH_QUERY_SERVICE_TOKEN, useExisting: SearchQueryBuilderService }
{ provide: SEARCH_QUERY_SERVICE_TOKEN, useExisting: SearchQueryBuilderService },
SearchSortingPickerComponent
]
})
export class SearchModule {}
@@ -69,7 +69,7 @@ describe('DropdownSitesComponent', () => {
describe('Infinite Loading', () => {
beforeEach(async(() => {
siteService = TestBed.get(SitesService);
siteService = TestBed.inject(SitesService);
fixture = TestBed.createComponent(DropdownSitesComponent);
debug = fixture.debugElement;
element = fixture.nativeElement;
@@ -98,7 +98,7 @@ describe('DropdownSitesComponent', () => {
describe('Sites', () => {
beforeEach(async(() => {
siteService = TestBed.get(SitesService);
siteService = TestBed.inject(SitesService);
spyOn(siteService, 'getSites').and.returnValue(of(getFakeSitePagingNoMoreItems()));
fixture = TestBed.createComponent(DropdownSitesComponent);
@@ -240,7 +240,7 @@ describe('DropdownSitesComponent', () => {
describe('Default value', () => {
beforeEach(async(() => {
siteService = TestBed.get(SitesService);
siteService = TestBed.inject(SitesService);
spyOn(siteService, 'getSites').and.returnValues(of(getFakeSitePagingFirstPage()), of(getFakeSitePagingLastPage()));
fixture = TestBed.createComponent(DropdownSitesComponent);
@@ -272,7 +272,7 @@ describe('DropdownSitesComponent', () => {
describe('Sites with members', () => {
beforeEach(async(() => {
siteService = TestBed.get(SitesService);
siteService = TestBed.inject(SitesService);
spyOn(siteService, 'getSites').and.returnValue(of(getFakeSitePagingWithMembers()));
fixture = TestBed.createComponent(DropdownSitesComponent);
@@ -18,7 +18,7 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation, OnDestroy } from '@angular/core';
import { SitesService, LogService } from '@alfresco/adf-core';
import { SitePaging, SiteEntry } from '@alfresco/js-api';
import { MatSelect } from '@angular/material';
import { MatSelect } from '@angular/material/select';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@@ -71,7 +71,7 @@ export class DropdownSitesComponent implements OnInit, OnDestroy {
@Output()
change: EventEmitter<SiteEntry> = new EventEmitter();
@ViewChild('siteSelect')
@ViewChild('siteSelect', { static: true })
siteSelect: MatSelect;
private loading = true;
@@ -39,7 +39,7 @@ describe('Like component', () => {
});
beforeEach(async(() => {
service = TestBed.get(RatingService);
service = TestBed.inject(RatingService);
spyOn(service, 'getRating').and.returnValue(of({
entry: {
@@ -40,7 +40,7 @@ describe('Rating component', () => {
beforeEach(() => {
fixture = TestBed.createComponent(RatingComponent);
service = TestBed.get(RatingService);
service = TestBed.inject(RatingService);
element = fixture.nativeElement;
component = fixture.componentInstance;
@@ -35,7 +35,7 @@ describe('Rating service', () => {
});
beforeEach(() => {
service = TestBed.get(RatingService);
service = TestBed.inject(RatingService);
});
beforeEach(() => {
@@ -18,9 +18,8 @@
import { AlfrescoApiService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { RatingEntry, RatingBody } from '@alfresco/js-api';
import { from, throwError } from 'rxjs';
import { from, throwError, Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs/internal/Observable';
@Injectable({
providedIn: 'root'
@@ -35,7 +35,7 @@ describe('TagService', () => {
});
beforeEach(() => {
service = TestBed.get(TagService);
service = TestBed.inject(TagService);
});
beforeEach(() => {
@@ -24,6 +24,7 @@ import { TagBody, TagPaging, TagEntry } from '@alfresco/js-api';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
export class TagService {
/** Emitted when tag information is updated. */
@@ -55,10 +55,10 @@ describe('TagList', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
tagService = TestBed.get(TagService);
tagService = TestBed.inject(TagService);
spyOn(tagService, 'getAllTheTags').and.returnValue(of(dataTag));
fixture = TestBed.createComponent(TagListComponent);
@@ -55,12 +55,12 @@ describe('TagNodeList', () => {
});
beforeEach(() => {
const appConfig: AppConfigService = TestBed.get(AppConfigService);
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
fixture = TestBed.createComponent(TagNodeListComponent);
tagService = TestBed.get(TagService);
tagService = TestBed.inject(TagService);
spyOn(tagService, 'getTagsByNodeId').and.returnValue(of(dataTag));
element = fixture.nativeElement;
@@ -83,7 +83,7 @@ describe('TreeViewComponent', () => {
describe('When there is a nodeId', () => {
beforeEach(async(() => {
treeService = TestBed.get(TreeViewService);
treeService = TestBed.inject(TreeViewService);
fixture = TestBed.createComponent(TreeViewComponent);
element = fixture.nativeElement;
component = fixture.componentInstance;
@@ -229,7 +229,7 @@ describe('TreeViewComponent', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(TreeViewComponent);
treeService = TestBed.get(TreeViewService);
treeService = TestBed.inject(TreeViewService);
spyOn(treeService, 'getTreeNodes').and.callFake(() => throwError('Invalid Node Id'));
fixture.componentInstance.nodeId = 'Poopoovic';
}));
@@ -46,7 +46,7 @@ export class TreeViewDataSource {
}
connect(collectionViewer: CollectionViewer): Observable<TreeBaseNode[]> {
this.changeSubscription = this.treeControl.expansionModel.onChange.subscribe((change) => {
this.changeSubscription = this.treeControl.expansionModel.changed.subscribe((change) => {
if ((change as SelectionChange<TreeBaseNode>).added &&
(change as SelectionChange<TreeBaseNode>).added.length > 0) {
this.expandTreeNodes(change as SelectionChange<TreeBaseNode>);
@@ -45,8 +45,8 @@ describe('TreeViewService', () => {
});
beforeEach(() => {
service = TestBed.get(TreeViewService);
nodeService = TestBed.get(NodesApiService);
service = TestBed.inject(TreeViewService);
nodeService = TestBed.inject(NodesApiService);
});
it('should returns TreeBaseNode elements', (done) => {
@@ -54,7 +54,7 @@ describe('UploadBase', () => {
beforeEach(() => {
fixture = TestBed.createComponent(UploadTestComponent);
uploadService = TestBed.get(UploadService);
uploadService = TestBed.inject(UploadService);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -16,11 +16,13 @@
*/
import { FileModel, FileInfo, UploadService, TranslationService } from '@alfresco/adf-core';
import { EventEmitter, Input, Output, OnInit, OnDestroy, NgZone } from '@angular/core';
import { EventEmitter, Input, Output, OnInit, OnDestroy, NgZone, Directive } from '@angular/core';
import { Subject } from 'rxjs';
import { UploadFilesEvent } from '../upload-files.event';
import { takeUntil } from 'rxjs/operators';
@Directive()
// tslint:disable-next-line: directive-class-suffix
export abstract class UploadBase implements OnInit, OnDestroy {
/** Sets a limit on the maximum size (in bytes) of a file to be uploaded.
@@ -45,8 +45,8 @@ describe('FileUploadingDialogComponent', () => {
fixture = TestBed.createComponent(FileUploadingDialogComponent);
component = fixture.componentInstance;
uploadService = TestBed.get(UploadService);
userPreferenceService = TestBed.get(UserPreferencesService);
uploadService = TestBed.inject(UploadService);
userPreferenceService = TestBed.inject(UserPreferencesService);
uploadService.clearQueue();
spyOn(uploadService, 'uploadFilesInTheQueue').and.callFake(() => {});
@@ -42,12 +42,12 @@ describe('FileUploadingListComponent', () => {
});
beforeEach(() => {
nodesApiService = TestBed.get(NodesApiService);
nodesApiService = TestBed.inject(NodesApiService);
uploadService = TestBed.get(UploadService);
uploadService = TestBed.inject(UploadService);
uploadService.clearQueue();
translateService = TestBed.get(TranslationService);
translateService = TestBed.inject(TranslationService);
fixture = TestBed.createComponent(FileUploadingListComponent);
component = fixture.componentInstance;
@@ -60,8 +60,8 @@ describe('UploadButtonComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(UploadButtonComponent);
uploadService = TestBed.get(UploadService);
contentService = TestBed.get(ContentService);
uploadService = TestBed.inject(UploadService);
contentService = TestBed.inject(ContentService);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -103,7 +103,7 @@ describe('UploadDragAreaComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(UploadDragAreaComponent);
uploadService = TestBed.get(UploadService);
uploadService = TestBed.inject(UploadService);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -27,7 +27,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
`
})
class TestComponent {
@ViewChild(ToggleIconDirective) directive: ToggleIconDirective;
@ViewChild(ToggleIconDirective)
directive: ToggleIconDirective;
}
describe('ToggleIconDirective', () => {
@@ -43,13 +43,13 @@ describe('VersionComparisonComponent', () => {
}
});
const file: File = {
const file = {
name: 'Fake New file',
type: 'image/png',
lastModified: 13,
size: 1351,
slice: null
};
} as File;
setupTestBed({
imports: [
@@ -84,7 +84,7 @@ describe('VersionComparisonComponent', () => {
lastModified: 13,
size: 1351,
slice: null
};
} as File;
fixture.detectChanges();
const newImageNode = document.querySelector('.adf-version-new img');
expect(newImageNode.getAttribute('src')).toBe('./assets/images/ft_ic_pdf.svg');
@@ -20,7 +20,7 @@ import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testin
import { By } from '@angular/platform-browser';
import { VersionListComponent } from './version-list.component';
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { of } from 'rxjs';
import { Node, VersionPaging, VersionEntry } from '@alfresco/js-api';
import { ContentTestingModule } from '../testing/content.testing.module';
@@ -59,8 +59,8 @@ describe('VersionListComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(VersionListComponent);
alfrescoApiService = TestBed.get(AlfrescoApiService);
dialog = TestBed.get(MatDialog);
alfrescoApiService = TestBed.inject(AlfrescoApiService);
dialog = TestBed.inject(MatDialog);
component = fixture.componentInstance;
component.node = <Node> { id: nodeId, allowableOperations: ['update'] };

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