[ACS-5645]Added edit functionality for each panel and updated test cases

This commit is contained in:
Yasa-Nataliya
2023-10-13 16:28:58 +05:30
committed by Anukriti Singh
parent ea1ae97144
commit 92fb997bb0
8 changed files with 27 additions and 10 deletions
@@ -17,7 +17,7 @@
<span
*ngFor="let category of categories"
[class.adf-categories-padded]="!isCRUDMode"
class="adf-assigned-categories">
class="adf-assigned-categories">
{{ category.name }}
<button
data-automation-id="categories-remove-category-button"
@@ -37,7 +37,7 @@
<div class="adf-existing-categories-panel" *ngIf="existingCategoriesPanelVisible">
<ng-container *ngIf="isCRUDMode && (!existingCategoriesLoading || existingCategories)">
<span class="adf-create-category-label"
(click)="addCategory()"
(click)="addCategory()"
[hidden]="categoryNameControl.invalid || typing">
{{ 'CATEGORIES_MANAGEMENT.GENERIC_CREATE' | translate : { name: categoryNameControl.value } }}
</span>
@@ -62,8 +62,8 @@
</mat-selection-list>
</ng-container>
<mat-spinner
*ngIf="existingCategoriesLoading"
[diameter]="50"
*ngIf="existingCategoriesLoading"
[diameter]="50"
[attr.aria-label]="'CATEGORIES_MANAGEMENT.LOADING' | translate">
</mat-spinner>
</div>
@@ -1,6 +1,5 @@
.adf-categories-management {
padding-top: 12px;
.adf-category-name-field {
display: flex;
justify-content: space-between;
@@ -324,7 +324,7 @@ describe('CategoriesManagementComponent', () => {
it('should have no required validator set for category control', () => {
expect(component.categoryNameControl.hasValidator(Validators.required)).toBeFalse();
});
it('should display validation error when searching for empty category', fakeAsync(() => {
typeCategory(' ');
@@ -228,6 +228,8 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
const newCat = new Category({ id: newCatName, name: newCatName });
this.categories.push(newCat);
this.clearCategoryNameInput();
this.categoryNameControl.setValue('');
this.categoryNameControl.markAsUntouched();
this._existingCategories = null;
this.categoriesChange.emit(this.categories);
}
@@ -22,6 +22,7 @@
width: 80px;
}
}
}
.mat-expansion-panel:not([class*='mat-elevation-z']) {
box-shadow: none;
@@ -100,7 +100,12 @@ describe('ContentMetadataComponent', () => {
const clickOnTagsSave = () => {
findSaveTagsButton().click();
fixture.detectChanges();
};
}
const clickOnTagsSave = () => {
findSaveTagsButton().click();
fixture.detectChanges();
}
const findTagsCreator = (): TagsCreatorComponent => fixture.debugElement.query(By.directive(TagsCreatorComponent))?.componentInstance;
@@ -808,7 +813,6 @@ describe('ContentMetadataComponent', () => {
describe('Display properties with aspect oriented config', () => {
let appConfig: AppConfigService;
let classesApi: ClassesApi;
let expectedNode: Node;
const verResponse: PropertyGroup = {
@@ -1149,6 +1153,7 @@ describe('ContentMetadataComponent', () => {
it('should render tags after loading tags in ngOnInit', () => {
spyOn(tagService, 'getTagsByNodeId').and.returnValue(of(tagPaging));
component.ngOnInit();
fixture.whenStable();
fixture.detectChanges();
const tagElements = findTagElements();
expect(tagElements).toHaveSize(2);
@@ -63,6 +63,16 @@ adf-tags-creator {
}
}
.adf-tag-search-field {
width: 752px;
background: var(--adf-metadata-tags-background-color);
height: 32px;
border-radius: 12px;
align-items: center;
display: flex;
padding: 0 12px;
}
.adf-create-tag-label {
color: var(--theme-primary-color);
cursor: pointer;
@@ -21,7 +21,7 @@ import { NotificationService } from '@alfresco/adf-core';
import { By } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core';
import { MatIconModule } from '@angular/material/icon';
import { MatError, MatFormField, MatFormFieldModule } from '@angular/material/form-field';
import { MatError, MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
@@ -300,7 +300,7 @@ describe('TagsCreatorComponent', () => {
const tagNameField = fixture.debugElement.query(By.css(tagNameFieldSelector));
expect(tagNameField).toBeTruthy();
expect(tagNameField.nativeElement.hasAttribute('hidden')).toBeFalsy();
expect(tagNameField.query(By.directive(MatFormField))).toBeTruthy();
expect(tagNameField).toBeTruthy();
});
it('should input be autofocused', fakeAsync(() => {