Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike: run Standalone migration #19212

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 0 additions & 15 deletions feature-libs/asm/asm.module.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
} from './asm-bind-cart-dialog.component';

@Pipe({
name: 'cxTranslate',
name: 'cxTranslate',
standalone: true,
})
class MockTranslatePipe implements PipeTransform {
transform(): any {}
Expand All @@ -26,15 +27,13 @@ describe('AsmBindCartDialogComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AsmBindCartDialogComponent,
imports: [AsmBindCartDialogComponent,
MockTranslatePipe,
FocusDirective,
],
providers: [
FocusDirective,],
providers: [
{ provide: LaunchDialogService, useClass: MockLaunchDialogService },
],
}).compileComponents();
],
}).compileComponents();
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export enum BIND_CART_DIALOG_ACTION {
}

@Component({
selector: 'cx-asm-bind-cart-dialog',
templateUrl: './asm-bind-cart-dialog.component.html',
selector: 'cx-asm-bind-cart-dialog',
templateUrl: './asm-bind-cart-dialog.component.html',
standalone: true,
})
export class AsmBindCartDialogComponent {
BIND_CART_ACTION = BIND_CART_DIALOG_ACTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ import { AsmBindCartComponent } from './asm-bind-cart.component';
import createSpy = jasmine.createSpy;

@Component({
selector: 'cx-icon',
template: '',
selector: 'cx-icon',
template: '',
standalone: true,
imports: [FormsModule, ReactiveFormsModule],
})
class MockCxIconComponent {
@Input() type: ICON_TYPE;
Expand Down Expand Up @@ -84,7 +86,8 @@ class MockActiveCartService implements Partial<ActiveCartFacade> {
}

@Pipe({
name: 'cxTranslate',
name: 'cxTranslate',
standalone: true,
})
class MockTranslatePipe implements PipeTransform {
transform(): any {}
Expand Down Expand Up @@ -163,14 +166,11 @@ describe('AsmBindCartComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FormsModule, ReactiveFormsModule],
declarations: [
AsmBindCartComponent,
MockTranslatePipe,
imports: [FormsModule, ReactiveFormsModule, MockTranslatePipe,
MockCxIconComponent,
DotSpinnerComponent,
],
providers: [
DotSpinnerComponent],
declarations: [AsmBindCartComponent],
providers: [
{ provide: AuthService, useClass: MockAuthService },
{ provide: CsAgentAuthService, useClass: MockCsAgentAuthService },
{ provide: ActiveCartFacade, useClass: MockActiveCartService },
Expand All @@ -181,8 +181,8 @@ describe('AsmBindCartComponent', () => {
{ provide: SavedCartFacade, useClass: MockSavedCartFacade },
{ provide: RoutingService, useClass: MockRoutingService },
{ provide: AsmComponentService, useClass: MockAsmComponentService },
],
}).compileComponents();
],
}).compileComponents();
});

beforeEach(() => {
Expand Down
114 changes: 56 additions & 58 deletions feature-libs/asm/components/asm-components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,63 +47,61 @@ import { defaultSwitchCustomerLayoutConfig } from './default-switch-customer-lay
import { DotSpinnerComponent } from './dot-spinner/dot-spinner.component';

@NgModule({
imports: [
CommonModule,
ReactiveFormsModule,
I18nModule,
FormErrorsModule,
IconModule,
NgSelectModule,
FormsModule,
SpinnerModule,
PasswordVisibilityToggleModule,
KeyboardFocusModule,
NgSelectA11yModule,
SortingModule,
PaginationModule,
MessageComponentModule,
FeaturesConfigModule,
],
declarations: [
AsmBindCartDialogComponent,
AsmSaveCartDialogComponent,
AsmMainUiComponent,
CSAgentLoginFormComponent,
CustomerListComponent,
CustomerSelectionComponent,
AsmSessionTimerComponent,
FormatTimerPipe,
CustomerEmulationComponent,
AsmToggleUiComponent,
AsmBindCartComponent,
AsmSwitchCustomerDialogComponent,
DotSpinnerComponent,
AsmCreateCustomerFormComponent,
],
exports: [
AsmBindCartDialogComponent,
AsmSaveCartDialogComponent,
AsmMainUiComponent,
CSAgentLoginFormComponent,
CustomerListComponent,
CustomerSelectionComponent,
AsmSessionTimerComponent,
FormatTimerPipe,
CustomerEmulationComponent,
AsmToggleUiComponent,
AsmBindCartComponent,
AsmSwitchCustomerDialogComponent,
DotSpinnerComponent,
AsmCreateCustomerFormComponent,
],
providers: [
provideDefaultConfig(defaultAsmLayoutConfig),
provideDefaultConfig(defaultBindCartLayoutConfig),
provideDefaultConfig(defaultSaveCartLayoutConfig),
provideDefaultConfig(defaultSwitchCustomerLayoutConfig),
provideDefaultConfig(defaultCustomerListLayoutConfig),
provideDefaultConfig(defaultAsmPaginationConfig),
provideDefaultConfig(defaultAsmCreateCustomerFormLayoutConfig),
],
imports: [
CommonModule,
ReactiveFormsModule,
I18nModule,
FormErrorsModule,
IconModule,
NgSelectModule,
FormsModule,
SpinnerModule,
PasswordVisibilityToggleModule,
KeyboardFocusModule,
NgSelectA11yModule,
SortingModule,
PaginationModule,
MessageComponentModule,
FeaturesConfigModule,
AsmBindCartDialogComponent,
AsmSaveCartDialogComponent,
AsmMainUiComponent,
CSAgentLoginFormComponent,
CustomerListComponent,
CustomerSelectionComponent,
AsmSessionTimerComponent,
FormatTimerPipe,
CustomerEmulationComponent,
AsmToggleUiComponent,
AsmBindCartComponent,
AsmSwitchCustomerDialogComponent,
DotSpinnerComponent,
AsmCreateCustomerFormComponent,
],
exports: [
AsmBindCartDialogComponent,
AsmSaveCartDialogComponent,
AsmMainUiComponent,
CSAgentLoginFormComponent,
CustomerListComponent,
CustomerSelectionComponent,
AsmSessionTimerComponent,
FormatTimerPipe,
CustomerEmulationComponent,
AsmToggleUiComponent,
AsmBindCartComponent,
AsmSwitchCustomerDialogComponent,
DotSpinnerComponent,
AsmCreateCustomerFormComponent,
],
providers: [
provideDefaultConfig(defaultAsmLayoutConfig),
provideDefaultConfig(defaultBindCartLayoutConfig),
provideDefaultConfig(defaultSaveCartLayoutConfig),
provideDefaultConfig(defaultSwitchCustomerLayoutConfig),
provideDefaultConfig(defaultCustomerListLayoutConfig),
provideDefaultConfig(defaultAsmPaginationConfig),
provideDefaultConfig(defaultAsmCreateCustomerFormLayoutConfig),
],
})
export class AsmComponentsModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ const duplicatedUidErrorResponse: HttpErrorModel = {
};

@Component({
selector: 'cx-icon',
template: '',
selector: 'cx-icon',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockCxIconComponent {
@Input() type: ICON_TYPE;
Expand All @@ -98,7 +100,8 @@ class MockAsmCreateCustomerFacade implements Partial<AsmCreateCustomerFacade> {
}

@Directive({
selector: '[cxFocus]',
selector: '[cxFocus]',
standalone: true,
})
export class MockKeyboadFocusDirective {
@Input('cxFocus') config: FocusConfig = {};
Expand All @@ -113,21 +116,18 @@ describe('AsmCreateCustomerFormComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [I18nTestingModule],
declarations: [
AsmCreateCustomerFormComponent,
MockCxIconComponent,
MockKeyboadFocusDirective,
],
providers: [
imports: [I18nTestingModule, MockCxIconComponent,
MockKeyboadFocusDirective],
declarations: [AsmCreateCustomerFormComponent],
providers: [
{ provide: LaunchDialogService, useClass: MockLaunchDialogService },
{
provide: AsmCreateCustomerFacade,
useClass: MockAsmCreateCustomerFacade,
provide: AsmCreateCustomerFacade,
useClass: MockAsmCreateCustomerFacade,
},
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
}).compileComponents();
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
}).compileComponents();

launchDialogService = TestBed.inject(LaunchDialogService);
asmCreateCustomerFacade = TestBed.inject(AsmCreateCustomerFacade);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class MockAuthService implements Partial<AuthService> {
}

@Component({
selector: 'cx-icon',
template: '',
selector: 'cx-icon',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockCxIconComponent {
@Input() type: ICON_TYPE;
Expand Down Expand Up @@ -101,28 +103,36 @@ class MockLaunchDialogService implements Partial<LaunchDialogService> {
}

@Component({
selector: 'cx-asm-toggle-ui',
template: '',
selector: 'cx-asm-toggle-ui',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockAsmToggleUiComponent {}

@Component({
selector: 'cx-asm-session-timer',
template: '',
selector: 'cx-asm-session-timer',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockAsmSessionTimerComponent {}

@Component({
selector: 'cx-customer-selection',
template: '',
selector: 'cx-customer-selection',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockCustomerSelectionComponent {
@Output()
submitEvent = new EventEmitter();
}
@Component({
selector: 'cx-csagent-login-form',
template: '',
selector: 'cx-csagent-login-form',
template: '',
standalone: true,
imports: [I18nTestingModule],
})
class MockCSAgentLoginFormComponent {
@Output()
Expand All @@ -131,8 +141,10 @@ class MockCSAgentLoginFormComponent {
csAgentTokenLoading = false;
}
@Component({
template: '',
selector: 'cx-customer-emulation',
template: '',
selector: 'cx-customer-emulation',
standalone: true,
imports: [I18nTestingModule],
})
class MockCustomerEmulationComponent {}

Expand Down Expand Up @@ -181,17 +193,14 @@ describe('AsmMainUiComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [I18nTestingModule],
declarations: [
AsmMainUiComponent,
MockAsmToggleUiComponent,
imports: [I18nTestingModule, MockAsmToggleUiComponent,
MockCSAgentLoginFormComponent,
MockCustomerSelectionComponent,
MockAsmSessionTimerComponent,
MockCustomerEmulationComponent,
MockCxIconComponent,
],
providers: [
MockCxIconComponent],
declarations: [AsmMainUiComponent],
providers: [
{ provide: AuthService, useClass: MockAuthService },
{ provide: CsAgentAuthService, useClass: MockCsAgentAuthService },
{ provide: UserAccountFacade, useClass: MockUserAccountFacade },
Expand All @@ -200,8 +209,8 @@ describe('AsmMainUiComponent', () => {
{ provide: AsmComponentService, useClass: MockAsmComponentService },
{ provide: AsmService, useClass: MockAsmService },
{ provide: LaunchDialogService, useClass: MockLaunchDialogService },
],
}).compileComponents();
],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
Loading
Loading