diff --git a/docs/core/directives/version-compatibility.directive.md b/docs/core/directives/version-compatibility.directive.md new file mode 100644 index 0000000000..8c32db04f3 --- /dev/null +++ b/docs/core/directives/version-compatibility.directive.md @@ -0,0 +1,56 @@ +# [Version Compatibility Directive](../../../lib/core/directives/version-compatibility.directive.ts "Defined in version-compatibility.directive.ts") + +Enables/disables components based on ACS version in use. + +## Basic usage + +```html + +``` + +## Class members + +### Properties + +| Name | Type | Default value | Description | +| ---- | ---- | ------------- | ----------- | +| adf-acs-version | `string` | | The minimum version required for a given component to work propertly. | + +## Details + +Add the directive to a component or HTML element to enable or disable it based on the version of ACS running in the app. + +The directive takes the version specified in the html and compares it to the version of Alfresco Content Services running in the app. + +This will allow certain features to be only present under specific versions. + +#### Major version +```html + +``` + +#### Major and minor version +```html + +``` + +#### Major, minor and patch version +```html + +``` + +It can be set to match major, minor and patches of ACS versions. Fox example, if the version `6` is specifed it will enable the component from `6.0.0` onwards. + +If the minimum version required is not matched the component will not be initialized and will disappear from the DOM tree. + +``` +Note, if you don’t place the * in front, the app won’t be able to inject the TemplateRef and ViewContainerRef required for this directive to work. +``` diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts index 7f627f102f..e7055fdf00 100644 --- a/lib/core/core.module.ts +++ b/lib/core/core.module.ts @@ -57,6 +57,8 @@ import { ExtensionsModule } from '@alfresco/adf-extensions'; import { directionalityConfigFactory } from './services/directionality-config-factory'; import { DirectionalityConfigService } from './services/directionality-config.service'; import { SearchTextModule } from './search-text/search-text-input.module'; +import { versionCompatibilityFactory } from './services/version-compatibility-factory'; +import { VersionCompatibilityService } from './services/version-compatibility.service'; @NgModule({ imports: [ @@ -149,6 +151,12 @@ export class CoreModule { useFactory: directionalityConfigFactory, deps: [ DirectionalityConfigService ], multi: true + }, + { + provide: APP_INITIALIZER, + useFactory: versionCompatibilityFactory, + deps: [ VersionCompatibilityService ], + multi: true } ] }; diff --git a/lib/core/directives/directive.module.ts b/lib/core/directives/directive.module.ts index edd5739fe8..35837e842b 100644 --- a/lib/core/directives/directive.module.ts +++ b/lib/core/directives/directive.module.ts @@ -27,6 +27,7 @@ import { CheckAllowableOperationDirective } from './check-allowable-operation.di import { NodeRestoreDirective } from './node-restore.directive'; import { UploadDirective } from './upload.directive'; import { NodeDownloadDirective } from './node-download.directive'; +import { VersionCompatibilityDirective } from './version-compatibility.directive'; @NgModule({ imports: [ @@ -41,7 +42,8 @@ import { NodeDownloadDirective } from './node-download.directive'; CheckAllowableOperationDirective, NodeRestoreDirective, NodeDownloadDirective, - UploadDirective + UploadDirective, + VersionCompatibilityDirective ], exports: [ HighlightDirective, @@ -51,7 +53,8 @@ import { NodeDownloadDirective } from './node-download.directive'; CheckAllowableOperationDirective, NodeRestoreDirective, NodeDownloadDirective, - UploadDirective + UploadDirective, + VersionCompatibilityDirective ] }) export class DirectiveModule {} diff --git a/lib/core/directives/public-api.ts b/lib/core/directives/public-api.ts index 3462e3f8ee..88267858bb 100644 --- a/lib/core/directives/public-api.ts +++ b/lib/core/directives/public-api.ts @@ -23,5 +23,6 @@ export * from './check-allowable-operation.directive'; export * from './node-restore.directive'; export * from './node-download.directive'; export * from './upload.directive'; +export * from './version-compatibility.directive'; export * from './directive.module'; diff --git a/lib/core/directives/version-compatibility.directive.spec.ts b/lib/core/directives/version-compatibility.directive.spec.ts new file mode 100644 index 0000000000..13b14018a5 --- /dev/null +++ b/lib/core/directives/version-compatibility.directive.spec.ts @@ -0,0 +1,95 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component } from '@angular/core'; +import { By } from '@angular/platform-browser'; +import { TranslateModule } from '@ngx-translate/core'; +import { TestBed, ComponentFixture } from '@angular/core/testing'; +import { setupTestBed } from '../testing/setup-test-bed'; +import { CoreTestingModule } from '../testing/core.testing.module'; +import { VersionCompatibilityService } from '@alfresco/adf-core'; + +@Component({ + template: ` +
+ My hidden content 1 +
+
+ My hidden content 2 +
+
+ My hidden content 3 +
+
+ My visible content 1 +
+
+ My visible content 2 +
+
+ My visible content 3 +
+ ` +}) +class TestComponent { } + +describe('VersionCompatibilityDirective', () => { + let fixture: ComponentFixture; + let versionCompatibilityService: VersionCompatibilityService; + + const acsResponceMock = { + display: '7.0.1', + major: '7', + minor: '0', + patch: '1' + }; + + setupTestBed({ + imports: [ + TranslateModule.forRoot(), + CoreTestingModule + ], + declarations: [TestComponent + ] + }); + + beforeEach(() => { + fixture = TestBed.createComponent(TestComponent); + versionCompatibilityService = TestBed.get(VersionCompatibilityService); + spyOn(versionCompatibilityService, 'getAcsVersion').and.returnValue(acsResponceMock); + }); + + it('should display component when the version is supported', () => { + fixture.detectChanges(); + const element1 = fixture.debugElement.query(By.css('[class="visible-content-1"]')); + const element2 = fixture.debugElement.query(By.css('[class="visible-content-2"]')); + const element3 = fixture.debugElement.query(By.css('[class="visible-content-3"]')); + expect(element1).toBeDefined(); + expect(element2).toBeDefined(); + expect(element3).toBeDefined(); + }); + + it('should hide component when the version is not supported', () => { + fixture.detectChanges(); + const element1 = fixture.debugElement.query(By.css('[class="hidden-content-1"]')); + const element2 = fixture.debugElement.query(By.css('[class="hidden-content-2"]')); + const element3 = fixture.debugElement.query(By.css('[class="hidden-content-3"]')); + expect(element1).toBeNull(); + expect(element2).toBeNull(); + expect(element3).toBeNull(); + }); +}); diff --git a/lib/core/directives/version-compatibility.directive.ts b/lib/core/directives/version-compatibility.directive.ts new file mode 100644 index 0000000000..cf4179d6ad --- /dev/null +++ b/lib/core/directives/version-compatibility.directive.ts @@ -0,0 +1,82 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Directive, Input, ViewContainerRef, TemplateRef } from '@angular/core'; +import { VersionCompatibilityService } from '../services/version-compatibility.service'; +import { VersionModel } from '../models/product-version.model'; + +@Directive({ + selector: '[adf-acs-version]' +}) +export class VersionCompatibilityDirective { + + /** Minimum version required for component to work correctly . */ + @Input('adf-acs-version') + set version(requiredVersion: string) { + this.validateAcsVersion(requiredVersion); + } + + constructor( + private templateRef: TemplateRef, + private viewContainer: ViewContainerRef, + private versionCompatibilityService: VersionCompatibilityService + ) { + } + + private validateAcsVersion(requiredVersion: string) { + if (requiredVersion && this.isVersionSupported(requiredVersion)) { + this.viewContainer.createEmbeddedView(this.templateRef); + } else { + this.viewContainer.clear(); + } + } + + private parseVersion(version: string): VersionModel { + const major = version.split('.')[0]; + const minor = version.split('.')[1] || '0'; + const patch = version.split('.')[2] || '0'; + + return { + major: major, + minor: minor, + patch: patch + } as VersionModel; + } + + private isVersionSupported(requiredVersion: string): boolean { + const parsedRequiredVersion = this.parseVersion(requiredVersion); + const currentVersion = this.versionCompatibilityService.getAcsVersion(); + + let versionSupported = false; + + if (currentVersion) { + if (+currentVersion.major > +parsedRequiredVersion.major) { + versionSupported = true; + } else if (currentVersion.major === parsedRequiredVersion.major && + +currentVersion.minor > +parsedRequiredVersion.minor) { + versionSupported = true; + } else if (currentVersion.major === parsedRequiredVersion.major && + currentVersion.minor === parsedRequiredVersion.minor && + +currentVersion.patch >= +parsedRequiredVersion.patch) { + versionSupported = true; + } + } + + return versionSupported; + } + +} diff --git a/lib/core/search-text/search-text-input.component.spec.ts b/lib/core/search-text/search-text-input.component.spec.ts index 115a954d1a..3ed91627eb 100644 --- a/lib/core/search-text/search-text-input.component.spec.ts +++ b/lib/core/search-text/search-text-input.component.spec.ts @@ -24,7 +24,6 @@ import { Subject } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; import { UserPreferencesService } from '../services/user-preferences.service'; import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreModule } from '../core.module'; describe('SearchTextInputComponent', () => { @@ -37,7 +36,6 @@ describe('SearchTextInputComponent', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreModule.forRoot(), CoreTestingModule ] }); @@ -58,6 +56,7 @@ describe('SearchTextInputComponent', () => { describe('component rendering', () => { it('should display a search input field when specified', async(() => { + fixture.detectChanges(); component.inputType = 'search'; fixture.detectChanges(); expect(element.querySelectorAll('input[type="search"]').length).toBe(1); @@ -68,15 +67,17 @@ describe('SearchTextInputComponent', () => { beforeEach(() => { component.expandable = false; - fixture.detectChanges(); }); it('search button should be hide', () => { + fixture.detectChanges(); const searchButton: any = element.querySelector('#adf-search-button'); expect(searchButton).toBe(null); }); it('should not have animation', () => { + userPreferencesService.setWithoutStore('textOrientation', 'rtl'); + fixture.detectChanges(); expect(component.subscriptAnimationState.value).toBe('no-animation'); }); }); diff --git a/lib/core/services/public-api.ts b/lib/core/services/public-api.ts index 70907406c4..01bfc12f09 100644 --- a/lib/core/services/public-api.ts +++ b/lib/core/services/public-api.ts @@ -61,4 +61,5 @@ export * from './ecm-user.service'; export * from './identity-user.service'; export * from './identity-group.service'; export * from './identity-role.service'; +export * from './version-compatibility.service'; export * from './auth-bearer.interceptor'; diff --git a/lib/core/services/version-compatibility-factory.ts b/lib/core/services/version-compatibility-factory.ts new file mode 100644 index 0000000000..2a7164fc3b --- /dev/null +++ b/lib/core/services/version-compatibility-factory.ts @@ -0,0 +1,22 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { VersionCompatibilityService } from './version-compatibility.service'; + +export function versionCompatibilityFactory( + versionCompatibilityService: VersionCompatibilityService +): Function { return () => versionCompatibilityService; } diff --git a/lib/core/services/version-compatibility.service.spec.ts b/lib/core/services/version-compatibility.service.spec.ts new file mode 100644 index 0000000000..9d6937a482 --- /dev/null +++ b/lib/core/services/version-compatibility.service.spec.ts @@ -0,0 +1,75 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TestBed } from '@angular/core/testing'; +import { AppConfigService } from '../app-config/app-config.service'; +import { DiscoveryApiService } from './discovery-api.service'; +import { setupTestBed } from '../testing/setup-test-bed'; +import { CoreTestingModule } from '../testing/core.testing.module'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; +import { VersionCompatibilityService } from './version-compatibility.service'; +import { of } from 'rxjs'; +import { TranslateModule } from '@ngx-translate/core'; +import { AuthenticationService } from './authentication.service'; + +describe('VersionCompatibilityService', () => { + let versionCompatibilityService: VersionCompatibilityService; + let alfrescoApiService: AlfrescoApiServiceMock; + let discoveryApiService: DiscoveryApiService; + let authenticationService: AuthenticationService; + + const acsResponceMock = { + version: { + display: '7.0.1', + major: '7', + minor: '0', + patch: '1' + } + }; + + setupTestBed({ + imports: [ + TranslateModule.forRoot(), + CoreTestingModule + ] + }); + + beforeEach(() => { + discoveryApiService = TestBed.get(DiscoveryApiService); + authenticationService = TestBed.get(AuthenticationService); + spyOn(discoveryApiService, 'getEcmProductInfo').and.returnValue(of(acsResponceMock)); + spyOn(authenticationService, 'isEcmLoggedIn').and.returnValue(true); + versionCompatibilityService = TestBed.get(VersionCompatibilityService); + alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), null); + + }); + + it('should get ACS running version', (done) => { + versionCompatibilityService = new VersionCompatibilityService( + alfrescoApiService, + authenticationService, + discoveryApiService + ); + alfrescoApiService.initialize(); + setTimeout(() => { + const acsVersion = versionCompatibilityService.getAcsVersion(); + expect(acsVersion).toBeDefined(); + expect(acsVersion.display).toBe('7.0.1'); + done(); + }, 100); + }); +}); diff --git a/lib/core/services/version-compatibility.service.ts b/lib/core/services/version-compatibility.service.ts new file mode 100644 index 0000000000..b94a0a19eb --- /dev/null +++ b/lib/core/services/version-compatibility.service.ts @@ -0,0 +1,53 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Injectable } from '@angular/core'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { filter } from 'rxjs/operators'; +import { DiscoveryApiService } from './discovery-api.service'; +import { VersionModel, EcmProductVersionModel } from '../models/product-version.model'; +import { AuthenticationService } from './authentication.service'; + +@Injectable({ + providedIn: 'root' +}) +export class VersionCompatibilityService { + private acsVersion: VersionModel; + + constructor( + private alfrescoApiService: AlfrescoApiService, + private authService: AuthenticationService, + private discoveryApiService: DiscoveryApiService + ) { + this.alfrescoApiService.alfrescoApiInitialized + .pipe(filter(status => status)) + .subscribe(this.initCompatibilityVersion.bind(this)); + } + + private initCompatibilityVersion() { + if (this.authService.isEcmLoggedIn()) { + this.discoveryApiService.getEcmProductInfo().toPromise().then( + (acsInfo: EcmProductVersionModel) => { + this.acsVersion = acsInfo.version; + }); + } + } + + public getAcsVersion(): VersionModel { + return this.acsVersion; + } +} diff --git a/lib/core/testing/core.testing.module.ts b/lib/core/testing/core.testing.module.ts index 6a7a74366f..76ecf25e5c 100644 --- a/lib/core/testing/core.testing.module.ts +++ b/lib/core/testing/core.testing.module.ts @@ -32,6 +32,8 @@ import { CookieServiceMock } from '../mock/cookie.service.mock'; import { HttpClientModule } from '@angular/common/http'; import { directionalityConfigFactory } from '../services/directionality-config-factory'; import { DirectionalityConfigService } from '../services/directionality-config.service'; +import { versionCompatibilityFactory } from '../services/version-compatibility-factory'; +import { VersionCompatibilityService } from '../services/version-compatibility.service'; @NgModule({ imports: [ @@ -52,6 +54,12 @@ import { DirectionalityConfigService } from '../services/directionality-config.s useFactory: directionalityConfigFactory, deps: [ DirectionalityConfigService ], multi: true + }, + { + provide: APP_INITIALIZER, + useFactory: versionCompatibilityFactory, + deps: [ VersionCompatibilityService ], + multi: true } ], exports: [ diff --git a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts index 6c8c479eca..f09d547d58 100644 --- a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts @@ -17,7 +17,7 @@ import { TestBed } from '@angular/core/testing'; import { throwError } from 'rxjs'; -import { setupTestBed, CoreModule, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; +import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core'; import { HttpErrorResponse } from '@angular/common/http'; import { AppsProcessCloudService } from './apps-process-cloud.service'; import { fakeApplicationInstance } from '../mock/app-model.mock'; @@ -40,7 +40,7 @@ describe('AppsProcessCloudService', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreModule.forRoot(), + CoreTestingModule, ProcessServiceCloudTestingModule ] }); diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts index e39ffb14fb..5952998987 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts @@ -29,7 +29,8 @@ import { FormOutcomeModel, setupTestBed, TRANSLATION_PROVIDER, - WidgetVisibilityService + WidgetVisibilityService, + VersionCompatibilityService } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { FormCloudService } from '../services/form-cloud.service'; @@ -68,7 +69,7 @@ describe('FormCloudComponent', () => { exports: [CustomWidget], entryComponents: [CustomWidget] }) - class CustomUploadModule {} + class CustomUploadModule { } function buildWidget(type: string, injector: Injector): any { const resolver = formRenderingService.getComponentTypeResolver(type); @@ -97,6 +98,10 @@ describe('FormCloudComponent', () => { name: 'app', source: 'resources' } + }, + { + provide: VersionCompatibilityService, + useValue: {} } ] }); @@ -116,7 +121,7 @@ describe('FormCloudComponent', () => { fixture = TestBed.createComponent(FormCloudComponent); formComponent = fixture.componentInstance; fixture.detectChanges(); - })); + })); it('should register custom [upload] widget', () => { const widget = buildWidget('upload', fixture.componentRef.injector); @@ -190,7 +195,7 @@ describe('FormCloudComponent', () => { expect(formComponent.showTitle).toBeTruthy(); expect(formComponent.isTitleEnabled()).toBeTruthy(); - }); + }); it('should not allow title if showTitle is false', () => { const formModel = new FormModel(); @@ -370,7 +375,7 @@ describe('FormCloudComponent', () => { spyOn(formCloudService, 'getTaskForm').and.returnValue(of(cloudFormMock)); spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([])); spyOn(formCloudService, 'getProcessStorageFolderTask') - .and.returnValue( of({nodeId : '123', path: '/a/path/type', type: 'fakeType'})); + .and.returnValue(of({ nodeId: '123', path: '/a/path/type', type: 'fakeType' })); const taskId = ''; const appName = 'test-app'; formComponent.appName = appName; @@ -389,7 +394,7 @@ describe('FormCloudComponent', () => { spyOn(formCloudService, 'getTaskForm').and.returnValue(of(cloudFormMock)); spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([])); spyOn(formCloudService, 'getProcessStorageFolderTask') - .and.returnValue( of({nodeId : '123', path: '/a/path/type', type: 'fakeType'})); + .and.returnValue(of({ nodeId: '123', path: '/a/path/type', type: 'fakeType' })); const taskId = ''; const processInstanceId = 'i-am-the-process-instance-id'; const appName = 'test-app'; @@ -947,7 +952,7 @@ describe('FormCloudComponent', () => { }); formComponent.ngOnChanges({ 'data': change }); - }); + }); it('should refresh radio buttons value when id is given to data', () => { formComponent.form = new FormModel(JSON.parse(JSON.stringify(cloudFormMock))); @@ -990,7 +995,7 @@ describe('FormCloudComponent', () => { }); describe('Multilingual Form', () => { - it('should translate form labels on language change', async () => { + it('should translate form labels on language change', async () => { spyOn(formCloudService, 'getForm').and.returnValue(of(multilingualForm)); const formId = '123'; const appName = 'test-app'; diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts index 08e0230d0f..3bae182fec 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts @@ -27,7 +27,7 @@ import { IdentityGroupService, mockIdentityGroups, AlfrescoApiService, - CoreModule + CoreTestingModule } from '@alfresco/adf-core'; import { SimpleChange } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @@ -53,7 +53,7 @@ describe('GroupCloudComponent', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreModule.forRoot(), + CoreTestingModule, ProcessServiceCloudTestingModule, GroupCloudModule ] diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts index c82333c1d6..25ae59e0a2 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts @@ -20,9 +20,9 @@ import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { IdentityUserService, AlfrescoApiService, - CoreModule, setupTestBed, - IdentityUserModel + IdentityUserModel, + CoreTestingModule } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { of } from 'rxjs'; @@ -58,7 +58,7 @@ describe('PeopleCloudComponent', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreModule.forRoot(), + CoreTestingModule, ProcessServiceCloudTestingModule, PeopleCloudModule ] diff --git a/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts index cee1f20d60..e218ae3fd2 100644 --- a/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/content-widget/attach-file-widget-dialog.component.spec.ts @@ -21,7 +21,7 @@ import { ContentModule, ContentNodeSelectorPanelComponent } from '@alfresco/adf- import { EventEmitter } from '@angular/core'; import { ProcessTestingModule } from '../testing/process.testing.module'; import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component'; -import { setupTestBed, AuthenticationService, SitesService, CoreModule } from '@alfresco/adf-core'; +import { setupTestBed, AuthenticationService, SitesService } from '@alfresco/adf-core'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; import { of } from 'rxjs'; import { By } from '@angular/platform-browser'; @@ -47,7 +47,6 @@ describe('AttachFileWidgetDialogComponent', () => { setupTestBed({ imports: [ TranslateModule.forRoot(), - CoreModule.forRoot(), ProcessTestingModule, ContentModule.forRoot() ], @@ -73,6 +72,7 @@ describe('AttachFileWidgetDialogComponent', () => { }); it('should be able to create the widget', () => { + fixture.detectChanges(); expect(widget).not.toBeNull(); });