mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
Ng19 migration (#4520)
This commit is contained in:
committed by
GitHub
parent
bcbdff9543
commit
5f5c238ccd
@@ -40,7 +40,9 @@ import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-test',
|
||||
template: ''
|
||||
template: '',
|
||||
// eslint-disable-next-line
|
||||
standalone: false
|
||||
})
|
||||
class TestComponent extends PageComponent {
|
||||
node: any;
|
||||
@@ -199,7 +201,7 @@ describe('PageComponent', () => {
|
||||
} as NodeEntry;
|
||||
|
||||
component.showPreview(node);
|
||||
expect(store.dispatch).toHaveBeenCalledWith(new ViewNodeAction(node.entry.id));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(jasmine.objectContaining({ ...new ViewNodeAction(node.entry.id) }));
|
||||
});
|
||||
|
||||
it('should call ViewNodeAction on showPreview for `app:filelink` node type', () => {
|
||||
@@ -216,7 +218,7 @@ describe('PageComponent', () => {
|
||||
|
||||
component.showPreview(linkNode);
|
||||
const id = linkNode.entry.properties['cm:destination'];
|
||||
expect(store.dispatch).toHaveBeenCalledWith(new ViewNodeAction(id));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(jasmine.objectContaining({ ...new ViewNodeAction(id) }));
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -22,12 +22,11 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [MatIconModule, TranslateModule],
|
||||
selector: 'aca-generic-error',
|
||||
templateUrl: './generic-error.component.html',
|
||||
|
@@ -39,7 +39,6 @@ import { ContentService, NodesApiService } from '@alfresco/adf-content-services'
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatProgressBarModule, InfoDrawerModule, A11yModule, ToolbarComponent, DynamicTabComponent],
|
||||
selector: 'aca-info-drawer',
|
||||
templateUrl: './info-drawer.component.html',
|
||||
|
@@ -22,13 +22,12 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [TranslateModule, MatIconModule],
|
||||
selector: 'aca-locked-by',
|
||||
template: `
|
||||
|
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@@ -35,7 +35,6 @@ export interface OpenInAppDialogOptions {
|
||||
appStoreUrl: string;
|
||||
}
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatButtonModule, MatIconModule, A11yModule, MatDialogModule],
|
||||
selector: 'aca-open-in-app',
|
||||
templateUrl: './open-in-app.component.html',
|
||||
|
@@ -32,7 +32,6 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatButtonModule, MatIconModule],
|
||||
selector: 'aca-page-layout',
|
||||
templateUrl: './page-layout.component.html',
|
||||
|
@@ -30,7 +30,6 @@ import { CommonModule } from '@angular/common';
|
||||
import { ToolbarMenuComponent } from '../toolbar-menu/toolbar-menu.component';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, ToolbarButtonComponent, ToolbarMenuComponent, DynamicExtensionComponent],
|
||||
selector: 'aca-toolbar-action',
|
||||
templateUrl: './toolbar-action.component.html',
|
||||
|
@@ -40,7 +40,6 @@ export enum ToolbarButtonType {
|
||||
}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatButtonModule, IconModule, ToolbarMenuItemComponent],
|
||||
selector: 'app-toolbar-button',
|
||||
templateUrl: './toolbar-button.component.html',
|
||||
|
@@ -123,8 +123,9 @@ describe('ToolbarMenuItemComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const innerElement = testingUtils.getByDirective(DynamicExtensionComponent);
|
||||
innerElement.componentInstance.menuItem = new MatMenuItem(null, null, null, null, null);
|
||||
const menuItem = {} as MatMenuItem;
|
||||
innerElement.componentInstance.menuItem = menuItem;
|
||||
component.ngAfterViewInit();
|
||||
expect(component.menuItem).toBeInstanceOf(MatMenuItem);
|
||||
expect(component.menuItem).toEqual(menuItem);
|
||||
});
|
||||
});
|
||||
|
@@ -32,7 +32,6 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { IconComponent } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatMenuModule, MatDividerModule, IconComponent, DynamicExtensionComponent],
|
||||
selector: 'app-toolbar-menu-item',
|
||||
templateUrl: './toolbar-menu-item.component.html',
|
||||
|
@@ -33,7 +33,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { IconComponent } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, MatButtonModule, MatMenuModule, ToolbarMenuItemComponent, IconComponent, DynamicExtensionComponent],
|
||||
selector: 'app-toolbar-menu',
|
||||
templateUrl: './toolbar-menu.component.html',
|
||||
|
@@ -30,7 +30,6 @@ import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-toolbar',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ToolbarActionComponent, MatToolbarModule],
|
||||
templateUrl: './toolbar.component.html',
|
||||
styleUrls: ['./toolbar.component.scss'],
|
||||
|
@@ -26,7 +26,8 @@ import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { PluginEnabledGuard } from './plugin-enabled.guard';
|
||||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
|
||||
describe('PluginEnabledGuard', () => {
|
||||
let getSpy: jasmine.Spy<(key: string, defaultValue?: boolean) => boolean>;
|
||||
@@ -34,7 +35,8 @@ describe('PluginEnabledGuard', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule]
|
||||
imports: [],
|
||||
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
|
||||
});
|
||||
getSpy = spyOn(TestBed.inject(AppConfigService), 'get');
|
||||
route = new ActivatedRouteSnapshot();
|
||||
|
@@ -25,7 +25,7 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { initialState, LibTestingModule } from '../testing/lib-testing-module';
|
||||
import { AppExtensionService } from './app.extension.service';
|
||||
import { Action, Store } from '@ngrx/store';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import {
|
||||
ContentActionType,
|
||||
@@ -327,11 +327,13 @@ describe('AppExtensionService', () => {
|
||||
spyOn(store, 'dispatch').and.stub();
|
||||
|
||||
service.runActionById('aca:actions/create-folder');
|
||||
expect(store.dispatch).toHaveBeenCalledWith({
|
||||
type: 'CREATE_FOLDER',
|
||||
payload: 'folder-name',
|
||||
configuration: undefined
|
||||
} as Action);
|
||||
expect(store.dispatch).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
type: 'CREATE_FOLDER',
|
||||
payload: 'folder-name',
|
||||
configuration: undefined
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('should still invoke store if action is missing', () => {
|
||||
|
@@ -26,15 +26,15 @@ import { AppService } from './app.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
AuthenticationService,
|
||||
NotificationService,
|
||||
PageTitleService,
|
||||
StorageService,
|
||||
TranslationMock,
|
||||
TranslationService,
|
||||
UserPreferencesService,
|
||||
NotificationService,
|
||||
StorageService
|
||||
UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AlfrescoApiServiceMock,
|
||||
@@ -73,7 +73,7 @@ describe('AppService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CommonModule, HttpClientModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule],
|
||||
imports: [CommonModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule],
|
||||
providers: [
|
||||
SearchQueryBuilderService,
|
||||
provideMockStore({}),
|
||||
@@ -121,7 +121,8 @@ describe('AppService', () => {
|
||||
setStoragePrefix: () => null,
|
||||
getPropertyKey: (property: string) => `prefix__${property}`
|
||||
}
|
||||
}
|
||||
},
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
]
|
||||
});
|
||||
|
||||
|
@@ -27,7 +27,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
@@ -93,10 +93,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
exports: [TranslateModule],
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
CommonModule,
|
||||
HttpClientModule,
|
||||
RouterTestingModule,
|
||||
MatIconTestingModule,
|
||||
StoreModule,
|
||||
@@ -119,10 +119,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
|
||||
}
|
||||
})
|
||||
],
|
||||
exports: [TranslateModule],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
]
|
||||
})
|
||||
export class LibTestingModule {}
|
||||
|
Reference in New Issue
Block a user