Skip to content

Commit 09c25a7

Browse files
tsv2013tsv2013
and
tsv2013
authored
Theme Editor: It's impossible to switch from advanced to basic header after changing some settings of advanced header (#6667)
Fixes #6664 Co-authored-by: tsv2013 <tsv2013@noreply.github.com>
1 parent bc975bf commit 09c25a7

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/survey-creator-core/src/creator-base.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,9 @@ export class SurveyCreatorModel extends Base
12281228
if (this.activeTab !== "theme") {
12291229
this.updatePlugin(this.activeTab);
12301230
}
1231+
if (!!newTheme && newTheme.headerView) {
1232+
this.survey.headerView = newTheme.headerView;
1233+
}
12311234
}
12321235

12331236
private _doSaveThemeCore(onSaveComplete?: () => void) {

packages/survey-creator-core/tests/creator-base-2.tests.ts

+9
Original file line numberDiff line numberDiff line change
@@ -445,4 +445,13 @@ test("activatePropertyGridCategory function", (): any => {
445445

446446
creator.activatePropertyGridCategory("pages");
447447
expect(propertyGrid.survey.currentPage.name).toBe("pages");
448+
});
449+
450+
test("creator set theme should update headerView survey property", (): any => {
451+
const creator = new CreatorTester();
452+
expect(creator.survey.headerView).toBe("advanced");
453+
creator.theme = {};
454+
expect(creator.survey.headerView).toBe("advanced");
455+
creator.theme = { headerView: "basic" };
456+
expect(creator.survey.headerView).toBe("basic");
448457
});

packages/survey-creator-core/tests/tabs/theme-tab-plugin.tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ test("Theme onModified and saveThemeFunc", (): any => {
341341

342342
themeModel.header["headerView"] = "basic";
343343
expect(modificationsLog).toBe("->THEME_MODIFIED->THEME_SELECTED->THEME_MODIFIED->THEME_MODIFIED->THEME_MODIFIED");
344-
expect(saveCount).toBe(0);
344+
expect(saveCount).toBe(1);
345345
expect(saveThemeCount).toBe(5);
346346
expect(creator.hasPendingThemeChanges).toBeFalsy();
347347
expect(themePlugin.isModified).toBeTruthy();

0 commit comments

Comments
 (0)