Skip to content

Commit

Permalink
Fixed #8085 - Image picker - The survey width mode doesn't change to …
Browse files Browse the repository at this point in the history
…responsive after setting column count that doesn't fix the container's static width value of 720px
  • Loading branch information
tsv2013 committed Apr 22, 2024
1 parent a03860c commit 926e71b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/question_imagepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ export class QuestionImagePickerModel extends QuestionCheckboxBase {
protected needResponsiveness() {
return this.supportResponsiveness() && this.isDefaultV2Theme;
}
public needResponsiveWidth() {
return this.colCount > 2;
}

private _width: number;

Expand Down
12 changes: 12 additions & 0 deletions tests/surveyquestiontests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7756,3 +7756,15 @@ QUnit.test("matrix.visibleRows and read-only", function (assert) {
assert.equal(matrix.visibleRows[0].value, "col1", "row1.value");
assert.equal(matrix.visibleRows[1].value, "col2", "row2.value");
});
QUnit.test("QuestionImagePickerModel.needResponsiveWidth", function (assert) {
const survey = new SurveyModel({
elements: [
{ type: "imagepicker", name: "q" }
]
});
const q = survey.getAllQuestions()[0] as QuestionImagePickerModel;
assert.equal(survey.widthMode, "auto", "Auto mode by default");
assert.equal(q.needResponsiveWidth(), false, "Not responsive for single column auto width mode");
q.colCount = 3;
assert.equal(q.needResponsiveWidth(), true, "Responsive in auto mode for several columns");
});

0 comments on commit 926e71b

Please sign in to comment.