[AAE-0000] - migration to ng19 with standalone schematics

This commit is contained in:
VitoAlbano
2025-05-17 00:03:00 +01:00
parent 9c6a1901c6
commit 41a1948996
33 changed files with 7396 additions and 18364 deletions

View File

@@ -27,7 +27,8 @@ import { UnitTestingUtils } from '../../../../src/lib/testing/unit-testing-utils
<div>
<div id="underFeatureFlag" *adfForFeatures="features"></div>
</div>
`
`,
imports: [CommonModule, FeaturesDirective]
})
class TestWithEnabledFlagComponent {
features = 'feature1';
@@ -37,7 +38,8 @@ class TestWithEnabledFlagComponent {
<div>
<div id="underFeatureFlag" *adfForFeatures="features"></div>
</div>
`
`,
imports: [CommonModule, FeaturesDirective]
})
class TestWithDisabledFlagComponent {
features = ['feature1', 'feature2'];
@@ -50,7 +52,7 @@ describe('FeaturesDirective', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
imports: [CommonModule, FeaturesDirective],
imports: [CommonModule, FeaturesDirective, TestWithEnabledFlagComponent, TestWithDisabledFlagComponent],
providers: [
provideMockFeatureFlags({
feature1: true,
@@ -58,8 +60,7 @@ describe('FeaturesDirective', () => {
feature3: true
}),
FeaturesDirective
],
declarations: [TestWithEnabledFlagComponent, TestWithDisabledFlagComponent]
]
});
enabledFixture = TestBed.createComponent(TestWithEnabledFlagComponent);
enabledFixture.detectChanges();

View File

@@ -27,7 +27,8 @@ import { UnitTestingUtils } from '../../../../src/lib/testing/unit-testing-utils
<div>
<div id="underFeatureFlag" *adfNotForFeatures="features"></div>
</div>
`
`,
imports: [CommonModule, NotFeaturesDirective]
})
class TestWithEnabledFlagComponent {
features = ['feature1', 'feature3'];
@@ -38,7 +39,8 @@ class TestWithEnabledFlagComponent {
<div>
<div id="underFeatureFlag" *adfNotForFeatures="features"></div>
</div>
`
`,
imports: [CommonModule, NotFeaturesDirective]
})
class TestWithDisabledFlagComponent {
features = 'feature2';
@@ -51,7 +53,7 @@ describe('NotFeaturesDirective', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
imports: [CommonModule, NotFeaturesDirective],
imports: [CommonModule, NotFeaturesDirective, TestWithEnabledFlagComponent, TestWithDisabledFlagComponent],
providers: [
provideMockFeatureFlags({
feature1: true,
@@ -59,8 +61,7 @@ describe('NotFeaturesDirective', () => {
feature3: true
}),
NotFeaturesDirective
],
declarations: [TestWithEnabledFlagComponent, TestWithDisabledFlagComponent]
]
});
enabledFixture = TestBed.createComponent(TestWithEnabledFlagComponent);
enabledFixture.detectChanges();

View File

@@ -51,8 +51,7 @@ export function oauthStorageFactory(): OAuthStorage {
}
@NgModule({
declarations: [AuthenticationConfirmationComponent],
imports: [AuthRoutingModule, OAuthModule.forRoot()],
imports: [AuthRoutingModule, OAuthModule.forRoot(), AuthenticationConfirmationComponent],
providers: [
{ provide: OAuthStorage, useFactory: oauthStorageFactory },
{ provide: AuthenticationService },

View File

@@ -31,7 +31,8 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
<button mat-button clipboard-notification="copy success" [adf-clipboard] [target]="ref">copy</button>
<input #ref />
`
`,
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective]
})
class TestTargetClipboardComponent {}
@@ -43,8 +44,7 @@ describe('ClipboardDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective],
declarations: [TestTargetClipboardComponent]
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective, TestTargetClipboardComponent]
});
fixture = TestBed.createComponent(TestTargetClipboardComponent);
clipboardService = TestBed.inject(ClipboardService);
@@ -73,7 +73,8 @@ describe('ClipboardDirective', () => {
describe('CopyClipboardDirective', () => {
@Component({
selector: 'adf-copy-conent-test-component',
template: `<span adf-clipboard="placeholder">{{ mockText }}</span>`
template: `<span adf-clipboard="placeholder">{{ mockText }}</span>`,
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective]
})
class TestCopyClipboardComponent {
mockText = 'text to copy';
@@ -88,8 +89,7 @@ describe('CopyClipboardDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective],
declarations: [TestCopyClipboardComponent]
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective, TestCopyClipboardComponent]
});
fixture = TestBed.createComponent(TestCopyClipboardComponent);
testingUtils = new UnitTestingUtils(fixture.debugElement);

View File

@@ -25,7 +25,8 @@ import { LogService } from './log.service';
@Component({
template: '',
providers: [LogService]
providers: [LogService],
imports: [HttpClientModule]
})
class ProvidesLogComponent {
constructor(public logService: LogService) {}
@@ -61,8 +62,7 @@ describe('LogService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
declarations: [ProvidesLogComponent],
imports: [HttpClientModule, ProvidesLogComponent],
providers: [LogService, AppConfigService]
});
appConfigService = TestBed.inject(AppConfigService);

View File

@@ -25,7 +25,8 @@ import { UnitTestingUtils } from '../testing/unit-testing-utils';
@Component({
selector: 'adf-test-component',
template: ` <div id="target" [adf-context-menu]="actions" [adf-context-menu-enabled]="isEnabled"></div> `
template: ` <div id="target" [adf-context-menu]="actions" [adf-context-menu-enabled]="isEnabled"></div> `,
imports: [CoreTestingModule, CONTEXT_MENU_DIRECTIVES]
})
class TestComponent {
actions: any[] | (() => any[]);
@@ -118,8 +119,7 @@ testCases.forEach((testCase) => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, CONTEXT_MENU_DIRECTIVES],
declarations: [TestComponent]
imports: [CoreTestingModule, CONTEXT_MENU_DIRECTIVES, TestComponent]
});
fixture = TestBed.createComponent(TestComponent);
fixture.componentInstance.isEnabled = false;

View File

@@ -23,8 +23,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';
@NgModule({
declarations: [ConfirmDialogComponent],
imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, MatDialogModule, MatButtonModule],
imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, MatDialogModule, MatButtonModule, ConfirmDialogComponent],
exports: [ConfirmDialogComponent]
})
export class ConfirmDialogModule {}

View File

@@ -25,7 +25,8 @@ import { Component, inject } from '@angular/core';
import { Subject } from 'rxjs';
@Component({
selector: 'adf-dummy-component'
selector: 'adf-dummy-component',
imports: [CoreTestingModule]
})
class DummyComponent {
data = inject(DIALOG_COMPONENT_DATA);
@@ -55,8 +56,7 @@ describe('DialogComponent', () => {
const setupBeforeEach = (dialogOptions: DialogData = data) => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
declarations: [DummyComponent],
imports: [CoreTestingModule, DummyComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
{ provide: MatDialogRef, useValue: dialogRef }

View File

@@ -23,8 +23,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';
@NgModule({
declarations: [EditJsonDialogComponent],
imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, MatDialogModule, MatButtonModule],
imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, MatDialogModule, MatButtonModule, EditJsonDialogComponent],
exports: [EditJsonDialogComponent]
})
export class EditJsonDialogModule {}

View File

@@ -29,7 +29,8 @@ import { UnitTestingUtils } from '../testing/unit-testing-utils';
<mat-option *ngFor="let option of options; let idx = index">
{{ option.text }}
</mat-option>
</mat-select>`
</mat-select>`,
imports: [MatSelectModule, InfiniteSelectScrollDirective]
})
class TestComponent {
options = new Array(50).fill({ text: 'dummy' });
@@ -54,8 +55,7 @@ describe('InfiniteSelectScrollDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatSelectModule, NoopAnimationsModule, InfiniteSelectScrollDirective],
declarations: [TestComponent]
imports: [MatSelectModule, NoopAnimationsModule, InfiniteSelectScrollDirective, TestComponent]
});
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;

View File

@@ -34,7 +34,8 @@ const IMAGE_URL = 'alfresco-logo.svg';
[width]="'400'"
[htmlContent]="'this is the <b>html</b> raw code'"
class="test-component"
></span>`
></span>`,
imports: [CommonModule, OverlayModule, TooltipCardDirective, TooltipCardComponent]
})
class TestComponent {
@ViewChild(TooltipCardDirective, { static: true })
@@ -52,8 +53,7 @@ describe('TooltipCardDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CommonModule, OverlayModule, NoopAnimationsModule, TooltipCardDirective, TooltipCardComponent],
declarations: [TestComponent]
imports: [CommonModule, OverlayModule, NoopAnimationsModule, TooltipCardDirective, TooltipCardComponent, TestComponent]
}).compileComponents();
});

View File

@@ -28,7 +28,8 @@ import { UnitTestingUtils } from '../../testing/unit-testing-utils';
@Component({
template: '',
providers: [NotificationService]
providers: [NotificationService],
imports: [NoopTranslateModule, MatSnackBarModule]
})
class ProvidesNotificationServiceComponent {
constructor(public notificationService: NotificationService) {}
@@ -92,8 +93,7 @@ describe('NotificationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopTranslateModule, NoopAnimationsModule, MatSnackBarModule],
declarations: [ProvidesNotificationServiceComponent]
imports: [NoopTranslateModule, NoopAnimationsModule, MatSnackBarModule, ProvidesNotificationServiceComponent]
});
translationService = TestBed.inject(TranslationService);
fixture = TestBed.createComponent(ProvidesNotificationServiceComponent);

View File

@@ -26,7 +26,8 @@ import { RequestPaginationModel } from '../models/request-pagination.model';
import { UnitTestingUtils } from '../testing/unit-testing-utils';
@Component({
template: ``
template: ``,
imports: [CoreTestingModule]
})
class TestPaginatedComponent implements PaginatedComponent {
private _pagination: BehaviorSubject<PaginationModel>;
@@ -58,8 +59,7 @@ describe('InfinitePaginationComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
declarations: [TestPaginatedComponent]
imports: [CoreTestingModule, TestPaginatedComponent]
});
fixture = TestBed.createComponent(InfinitePaginationComponent);
component = fixture.componentInstance;

View File

@@ -30,8 +30,7 @@ describe('SnackbarContentComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [SnackbarContentComponent],
imports: [NoopTranslateModule, CoreTestingModule],
imports: [NoopTranslateModule, CoreTestingModule, SnackbarContentComponent],
providers: [
{
provide: MatSnackBarRef,

View File

@@ -24,8 +24,7 @@ import { MatButtonModule } from '@angular/material/button';
import { TranslateModule } from '@ngx-translate/core';
@NgModule({
imports: [CommonModule, MatIconModule, MatSnackBarModule, MatButtonModule, TranslateModule],
declarations: [SnackbarContentComponent],
imports: [CommonModule, MatIconModule, MatSnackBarModule, MatButtonModule, TranslateModule, SnackbarContentComponent],
exports: [SnackbarContentComponent]
})
export class SnackbarContentModule {}