mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACS-7382] Standalone AdfConfigPipe pipe (#9558)
* standalone AdfConfigPipe * standalone AdfConfigPipe [ci:force]
This commit is contained in:
parent
43b950631c
commit
05884e829b
@ -17,7 +17,7 @@
|
||||
|
||||
import { EventEmitter } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppConfigModule, AppConfigService, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { UploadService } from './upload.service';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
@ -35,7 +35,7 @@ describe('UploadService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, AppConfigModule],
|
||||
imports: [CoreTestingModule],
|
||||
providers: [
|
||||
{
|
||||
provide: DiscoveryApiService,
|
||||
|
@ -25,22 +25,9 @@ import { CoreModule } from '@alfresco/adf-core';
|
||||
import { VersionManagerModule } from '../version-manager';
|
||||
import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
CoreModule,
|
||||
UploadModule,
|
||||
FormsModule,
|
||||
VersionManagerModule
|
||||
],
|
||||
declarations: [
|
||||
NewVersionUploaderDialogComponent
|
||||
],
|
||||
exports: [
|
||||
NewVersionUploaderDialogComponent,
|
||||
FormsModule
|
||||
]
|
||||
imports: [CommonModule, MaterialModule, CoreModule, UploadModule, FormsModule, VersionManagerModule],
|
||||
declarations: [NewVersionUploaderDialogComponent],
|
||||
exports: [NewVersionUploaderDialogComponent, FormsModule]
|
||||
})
|
||||
export class NewVersionUploaderModule { }
|
||||
export class NewVersionUploaderModule {}
|
||||
|
@ -15,20 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AppConfigPipe } from './app-config.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
HttpClientModule
|
||||
],
|
||||
declarations: [
|
||||
AppConfigPipe
|
||||
],
|
||||
exports: [
|
||||
AppConfigPipe
|
||||
]
|
||||
imports: [AppConfigPipe],
|
||||
exports: [AppConfigPipe]
|
||||
})
|
||||
export class AppConfigModule {
|
||||
}
|
||||
/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */
|
||||
export class AppConfigModule {}
|
||||
|
@ -19,7 +19,8 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
|
||||
@Pipe({
|
||||
name: 'adfAppConfig'
|
||||
name: 'adfAppConfig',
|
||||
standalone: true
|
||||
})
|
||||
export class AppConfigPipe implements PipeTransform {
|
||||
constructor(private config: AppConfigService) {}
|
||||
|
@ -18,21 +18,18 @@
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
import { AppConfigModule } from './app-config.module';
|
||||
import { ExtensionConfig, ExtensionService } from '@alfresco/adf-extensions';
|
||||
import { of } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
class TestExtensionService extends ExtensionService {
|
||||
|
||||
onSetup(config: ExtensionConfig) {
|
||||
this.onSetup$.next(config);
|
||||
}
|
||||
}
|
||||
|
||||
describe('AppConfigService', () => {
|
||||
|
||||
let appConfigService: AppConfigService;
|
||||
let extensionService: ExtensionService;
|
||||
let httpClient: HttpClient;
|
||||
@ -52,13 +49,8 @@ describe('AppConfigService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
AppConfigModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: ExtensionService, useClass: TestExtensionService }
|
||||
]
|
||||
imports: [HttpClientModule],
|
||||
providers: [{ provide: ExtensionService, useClass: TestExtensionService }]
|
||||
});
|
||||
});
|
||||
|
||||
@ -191,7 +183,7 @@ describe('AppConfigService', () => {
|
||||
|
||||
it('should execute callback function if is passed to the load method', async () => {
|
||||
const fakeCallBack = jasmine.createSpy('fakeCallBack');
|
||||
fakeCallBack.and.returnValue(()=>{});
|
||||
fakeCallBack.and.returnValue(() => {});
|
||||
|
||||
await appConfigService.load(fakeCallBack);
|
||||
|
||||
@ -212,6 +204,4 @@ describe('AppConfigService', () => {
|
||||
expect(appConfigService.get<any>('objectKey').secondUrl).toEqual('http://localhost:8080');
|
||||
expect(appConfigService.get<any>('objectKey').thirdUrl).toEqual('http://localhost:8080');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
@ -22,7 +22,6 @@ import { TranslateModule, TranslateLoader, TranslateStore, TranslateService } fr
|
||||
|
||||
import { MaterialModule } from './material.module';
|
||||
import { AboutModule } from './about/about.module';
|
||||
import { AppConfigModule } from './app-config/app-config.module';
|
||||
import { CardViewModule } from './card-view/card-view.module';
|
||||
import { ContextMenuModule } from './context-menu/context-menu.module';
|
||||
import { DataTableModule } from './datatable/datatable.module';
|
||||
@ -66,7 +65,7 @@ import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-facto
|
||||
import { AdfDateFnsAdapter } from './common/utils/date-fns-adapter';
|
||||
import { MomentDateAdapter } from './common/utils/moment-date-adapter';
|
||||
import { AdfDateTimeFnsAdapter } from './common/utils/datetime-fns-adapter';
|
||||
import { StoragePrefixFactory } from './app-config';
|
||||
import { AppConfigPipe, StoragePrefixFactory } from './app-config';
|
||||
import { UnsavedChangesDialogModule } from './dialogs';
|
||||
import { DynamicChipListModule } from './dynamic-chip-list';
|
||||
|
||||
@ -84,7 +83,7 @@ import { DynamicChipListModule } from './dynamic-chip-list';
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MaterialModule,
|
||||
AppConfigModule,
|
||||
AppConfigPipe,
|
||||
PaginationModule,
|
||||
ToolbarModule,
|
||||
ContextMenuModule,
|
||||
@ -123,7 +122,7 @@ import { DynamicChipListModule } from './dynamic-chip-list';
|
||||
IdentityUserInfoModule,
|
||||
ReactiveFormsModule,
|
||||
MaterialModule,
|
||||
AppConfigModule,
|
||||
AppConfigPipe,
|
||||
PaginationModule,
|
||||
ToolbarModule,
|
||||
ContextMenuModule,
|
||||
@ -162,12 +161,7 @@ export class CoreModule {
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: loadAppConfig,
|
||||
deps: [
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
AdfHttpClient,
|
||||
StoragePrefixFactory
|
||||
],
|
||||
deps: [AppConfigService, StorageService, AdfHttpClient, StoragePrefixFactory],
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
@ -187,7 +181,7 @@ export class CoreModule {
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: createAlfrescoApiInstance,
|
||||
deps: [ AlfrescoApiLoaderService ],
|
||||
deps: [AlfrescoApiLoaderService],
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user