diff --git a/src/question_custom.ts b/src/question_custom.ts index 5f319d99e4..7a2fe04985 100644 --- a/src/question_custom.ts +++ b/src/question_custom.ts @@ -660,7 +660,8 @@ export class QuestionCustomModel extends QuestionCustomModelBase { return this.contentQuestion; } protected getDefaultTitle(): string { - if(this.hasJSONTitle && this.contentQuestion) return this.contentQuestion.title; + if(this.hasJSONTitle && this.contentQuestion) + return this.getProcessedText(this.contentQuestion.title); return super.getDefaultTitle(); } setValue(name: string, newValue: any, locNotification: any, allowNotifyValueChanged?: boolean): any { diff --git a/tests/question_customtests.ts b/tests/question_customtests.ts index e742c00388..9a2b1a5d02 100644 --- a/tests/question_customtests.ts +++ b/tests/question_customtests.ts @@ -2658,3 +2658,25 @@ QUnit.test("showPreview & default value, #7508", function (assert) { assert.equal(contentQuestion.value, "edf", "contentQuestion.value #4"); ComponentCollection.Instance.clear(); }); +QUnit.test("showPreview & default value, #7640", function (assert) { + ComponentCollection.Instance.add({ + name: "customtext", + questionJSON: { + type: "text", + title: "abc={abc}" + }, + }); + + const survey = new SurveyModel({ + elements: [ + { type: "customtext", name: "q1" } + ] + }); + const q1 = survey.getQuestionByName("q1"); + const contentQuestion = q1.contentQuestion; + survey.setVariable("abc", 123); + assert.equal(contentQuestion.locTitle.renderedHtml, "abc=123", "contentQuestion.title"); + assert.equal(q1.locTitle.renderedHtml, "abc=123", "q1.title"); + + ComponentCollection.Instance.clear(); +});