Skip to content

Commit

Permalink
Merge pull request #6675 from surveyjs/bug/6573
Browse files Browse the repository at this point in the history
Work for #6573: remove setElementMaxMinWidth
  • Loading branch information
andrewtelnov committed Aug 10, 2023
2 parents c0303ec + 13c8584 commit 3433fce
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 36 deletions.
11 changes: 0 additions & 11 deletions src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export class QuestionRowModel extends Base {
var preSetWidthElements = [];
for (var i = 0; i < this.elements.length; i++) {
var el = this.elements[i];
this.setElementMaxMinWidth(el);

if (el.isVisible) {
(<any>el).isSingleInRow = isSingleInRow;
Expand Down Expand Up @@ -182,16 +181,6 @@ export class QuestionRowModel extends Base {
}
}
}
public setElementMaxMinWidth(el: IElement): void {
if (
el.width &&
typeof el.width === "string" &&
el.width.indexOf("%") === -1
) {
el.minWidth = el.width;
el.maxWidth = el.width;
}
}

private getRenderedCalcWidth(
el: IElement,
Expand Down
22 changes: 0 additions & 22 deletions tests/paneltests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,28 +786,6 @@ QUnit.test(
}
);

QUnit.test("QuestionRowModel setElementMaxMinWidth", function (assert) {
const qrm = new QuestionRowModel(<any>{ areInvisibleElementsShowing: false });

const el1: any = {
width: "100px",
minWidth: settings.minWidth,
maxWidth: settings.maxWidth,
};
qrm.setElementMaxMinWidth(el1);
assert.equal(el1.minWidth, "100px", "minWidth in 'px' is set");
assert.equal(el1.maxWidth, "100px", "maxWidth in 'px' is set");

const el2: any = {
width: "20%",
minWidth: settings.minWidth,
maxWidth: settings.maxWidth,
};
qrm.setElementMaxMinWidth(el2);
assert.equal(el2.minWidth, "300px", "minWidth in '%' is default");
assert.equal(el2.maxWidth, "100%", "maxWidth in '%' is default");
});

QUnit.test("Page/Panel.getProgressInfo()", function (assert) {
const page = new PageModel("q1");
const panel1 = page.addNewPanel("panel1");
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ frameworks.forEach(framework => {
{
type: "boolean",
name: "boolean_question",
maxWidth: "768px",
minWidth: "768px",
width: "768px",
renderAs: "radio"
},
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/complex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const json = {
templateTitle: "{panel.itemName}",
panelRemoveText: "Remove Item",
panelCount: 5,
minWidth: "708px",
maxWidth: "708px",
width: "708px",
templateElements: [
{
Expand Down
4 changes: 3 additions & 1 deletion visualRegressionTests/tests/defaultV2/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const json = {
type: "file",
title: "Upload everything what you’d like to.",
name: "file_question",
width: "704px"
minWidth: "704px",
width: "704px",
maxWidth: "704px",
}]
};

Expand Down
4 changes: 4 additions & 0 deletions visualRegressionTests/tests/defaultV2/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ frameworks.forEach(framework => {
type: "html",
name: "html_question",
html: "<b>Hello, world!</b><p>Hello, world!</p><b>Hello, world!</b>",
maxWidth: "768px",
minWidth: "768px",
width: "768px"
},
]
Expand All @@ -47,6 +49,8 @@ frameworks.forEach(framework => {
type: "html",
name: "html_question",
html: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
maxWidth: "768px",
minWidth: "768px",
width: "768px"
},
]
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ frameworks.forEach(framework => {
name: "image_question",
imageWidth: "1024px",
imageHeight: "465px",
minWidth: "1024px",
maxWidth: "1024px",
width: "1024px",
imageLink: imageSource
},
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ frameworks.forEach(framework => {
detailPanelMode: "underRow",
columns: [{ name: "col1" }, { name: "col2" }, { name: "col3" }],
detailElements: [{ type: "text", name: "q1" }],
minWidth: "800px",
maxWidth: "800px",
width: "800px"
},
],
Expand Down
13 changes: 11 additions & 2 deletions visualRegressionTests/tests/defaultV2/matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ frameworks.forEach(framework => {
emptyRowsText: "There is no records yet.\nClick the button below to add a new record.",
addRowText: "Add New Record",
rowCount: 0,
maxWidth: "768px",
minWidth: "768px",
width: "768px"
}
]
Expand Down Expand Up @@ -65,6 +67,8 @@ frameworks.forEach(framework => {
],
addRowText: "Add a New Record",
rowCount: 3,
maxWidth: "768px",
minWidth: "768px",
width: "768px"
},
]
Expand Down Expand Up @@ -116,8 +120,9 @@ frameworks.forEach(framework => {
cellType: "comment",
addRowText: "Add Date +",
removeRowText: "Remove",
width: "800px"
}
maxWidth: "800px",
minWidth: "800px",
width: "800px" }
]
});

Expand Down Expand Up @@ -155,6 +160,8 @@ frameworks.forEach(framework => {
],
addRowText: "Add a New Record",
rowCount: 3,
maxWidth: "704px",
minWidth: "704px",
width: "704px"
},
]
Expand Down Expand Up @@ -196,6 +203,8 @@ frameworks.forEach(framework => {
],
addRowText: "Add a New Record",
rowCount: 3,
maxWidth: "704px",
minWidth: "704px",
width: "704px"
},
]
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/multipletext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ frameworks.forEach(framework => {
{
type: "multipletext",
name: "q1",
minWidth: "768px",
maxWidth: "768px",
width: "768px",
title: "Personal Information",
items: [
Expand Down
16 changes: 16 additions & 0 deletions visualRegressionTests/tests/defaultV2/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
elements: [
{
Expand Down Expand Up @@ -60,6 +62,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Contact",
minWidth: "780px",
maxWidth: "780px",
width: "780px",
elements: [
{
Expand Down Expand Up @@ -97,6 +101,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
state: "collapsed",
elements: [
Expand Down Expand Up @@ -132,6 +138,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
visible: false,
elements: [
Expand Down Expand Up @@ -271,6 +279,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
elements: [
{
Expand Down Expand Up @@ -307,6 +317,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
elements: [
{
Expand Down Expand Up @@ -345,6 +357,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
elements: [
{
Expand Down Expand Up @@ -379,6 +393,8 @@ frameworks.forEach(framework => {
type: "panel",
name: "delivery_details",
title: "Please, specify the delivery details.",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
showNumber: true,
elements: [
Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var json = {
noEntriesText: "You can add as many applications as you want.\nJust click the button below to start.",
panelAddText: "Add application",
panelRemoveText: "Remove application",
maxWidth: "768px",
minWidth: "768px",
width: "768px"
},
]
Expand Down
14 changes: 14 additions & 0 deletions visualRegressionTests/tests/defaultV2/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ frameworks.forEach(framework => {
type: "text",
titleLocation: "hidden",
name: "question",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
},
]
Expand All @@ -47,6 +49,8 @@ frameworks.forEach(framework => {
{
type: "text",
name: "question_with_num",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
title: "What can we improve or add to our Xamarin.Forms UI product line to better address your business needs in the future (control features, learning materials, etc.)?"
},
Expand All @@ -66,6 +70,8 @@ frameworks.forEach(framework => {
type: "text",
inputType: "color",
name: "question_color",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
title: "Color question"
},
Expand All @@ -84,6 +90,8 @@ frameworks.forEach(framework => {
{
type: "text",
name: "question_with_num",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
state: "collapsed",
title: "What can we improve or add to our Xamarin.Forms UI product line to better address your business needs in the future (control features, learning materials, etc.)?"
Expand Down Expand Up @@ -112,6 +120,8 @@ frameworks.forEach(framework => {
type: "text",
name: "q1",
title: "Rate the importance of this scenario for your enterprise (assuming you've encountered it in the past).",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
choices: ["High", "Medium", "Low"],
visible: false,
Expand All @@ -134,6 +144,8 @@ frameworks.forEach(framework => {
{
type: "text",
name: "question_with_num",
minWidth: "708px",
maxWidth: "708px",
width: "708px",
state: "collapsed",
title: "Personal information"
Expand Down Expand Up @@ -163,6 +175,8 @@ frameworks.forEach(framework => {
type: "text",
name: "required_question",
isRequired: true,
minWidth: "708px",
maxWidth: "708px",
width: "708px",
title: "What can we improve or add to our Xamarin.Forms UI product line to better address your business needs in the future (control features, learning materials, etc.)?"
},
Expand Down
Loading

0 comments on commit 3433fce

Please sign in to comment.