Rebased ADF Migration PR

This commit is contained in:
Vito Albano
2024-04-22 13:54:47 +01:00
committed by VitoAlbano
parent 1579b4a527
commit b3b2280882
14 changed files with 141 additions and 165 deletions

View File

@@ -18,6 +18,9 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutGithubLinkComponent } from './about-github-link.component';
import { aboutGithubDetails } from '../about.mock';
import { TranslateModule } from '@ngx-translate/core';
import { TranslationService } from '../../translation';
import { TranslationMock } from '../../mock';
describe('AboutGithubLinkComponent', () => {
let fixture: ComponentFixture<AboutGithubLinkComponent>;
@@ -25,7 +28,8 @@ describe('AboutGithubLinkComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule]
imports: [TranslateModule.forRoot()],
providers: [{ provide: TranslationService, useClass: TranslationMock }]
});
fixture = TestBed.createComponent(AboutGithubLinkComponent);
component = fixture.componentInstance;

View File

@@ -18,6 +18,7 @@
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { MaterialModule } from '../material.module';
import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
@Component({
selector: 'adf-custom-container',

View File

@@ -23,12 +23,13 @@ import { By } from '@angular/platform-browser';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatChipHarness, MatChipListboxHarness} from '@angular/material/chips/testing';
import { MatChipHarness, MatChipListboxHarness } from '@angular/material/chips/testing';
import { MatButtonHarness } from '@angular/material/button/testing';
import { MatIconHarness } from '@angular/material/icon/testing';
import { MatChipsModule } from '@angular/material/chips';
import { MatMenuModule } from '@angular/material/menu';
import { MatButtonModule } from '@angular/material/button';
import { TranslateModule } from '@ngx-translate/core';
describe('CardViewArrayItemComponent', () => {
let loader: HarnessLoader;

View File

@@ -28,6 +28,7 @@ import { MatFormFieldHarness } from '@angular/material/form-field/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatSelectModule } from '@angular/material/select';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core';
describe('CardViewSelectItemComponent', () => {
let loader: HarnessLoader;

View File

@@ -1,9 +1,16 @@
<div [ngSwitch]="templateType">
<div *ngSwitchDefault>
<mat-form-field subscriptSizing="dynamic" class="adf-property-field adf-card-textitem-field"
[ngClass]="{'adf-property-read-only': !isEditable }"
[floatLabel]="'always'">
<mat-label *ngIf="showProperty || isEditable" [attr.data-automation-id]="'card-textitem-label-' + property.key" class="adf-property-label"
<mat-form-field
class="adf-property-field adf-card-textitem-field"
[ngClass]="{
'adf-property-read-only': !isEditable
}"
[floatLabel]="'always'"
>
<mat-label
*ngIf="showProperty || isEditable"
[attr.data-automation-id]="'card-textitem-label-' + property.key"
class="adf-property-label"
[ngClass]="{
'adf-property-value-editable': editable,
'adf-property-readonly-value': isReadonlyProperty
@@ -37,9 +44,9 @@
*ngIf="property.multiline"
title="{{ property.label | translate }}"
[cdkTextareaAutosize]="true"
[cdkAutosizeMaxRows]="1"
[cdkAutosizeMaxRows]="5"
class="adf-property-value"
cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"
[ngClass]="{
'adf-property-value-editable': editable,
'adf-property-readonly-value': isReadonlyProperty
@@ -66,21 +73,20 @@
>
{{ property.label | translate }}
</mat-label>
<mat-chip-grid #chipList
class="adf-textitem-chip-list">
<mat-chip-row *ngFor="let propertyValue of editedValue; let idx = index"
[removable]="isEditable"
(removed)="removeValueFromList(idx)">
<mat-chip-grid #chipList class="adf-textitem-chip-list">
<mat-chip-row *ngFor="let propertyValue of editedValue; let idx = index" [removable]="isEditable" (removed)="removeValueFromList(idx)">
{{ propertyValue }}
<mat-icon *ngIf="isEditable"
matChipRemove>cancel</mat-icon>
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
</mat-chip-row>
</mat-chip-grid>
<mat-form-field subscriptSizing="dynamic" [hidden]="!isEditable"
<mat-form-field
*ngIf="isEditable"
class="adf-property-field adf-textitem-chip-list-input"
[ngClass]="{ 'adf-property-read-only': !isEditable }">
<input matInput
[ngClass]="{ 'adf-property-read-only': !isEditable }"
>
<input
matInput
class="adf-property-value"
[ngClass]="{
'adf-property-value-editable': editable,
@@ -103,9 +109,16 @@
class="adf-textitem-clickable"
[ngClass]="{ 'adf-property-read-only': !isEditable }"
[attr.data-automation-id]="'card-textitem-toggle-' + property.key"
(click)="clicked()">
<mat-form-field subscriptSizing="dynamic" class="adf-property-field adf-card-textitem-field">
<mat-label *ngIf="showProperty || isEditable" [attr.data-automation-id]="'card-textitem-label-' + property.key" class="adf-property-label">
tabindex="0"
(keyup.enter)="clicked()"
(click)="clicked()"
>
<mat-form-field class="adf-property-field adf-card-textitem-field">
<mat-label
*ngIf="showProperty || isEditable"
[attr.data-automation-id]="'card-textitem-label-' + property.key"
class="adf-property-label"
>
{{ property.label | translate }}
</mat-label>
<input

View File

@@ -34,6 +34,7 @@ import { MatChipGridHarness, MatChipHarness } from '@angular/material/chips/test
import { MatInputHarness } from '@angular/material/input/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { TranslateModule } from '@ngx-translate/core';
import { TranslationService } from '../../../translation';
import { TranslationMock } from '../../../mock';
import { MatTooltipModule } from '@angular/material/tooltip';