From 73d4743b62947dbf877b3f38622accfc3eb689a6 Mon Sep 17 00:00:00 2001 From: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com> Date: Wed, 19 Mar 2025 08:55:20 +0100 Subject: [PATCH] [ACS-9386] Fix wrong dialog title & button text on edit rule dialog (#4445) --- .../edit-rule-dialog.smart-component.spec.ts | 10 ++++++++++ .../src/rule-details/edit-rule-dialog.ui-component.ts | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.smart-component.spec.ts b/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.smart-component.spec.ts index c6ed5ceb0..10db621ad 100644 --- a/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.smart-component.spec.ts +++ b/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.smart-component.spec.ts @@ -87,6 +87,11 @@ describe('EditRuleDialogSmartComponent', () => { expect(titleElement.innerText.trim()).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE'); }); + + it('should set correct title and submitLabel for create mode', () => { + expect(fixture.componentInstance.title).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE_TITLE'); + expect(fixture.componentInstance.submitLabel).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE'); + }); }); describe('With dialog options passed', () => { @@ -113,5 +118,10 @@ describe('EditRuleDialogSmartComponent', () => { expect(titleElement.innerText.trim()).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE'); }); + + it('should set correct title and submitLabel for update mode', () => { + expect(fixture.componentInstance.title).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE_TITLE'); + expect(fixture.componentInstance.submitLabel).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE'); + }); }); }); diff --git a/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.ui-component.ts b/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.ui-component.ts index e4c6fa79f..95a3e77dd 100644 --- a/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.ui-component.ts +++ b/projects/aca-content/folder-rules/src/rule-details/edit-rule-dialog.ui-component.ts @@ -54,19 +54,21 @@ export class EditRuleDialogUiComponent { formValid = false; model: Partial; nodeId = ''; + title = ''; + submitLabel = ''; actionDefinitions$; parameterConstraints$; formValue: Partial; @Output() submitted = new EventEmitter>(); - title = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE_TITLE' : 'CREATE_TITLE'); - submitLabel = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE' : 'CREATE'); - constructor(@Inject(MAT_DIALOG_DATA) public data: EditRuleDialogOptions) { this.model = this.data?.model || {}; this.nodeId = this.data?.nodeId; this.actionDefinitions$ = this.data?.actionDefinitions$; this.parameterConstraints$ = this.data?.parameterConstraints$; + + this.title = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE_TITLE' : 'CREATE_TITLE'); + this.submitLabel = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE' : 'CREATE'); } get isUpdateMode(): boolean {