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 {