Skip to content

Commit

Permalink
ACS-8824 [ACA] View Details / The user cannot edit node properties af… (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
dominikiwanekhyland committed Sep 27, 2024
1 parent 602460c commit da44b4c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@

import { inject, Injectable } from '@angular/core';
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({
providedIn: 'root'
Expand All @@ -37,7 +43,10 @@ export class BasicPropertiesService {
label: 'CORE.METADATA.BASIC.NAME',
value: node.name,
key: 'properties.cm:name',
editable: true
editable: true,
validators: [
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
]
}),
new CardViewTextItemModel({
label: 'CORE.METADATA.BASIC.TITLE',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,15 @@ describe('CardViewTextItemComponent', () => {
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);
spyOn(cardViewUpdateService, 'update');
component.property.isValid = () => false;

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

expect(cardViewUpdateService.update).toHaveBeenCalled();
expect(cardViewUpdateService.update).not.toHaveBeenCalled();
});

it('should trigger the update event if the editedValue is valid', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.property.value);
} else {
this.errors = this.property.getValidationErrors(this.editedValue);
this.cardViewUpdateService.update({ ...this.property } as CardViewTextItemModel, this.editedValue);
}
}
}
Expand Down

0 comments on commit da44b4c

Please sign in to comment.