mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Rebased ADF Migration PR
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<button mat-icon-button class="adf-facet-search-icon" tabindex="-1">
|
<button mat-icon-button class="adf-facet-search-icon" tabindex="-1">
|
||||||
<mat-icon class="adf-search-field-icon">search</mat-icon>
|
<mat-icon class="adf-search-field-icon">search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-form-field class="adf-facet-search-field" floatLabel="never">
|
<mat-form-field class="adf-facet-search-field" >
|
||||||
<input
|
<input
|
||||||
matInput
|
matInput
|
||||||
placeholder="{{ 'SEARCH.FILTER.ACTIONS.SEARCH' | translate }}"
|
placeholder="{{ 'SEARCH.FILTER.ACTIONS.SEARCH' | translate }}"
|
||||||
|
@@ -73,7 +73,7 @@
|
|||||||
>
|
>
|
||||||
{{ property.label | translate }}
|
{{ property.label | translate }}
|
||||||
</mat-label>
|
</mat-label>
|
||||||
<mat-chip-grid #chipList class="adf-textitem-chip-list">
|
<mat-chip-grid #chipElement class="adf-textitem-chip-list">
|
||||||
<mat-chip-row *ngFor="let propertyValue of editedValue; let idx = index" [removable]="isEditable" (removed)="removeValueFromList(idx)">
|
<mat-chip-row *ngFor="let propertyValue of editedValue; let idx = index" [removable]="isEditable" (removed)="removeValueFromList(idx)">
|
||||||
{{ propertyValue }}
|
{{ propertyValue }}
|
||||||
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
|
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
title="{{ property.label | translate }}"
|
title="{{ property.label | translate }}"
|
||||||
[placeholder]="editedValue ? '' : (property.default | translate)"
|
[placeholder]="editedValue ? '' : (property.default | translate)"
|
||||||
[attr.aria-label]="property.label | translate"
|
[attr.aria-label]="property.label | translate"
|
||||||
[matChipInputFor]="chipList"
|
[matChipInputFor]="chipElement"
|
||||||
[matChipInputAddOnBlur]="true"
|
[matChipInputAddOnBlur]="true"
|
||||||
(matChipInputTokenEnd)="addValueToList($event)"
|
(matChipInputTokenEnd)="addValueToList($event)"
|
||||||
[attr.data-automation-id]="'card-textitem-editchipinput-' + property.key"
|
[attr.data-automation-id]="'card-textitem-editchipinput-' + property.key"
|
||||||
|
@@ -20,6 +20,7 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||||
|
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||||
import { CardViewItemFloatValidator } from '../../validators/card-view-item-float.validator';
|
import { CardViewItemFloatValidator } from '../../validators/card-view-item-float.validator';
|
||||||
import { CardViewItemIntValidator } from '../../validators/card-view-item-int.validator';
|
import { CardViewItemIntValidator } from '../../validators/card-view-item-int.validator';
|
||||||
import { CardViewIntItemModel } from '../../models/card-view-intitem.model';
|
import { CardViewIntItemModel } from '../../models/card-view-intitem.model';
|
||||||
@@ -30,15 +31,8 @@ import { DebugElement, SimpleChange } from '@angular/core';
|
|||||||
import { CardViewItemValidator } from '../../interfaces/card-view-item-validator.interface';
|
import { CardViewItemValidator } from '../../interfaces/card-view-item-validator.interface';
|
||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatChipGridHarness, MatChipHarness } from '@angular/material/chips/testing';
|
import { MatChipHarness, MatChipGridHarness } from '@angular/material/chips/testing';
|
||||||
import { MatInputHarness } from '@angular/material/input/testing';
|
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';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
|
|
||||||
describe('CardViewTextItemComponent', () => {
|
describe('CardViewTextItemComponent', () => {
|
||||||
let loader: HarnessLoader;
|
let loader: HarnessLoader;
|
||||||
@@ -47,8 +41,9 @@ describe('CardViewTextItemComponent', () => {
|
|||||||
|
|
||||||
const expectedErrorMessages = [{ message: 'Something went wrong' } as CardViewItemValidator];
|
const expectedErrorMessages = [{ message: 'Something went wrong' } as CardViewItemValidator];
|
||||||
|
|
||||||
const getTextField = (key: string): HTMLInputElement =>
|
const getTextField = (key: string): HTMLInputElement => {
|
||||||
fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-value-${key}"]`)).nativeElement;
|
return fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-value-${key}"]`)).nativeElement;
|
||||||
|
};
|
||||||
|
|
||||||
const updateTextField = (key: string, value) => {
|
const updateTextField = (key: string, value) => {
|
||||||
const editInput = getTextField(key);
|
const editInput = getTextField(key);
|
||||||
@@ -63,8 +58,9 @@ describe('CardViewTextItemComponent', () => {
|
|||||||
return textItemInput.value;
|
return textItemInput.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getErrorElements = (key: string, includeItems = false): DebugElement[] =>
|
const getErrorElements = (key: string, includeItems = false): DebugElement[] => {
|
||||||
fixture.debugElement.queryAll(By.css(`[data-automation-id="card-textitem-error-${key}"]${includeItems ? ' li' : ''}`));
|
return fixture.debugElement.queryAll(By.css(`[data-automation-id="card-textitem-error-${key}"]${includeItems ? ' li' : ''}`));
|
||||||
|
};
|
||||||
|
|
||||||
const getTextFieldError = (key: string): string => {
|
const getTextFieldError = (key: string): string => {
|
||||||
const textItemInputErrors = getErrorElements(key, true);
|
const textItemInputErrors = getErrorElements(key, true);
|
||||||
@@ -116,8 +112,7 @@ describe('CardViewTextItemComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpClientTestingModule, NoopAnimationsModule, TranslateModule.forRoot(), MatSnackBarModule, MatTooltipModule, MatChipsModule],
|
imports: [CoreTestingModule, MatChipsModule]
|
||||||
providers: [{ provide: TranslationService, useClass: TranslationMock }]
|
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(CardViewTextItemComponent);
|
fixture = TestBed.createComponent(CardViewTextItemComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { AppConfigService } from '../../app-config/app-config.service';
|
import { AppConfigService } from '../../app-config/app-config.service';
|
||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
||||||
|
Reference in New Issue
Block a user