Skip to content

Commit da44b4c

Browse files
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
1 parent 602460c commit da44b4c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

lib/content-services/src/lib/content-metadata/services/basic-properties.service.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717

1818
import { inject, Injectable } from '@angular/core';
1919
import { Node } from '@alfresco/js-api';
20-
import { CardViewDateItemModel, CardViewTextItemModel, FileSizePipe, TranslationService } from '@alfresco/adf-core';
20+
import {
21+
CardViewDateItemModel,
22+
CardViewItemMatchValidator,
23+
CardViewTextItemModel,
24+
FileSizePipe,
25+
TranslationService
26+
} from '@alfresco/adf-core';
2127

2228
@Injectable({
2329
providedIn: 'root'
@@ -37,7 +43,10 @@ export class BasicPropertiesService {
3743
label: 'CORE.METADATA.BASIC.NAME',
3844
value: node.name,
3945
key: 'properties.cm:name',
40-
editable: true
46+
editable: true,
47+
validators: [
48+
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
49+
]
4150
}),
4251
new CardViewTextItemModel({
4352
label: 'CORE.METADATA.BASIC.TITLE',

lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,15 @@ describe('CardViewTextItemComponent', () => {
581581
expect(cardViewUpdateService.update).toHaveBeenCalledWith(property, 'updated-value');
582582
});
583583

584-
it('should trigger the update event if the editedValue is NOT valid', async () => {
584+
it('should NOT trigger the update event if the editedValue is invalid', async () => {
585585
const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
586586
spyOn(cardViewUpdateService, 'update');
587587
component.property.isValid = () => false;
588588

589589
updateTextField(component.property.key, '@invalid-value');
590590
await fixture.whenStable();
591591

592-
expect(cardViewUpdateService.update).toHaveBeenCalled();
592+
expect(cardViewUpdateService.update).not.toHaveBeenCalled();
593593
});
594594

595595
it('should trigger the update event if the editedValue is valid', async () => {

lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
149149
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.property.value);
150150
} else {
151151
this.errors = this.property.getValidationErrors(this.editedValue);
152-
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.editedValue);
153152
}
154153
}
155154
}

0 commit comments

Comments
 (0)