mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
minor fixes
This commit is contained in:
committed by
Anukriti Singh
parent
d1307c3cfc
commit
c629c1b3a4
@@ -47,7 +47,6 @@ export class MetadataViewPage {
|
|||||||
applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
|
applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
|
||||||
saveMetadataButton = $(`[data-automation-id='save-metadata']`);
|
saveMetadataButton = $(`[data-automation-id='save-metadata']`);
|
||||||
saveGeneralMetadataButton = $(`[data-automation-id='save-generalInfo-metadata']`);
|
saveGeneralMetadataButton = $(`[data-automation-id='save-generalInfo-metadata']`);
|
||||||
resetGeneralMetadataButton = $(`[data-automation-id='reset-general-metadata']`);
|
|
||||||
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);
|
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);
|
||||||
|
|
||||||
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
|
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
|
||||||
|
|||||||
+6
-5
@@ -9,7 +9,8 @@
|
|||||||
(keyup.enter)="addCategory()"
|
(keyup.enter)="addCategory()"
|
||||||
aria-labelledby="adf-category-name-input-label"
|
aria-labelledby="adf-category-name-input-label"
|
||||||
placeholder="{{'CATEGORIES_MANAGEMENT.INPUT_PLACEHOLDER' | translate }}"
|
placeholder="{{'CATEGORIES_MANAGEMENT.INPUT_PLACEHOLDER' | translate }}"
|
||||||
adf-auto-focus />
|
adf-auto-focus
|
||||||
|
/>
|
||||||
<mat-error [hidden]="!categoryNameControl.invalid">{{ categoryNameErrorMessageKey | translate }}</mat-error>
|
<mat-error [hidden]="!categoryNameControl.invalid">{{ categoryNameErrorMessageKey | translate }}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
<span
|
<span
|
||||||
*ngFor="let category of categories"
|
*ngFor="let category of categories"
|
||||||
[class.adf-categories-padded]="!isCRUDMode"
|
[class.adf-categories-padded]="!isCRUDMode"
|
||||||
class="adf-assigned-categories">
|
class="adf-assigned-categories">
|
||||||
{{ category.name }}
|
{{ category.name }}
|
||||||
<button
|
<button
|
||||||
data-automation-id="categories-remove-category-button"
|
data-automation-id="categories-remove-category-button"
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
<div class="adf-existing-categories-panel" *ngIf="existingCategoriesPanelVisible">
|
<div class="adf-existing-categories-panel" *ngIf="existingCategoriesPanelVisible">
|
||||||
<ng-container *ngIf="isCRUDMode && (!existingCategoriesLoading || existingCategories)">
|
<ng-container *ngIf="isCRUDMode && (!existingCategoriesLoading || existingCategories)">
|
||||||
<span class="adf-create-category-label"
|
<span class="adf-create-category-label"
|
||||||
(click)="addCategory()"
|
(click)="addCategory()"
|
||||||
[hidden]="categoryNameControl.invalid || typing">
|
[hidden]="categoryNameControl.invalid || typing">
|
||||||
{{ 'CATEGORIES_MANAGEMENT.GENERIC_CREATE' | translate : { name: categoryNameControl.value } }}
|
{{ 'CATEGORIES_MANAGEMENT.GENERIC_CREATE' | translate : { name: categoryNameControl.value } }}
|
||||||
</span>
|
</span>
|
||||||
@@ -62,8 +63,8 @@
|
|||||||
</mat-selection-list>
|
</mat-selection-list>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<mat-spinner
|
<mat-spinner
|
||||||
*ngIf="existingCategoriesLoading"
|
*ngIf="existingCategoriesLoading"
|
||||||
[diameter]="50"
|
[diameter]="50"
|
||||||
[attr.aria-label]="'CATEGORIES_MANAGEMENT.LOADING' | translate">
|
[attr.aria-label]="'CATEGORIES_MANAGEMENT.LOADING' | translate">
|
||||||
</mat-spinner>
|
</mat-spinner>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
@@ -449,6 +449,16 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
expect(categoriesChangeSpy).toHaveBeenCalledOnceWith(component.categories);
|
expect(categoriesChangeSpy).toHaveBeenCalledOnceWith(component.categories);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should clear and not hide input after category is created', fakeAsync(() => {
|
||||||
|
createCategory('test');
|
||||||
|
const categoryControl: HTMLDivElement = fixture.debugElement.query(By.css('.adf-category-name-field')).nativeElement;
|
||||||
|
|
||||||
|
expect(categoryControl.hidden).toBeFalse();
|
||||||
|
expect(getExistingCategoriesList()).toEqual([]);
|
||||||
|
expect(component.categoryNameControl.value).toBe('');
|
||||||
|
expect(component.categoryNameControl.untouched).toBeTrue();
|
||||||
|
}));
|
||||||
|
|
||||||
it('should be able to remove added category', fakeAsync(() => {
|
it('should be able to remove added category', fakeAsync(() => {
|
||||||
createCategory('test');
|
createCategory('test');
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -55,7 +55,8 @@
|
|||||||
<ng-container *ngIf="displayTags">
|
<ng-container *ngIf="displayTags">
|
||||||
<mat-expansion-panel
|
<mat-expansion-panel
|
||||||
(opened)="handleTagPanelOpen()"
|
(opened)="handleTagPanelOpen()"
|
||||||
(closed)="handleTagPanelClose()" hideToggle
|
(closed)="handleTagPanelClose()"
|
||||||
|
hideToggle
|
||||||
[expanded]="tagsPanelState">
|
[expanded]="tagsPanelState">
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<div class="adf-metadata-properties-panel-content">
|
<div class="adf-metadata-properties-panel-content">
|
||||||
@@ -86,7 +87,8 @@
|
|||||||
<button mat-icon-button
|
<button mat-icon-button
|
||||||
(click)="saveTagsChanges($event)"
|
(click)="saveTagsChanges($event)"
|
||||||
color="primary"
|
color="primary"
|
||||||
data-automation-id="save-tags-metadata" [disabled]="!hasMetadataChanged">
|
data-automation-id="save-tags-metadata"
|
||||||
|
[disabled]="!hasMetadataChanged">
|
||||||
<mat-icon>check</mat-icon>
|
<mat-icon>check</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -127,7 +129,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="adf-metadata-categories-title">
|
<div class="adf-metadata-categories-title">
|
||||||
<button *ngIf="!editableCategories"
|
<button *ngIf="!editableCategories"
|
||||||
mat-icon-button (click)="toggleCategoriesEdit($event)"
|
mat-icon-button
|
||||||
|
(click)="toggleCategoriesEdit($event)"
|
||||||
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
|
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
|
||||||
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate"
|
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate"
|
||||||
data-automation-id="meta-data-card-toggle-categoeies-edit"
|
data-automation-id="meta-data-card-toggle-categoeies-edit"
|
||||||
|
|||||||
+38
-1
@@ -432,6 +432,44 @@ describe('ContentMetadataComponent', () => {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('saveChanges', () => {
|
||||||
|
it('should save general info changes and toggle editable', () => {
|
||||||
|
const event = new Event('click');
|
||||||
|
spyOn(component, 'saveChanges');
|
||||||
|
component.editable = true;
|
||||||
|
component.saveGeneralInfoChanges(event);
|
||||||
|
expect(component.saveChanges).toHaveBeenCalledWith(event);
|
||||||
|
expect(component.editable).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should save tags changes and toggle editableTags', () => {
|
||||||
|
const event = new Event('click');
|
||||||
|
spyOn(component, 'saveChanges');
|
||||||
|
component.editableTags = true;
|
||||||
|
component.saveTagsChanges(event);
|
||||||
|
expect(component.saveChanges).toHaveBeenCalledWith(event);
|
||||||
|
expect(component.editableTags).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should save categories changes and toggle editableCategories', () => {
|
||||||
|
const event = new Event('click');
|
||||||
|
spyOn(component, 'saveChanges');
|
||||||
|
component.editableCategories = true;
|
||||||
|
component.saveCategoriesChanges(event);
|
||||||
|
expect(component.saveChanges).toHaveBeenCalledWith(event);
|
||||||
|
expect(component.editableTags).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should save group changes and toggle group.editable', () => {
|
||||||
|
const group = { editable: true };
|
||||||
|
const event = new Event('click');
|
||||||
|
spyOn(component, 'saveChanges');
|
||||||
|
component.saveGroupChanges(group, event);
|
||||||
|
expect(component.saveChanges).toHaveBeenCalledWith(event);
|
||||||
|
expect(group.editable).toBe(false);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
describe('cancelChanges', () => {
|
describe('cancelChanges', () => {
|
||||||
it('should cancel group changes and set group editable to false', () => {
|
it('should cancel group changes and set group editable to false', () => {
|
||||||
const group = { editable: true };
|
const group = { editable: true };
|
||||||
@@ -1245,7 +1283,6 @@ describe('ContentMetadataComponent', () => {
|
|||||||
const tagName2 = 'New tag 3';
|
const tagName2 = 'New tag 3';
|
||||||
|
|
||||||
updateService.update(property, 'updated-value');
|
updateService.update(property, 'updated-value');
|
||||||
// tick(800);
|
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
tagsCreator.tagsChange.emit([tagName1, tagName2]);
|
tagsCreator.tagsChange.emit([tagName1, tagName2]);
|
||||||
|
|||||||
Reference in New Issue
Block a user