From aa269da2ae276fcd789d56be8d6bd7e032622f68 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Tue, 16 Jul 2024 09:46:10 +0300 Subject: [PATCH] resolve #8555 questionTitleWidth property - add 'px' to numeric values (#8566) Co-authored-by: OlgaLarina --- src/question.ts | 6 +++++- tests/surveytests.ts | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/question.ts b/src/question.ts index 969edf4a33..732e002e1e 100644 --- a/src/question.ts +++ b/src/question.ts @@ -686,7 +686,11 @@ export class Question extends SurveyElement } public get titleWidth(): string { if (this.getTitleLocation() === "left") { - if (!!this.parent) return this.parent.getQuestionTitleWidth(); + if (!!this.parent) { + let width = this.parent.getQuestionTitleWidth() as any; + if (width && !isNaN(width)) width = width + "px"; + return width; + } } return undefined; } diff --git a/tests/surveytests.ts b/tests/surveytests.ts index e06530298b..5855f5b6e5 100644 --- a/tests/surveytests.ts +++ b/tests/surveytests.ts @@ -6984,6 +6984,9 @@ QUnit.test("Define questionTitleWidth on Panel/Page level", function (assert) { panel2.questionTitleWidth = "200px"; assert.equal(q.titleWidth, "200px", "get from panel2"); + panel2.questionTitleWidth = "300"; + assert.equal(q.titleWidth, "300px", "titleWidth with px"); + q.titleLocation = "top"; assert.equal(q.titleWidth, undefined, "titleWidth available if titleLocation is left"); });