@cqa-lib/cqa-ui 1.1.257 → 1.1.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22193,25 +22193,29 @@ class TestCaseLoopStepComponent {
22193
22193
  });
22194
22194
  }
22195
22195
  if (this.loopType === 'while') {
22196
+ // When naturalTextActionId exists, populate condition and selected template from options so autocomplete shows selected template
22197
+ const configWithId = this.config;
22198
+ if (configWithId?.naturalTextActionId != null && this.naturalTextActionsOptions?.length) {
22199
+ this.rebuildWhileConditionFromNaturalTextAction();
22200
+ }
22201
+ else if (this.condition || configWithId?.templateVariablesData) {
22202
+ // Fallback: match by condition text when naturalTextActionId not set
22203
+ const conditionStr = this.condition || configWithId?.condition || '';
22204
+ if (conditionStr && (this.naturalTextActionsOptions || []).length > 0) {
22205
+ const matchingOption = this.naturalTextActionsOptions.find((opt) => (opt.naturalText || opt.name || opt.value) === conditionStr);
22206
+ const fullTemplate = matchingOption?.template || matchingOption;
22207
+ if (fullTemplate && fullTemplate.variables) {
22208
+ this.selectedTemplate = fullTemplate;
22209
+ this.templateVariables = this.setConditionTemplateVariables(fullTemplate) || [];
22210
+ this.buildTemplateVariablesForm();
22211
+ }
22212
+ }
22213
+ }
22196
22214
  this.editForm.patchValue({
22197
22215
  condition: this.condition ?? '',
22198
22216
  maxIterations: this.maxIterations ?? 5,
22199
22217
  });
22200
22218
  }
22201
- // While loop: restore selected template and template variables from config when opening edit
22202
- if (this.loopType === 'while' && (this.condition || this.config.templateVariablesData)) {
22203
- const configWithData = this.config;
22204
- const conditionStr = this.condition || configWithData.condition || '';
22205
- if (conditionStr && (this.naturalTextActionsOptions || []).length > 0) {
22206
- const matchingOption = this.naturalTextActionsOptions.find((opt) => (opt.naturalText || opt.name || opt.value) === conditionStr);
22207
- const fullTemplate = matchingOption?.template || matchingOption;
22208
- if (fullTemplate && fullTemplate.variables) {
22209
- this.selectedTemplate = fullTemplate;
22210
- this.templateVariables = this.setConditionTemplateVariables(fullTemplate) || [];
22211
- this.buildTemplateVariablesForm();
22212
- }
22213
- }
22214
- }
22215
22219
  this.isEditing = true;
22216
22220
  this.edit.emit();
22217
22221
  }