Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #6993 - Mobile: Incorrect question content paddings on design-surface #6994

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,9 @@ export class Question extends SurveyElement<Question>
}
public setIsMobile(val: boolean) {
this.isMobile = val && (this.allowMobileInDesignMode() || !this.isDesignMode);
this.renderMinWidth = !val;
}
@property({
defaultValue: false, onSet: (val, target) => {
target.renderMinWidth = !val;
}
}) isMobile: boolean;
@property({ defaultValue: false }) isMobile: boolean;
@property() forceIsInputReadOnly: boolean;

constructor(name: string) {
Expand Down
4 changes: 4 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15823,12 +15823,16 @@ QUnit.test("Check survey isMobile in design mode", function (assert) {
const textQuestion = survey.getQuestionByName("q1");
const multipleTextQuestion = survey.getQuestionByName("q2");
const checkboxQuestion = survey.getQuestionByName("q3");
assert.ok(textQuestion.renderMinWidth);
survey.setIsMobile(true);
assert.ok(survey._isMobile);
assert.notOk(survey.isMobile);
assert.notOk(textQuestion.isMobile);
assert.notOk(textQuestion.renderMinWidth);
assert.ok(multipleTextQuestion.isMobile);
assert.notOk(multipleTextQuestion.renderMinWidth);
assert.ok(checkboxQuestion.isMobile);
assert.notOk(checkboxQuestion.renderMinWidth);
});
QUnit.test("Check survey isMobile is set correctly on adding new question", function (assert) {
const survey = new SurveyModel({
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion visualRegressionTests/tests/defaultV2/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ frameworks.forEach(framework => {
(window as any).survey.getAllQuestions()[0].resizeObserver.disconnect();
(window as any).survey.getAllQuestions()[0].processResponsiveness = () => { };
(window as any).survey.getAllQuestions()[0].pageSize = 1;
(window as any).survey.getAllQuestions()[0].isMobile = true;
(window as any).survey.getAllQuestions()[0].setIsMobile(true);
})();
await t.setFilesToUpload(Selector(".sd-file input"), ["files/SingleImage.jpg"]);
const questionRoot = Selector(".sd-question");
Expand Down
45 changes: 45 additions & 0 deletions visualRegressionTests/tests/defaultV2/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,4 +589,49 @@ frameworks.forEach(framework => {
await takeElementScreenshot("panel-with-errors-without-title.png", panelRoot, t, comparer);
});
});
test("Check question min size inside panels in design mode", async (t) => {
if (framework == "vue") return;
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(350, 800);
await initSurvey(framework, {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "panel",
"name": "panel1",
"elements": [
{
"type": "panel",
"name": "panel2",
"elements": [
{
"type": "panel",
"name": "panel3",
"elements": [
{
"type": "text",
"name": "question1"
}
]
}
]
}
]
}
]
}
]
});
const panelRoot = Selector(".sd-body");
await ClientFunction(() => {
(window as any).survey.setDesignMode(true);
(window as any).survey.setIsMobile(true);
})();
await resetFocusToBody();

await takeElementScreenshot("responsive-question-inside-panels-in-creator.png", panelRoot, t, comparer);
});
});
});