Skip to content

Commit

Permalink
Change default value for IHeader.inheritWidthFrom (#7418)
Browse files Browse the repository at this point in the history
* work for #7409 Change default value for IHeader.inheritWidthFrom

* work for #7409 fix visual tests

---------

Co-authored-by: LARINA-NB-W10\OlgaLarina <[email protected]>
  • Loading branch information
OlgaLarina and LARINA-NB-W10\OlgaLarina authored Nov 24, 2023
1 parent 988b3fb commit 0276a90
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Serializer.addClass(
"cover",
[
{ name: "height:number", minValue: 0, default: 256 },
{ name: "inheritWidthFrom", default: "survey" },
{ name: "inheritWidthFrom", default: "container" },
{ name: "textAreaWidth:number", minValue: 0, default: 512 },
{ name: "textGlowEnabled:boolean" },
{ name: "overlapEnabled:boolean" },
Expand Down
4 changes: 2 additions & 2 deletions src/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export interface IHeader {
*
* Possible values:
*
* - `"survey"` (default)\
* - `"survey"`\
* The header width is the same as the survey width.
* - `"container"`\
* - `"container"` (default)\
* The header width is the same as the survey container width.
*
* @see [SurveyModel.width](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#width)
Expand Down
16 changes: 7 additions & 9 deletions tests/headerTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ QUnit.test("cover maxWidth",
function (assert) {
const cover = new Cover();
cover.survey = new SurveyModel();
assert.equal(cover.maxWidth, undefined, "survey.maxWidth is default");
assert.equal(cover.inheritWidthFrom, "container", "default inheritWidthFrom");
assert.equal(cover.maxWidth, false, "inheritWidthFrom is container");

cover.inheritWidthFrom = "survey";
cover.survey.width = "500";
assert.equal(cover.survey.widthMode, "auto", "default widthMode");
assert.equal(cover.inheritWidthFrom, "survey", "default inheritWidthFrom");
assert.equal(cover.maxWidth, "500px", "default maxWidth");

cover.survey = new SurveyModel({ widthMode: "responsive", width: "500" });
assert.equal(cover.maxWidth, false, "survey.maxWidth is responsive");

cover.survey = new SurveyModel({ widthMode: "static", width: "500" });
assert.equal(cover.maxWidth, "500px", "survey.maxWidth is static");

cover.inheritWidthFrom = "container";
assert.equal(cover.maxWidth, false, "inheritWidthFrom is container");
}
);

Expand All @@ -79,18 +77,18 @@ QUnit.test("contentClasses",
const cover = new Cover();
cover.survey = new SurveyModel();

assert.equal(cover.inheritWidthFrom, "container", "default inheritWidthFrom");
assert.equal(cover.contentClasses, "sv-header__content sv-header__content--responsive", "inheritWidthFrom is container");

cover.inheritWidthFrom = "survey";
assert.equal(cover.survey.widthMode, "auto", "default widthMode");
assert.equal(cover.inheritWidthFrom, "survey", "default inheritWidthFrom");
assert.equal(cover.contentClasses, "sv-header__content sv-header__content--static", "default contentClasses");

cover.survey.widthMode = "responsive";
assert.equal(cover.contentClasses, "sv-header__content sv-header__content--responsive", "survey.widthMode is responsive");

cover.survey.widthMode = "static";
assert.equal(cover.contentClasses, "sv-header__content sv-header__content--static", "survey.widthMode is static");

cover.inheritWidthFrom = "container";
assert.equal(cover.contentClasses, "sv-header__content sv-header__content--responsive", "inheritWidthFrom is container");
}
);

Expand Down
2 changes: 2 additions & 0 deletions visualRegressionTests/tests/defaultV2/advancedHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ frameworks.forEach(framework => {
(<any>window).survey.applyTheme({
"header": {
height: "500px",
inheritWidthFrom: "survey"
}
});
})();
Expand Down Expand Up @@ -70,6 +71,7 @@ frameworks.forEach(framework => {
(<any>window).survey.applyTheme({
"header": {
height: "500px",
inheritWidthFrom: "survey",
"overlapEnabled": true,
},
"cssVariables": {
Expand Down

0 comments on commit 0276a90

Please sign in to comment.