Skip to content

Commit

Permalink
Resolved #6928 - TOC Responsiveness on Smaller (not mobile) screens (#…
Browse files Browse the repository at this point in the history
…7039)

Co-authored-by: tsv2013 <[email protected]>
  • Loading branch information
tsv2013 and tsv2013 authored Sep 28, 2023
1 parent 53ef380 commit cac1724
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/surveyToc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,23 @@ export class TOCModel {
constructor(public survey: SurveyModel) {
this.listModel = createTOCListModel(survey, () => { this.popupModel.isVisible = false; });
this.popupModel = new PopupModel("sv-list", { model: this.listModel });
this.popupModel.displayMode = this.isMobile ? "overlay" : "popup";
this.popupModel.displayMode = <any>new ComputedUpdater(() => this.isMobile ? "overlay" : "popup");
}

isMobile = IsTouch;
get isMobile(): boolean {
return this.survey.isMobile;
}
get containerCss(): string {
return getTocRootCss(this.survey, this.isMobile);
}
listModel: ListModel<Action>;
popupModel: PopupModel;
icon = "icon-navmenu_24x24";
togglePopup = () => {
togglePopup = (): void => {
this.popupModel.toggleVisibility();
}
public dispose(): void {
this.popupModel.dispose();
this.listModel.dispose();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 68 additions & 2 deletions visualRegressionTests/tests/defaultV2/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ frameworks.forEach(framework => {
});
test("TOC survey navigation mobile", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(800, 900);
await t.resizeWindow(600, 900);
await ClientFunction(() => {
window["Survey"]._setIsTouch(true);
})();
Expand Down Expand Up @@ -1060,5 +1060,71 @@ frameworks.forEach(framework => {
await t.resizeWindow(1920, 1080);
});
});
});
test("TOC survey navigation responsive", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1600, 900);

const json = {
title: "Software developer survey.",
showTOC: true,
pages: [
{
"title": "What operating system do you use?",
"elements": [
{
"type": "checkbox",
"name": "opSystem",
"title": "OS",
"hasOther": true,
"isRequired": true,
"choices": ["Windows", "Linux", "Macintosh OSX"]
}
]
}, {
"title": "What language(s) are you currently using?",
"elements": [
{
"type": "checkbox",
"name": "langs",
"title": "Please select from the list",
"isRequired": true,
"choices": [
"Javascript",
"Java",
"Python",
"CSS",
"PHP",
"Ruby",
"C++",
"C",
"Shell",
"C#",
]
}
]
}, {
"title": "Please enter your name and e-mail",
"elements": [
{
"type": "text",
"name": "name",
"title": "Name:"
}, {
"type": "text",
"name": "email",
"title": "Your e-mail"
}
]
}
]
};
await initSurvey(framework, json);
await takeElementScreenshot("survey-navigation-toc-left.png", Selector(".sv-components-row"), t, comparer);

await t.resizeWindow(600, 900);
await takeElementScreenshot("survey-navigation-toc-mobile.png", Selector(".sd-root-modern"), t, comparer);

await t.resizeWindow(1920, 1080);
});
});
});

0 comments on commit cac1724

Please sign in to comment.