mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-8824 [ACA] View Details / The user cannot edit node properties af… (#10246)
* ACS-8824 [ACA] View Details / The user cannot edit node properties after failing to change node name with special characters * ACS-8824 [ACA] View Details / The user cannot edit node properties after failing to change node name with special characters
This commit is contained in:
committed by
GitHub
parent
602460c574
commit
da44b4cee0
@@ -17,7 +17,13 @@
|
|||||||
|
|
||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { CardViewDateItemModel, CardViewTextItemModel, FileSizePipe, TranslationService } from '@alfresco/adf-core';
|
import {
|
||||||
|
CardViewDateItemModel,
|
||||||
|
CardViewItemMatchValidator,
|
||||||
|
CardViewTextItemModel,
|
||||||
|
FileSizePipe,
|
||||||
|
TranslationService
|
||||||
|
} from '@alfresco/adf-core';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -37,7 +43,10 @@ export class BasicPropertiesService {
|
|||||||
label: 'CORE.METADATA.BASIC.NAME',
|
label: 'CORE.METADATA.BASIC.NAME',
|
||||||
value: node.name,
|
value: node.name,
|
||||||
key: 'properties.cm:name',
|
key: 'properties.cm:name',
|
||||||
editable: true
|
editable: true,
|
||||||
|
validators: [
|
||||||
|
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
new CardViewTextItemModel({
|
new CardViewTextItemModel({
|
||||||
label: 'CORE.METADATA.BASIC.TITLE',
|
label: 'CORE.METADATA.BASIC.TITLE',
|
||||||
|
@@ -581,7 +581,7 @@ describe('CardViewTextItemComponent', () => {
|
|||||||
expect(cardViewUpdateService.update).toHaveBeenCalledWith(property, 'updated-value');
|
expect(cardViewUpdateService.update).toHaveBeenCalledWith(property, 'updated-value');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger the update event if the editedValue is NOT valid', async () => {
|
it('should NOT trigger the update event if the editedValue is invalid', async () => {
|
||||||
const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
|
const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
|
||||||
spyOn(cardViewUpdateService, 'update');
|
spyOn(cardViewUpdateService, 'update');
|
||||||
component.property.isValid = () => false;
|
component.property.isValid = () => false;
|
||||||
@@ -589,7 +589,7 @@ describe('CardViewTextItemComponent', () => {
|
|||||||
updateTextField(component.property.key, '@invalid-value');
|
updateTextField(component.property.key, '@invalid-value');
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
expect(cardViewUpdateService.update).toHaveBeenCalled();
|
expect(cardViewUpdateService.update).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger the update event if the editedValue is valid', async () => {
|
it('should trigger the update event if the editedValue is valid', async () => {
|
||||||
|
@@ -149,7 +149,6 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
|
|||||||
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.property.value);
|
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.property.value);
|
||||||
} else {
|
} else {
|
||||||
this.errors = this.property.getValidationErrors(this.editedValue);
|
this.errors = this.property.getValidationErrors(this.editedValue);
|
||||||
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.editedValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user