Skip to content

Commit

Permalink
The Logic editor duplicates a calculated field fix #4890 (#4893)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov authored Nov 15, 2023
1 parent 3fddeb8 commit 4c56bd3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,11 @@ export class ConditionEditor extends PropertyEditorSetupValue {
}
private addSurveyCalculatedValues(names: Array<any>) {
this.survey.calculatedValues.forEach(item => {
if(names.indexOf(item.name) < 0) names.push(item.name);
const index = names.indexOf(item.name.toLowerCase());
if(index > -1) {
names.splice(index, 1);
}
names.push(item.name);
});
}
private calculatedValueQuestion: Question = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,18 @@ test("questionName choices", () => {
expect(choices[2].text).toEqual("question 10");
expect(choices[3].text).toEqual("question 11");
});
test("questionName choices and calculated values", () => {
const survey = new SurveyModel({
elements: [{ type: "text", name: "q1" }],
calculatedValues: [{ name: "defaultSetValue", expression: "false" }]
});
const question = survey.getQuestionByName("q1");
const editor = new ConditionEditor(survey, question);
const panel = editor.panel.panels[0];
const choices = panel.getQuestionByName("questionName").choices;
expect(choices).toHaveLength(1);
expect(choices[0].text).toEqual("defaultSetValue");
});
test("questionName title visibility", () => {
const survey = new SurveyModel({
elements: [
Expand Down

0 comments on commit 4c56bd3

Please sign in to comment.