Skip to content

Commit

Permalink
#6210 Questions lock button is reset on tab change (#6212)
Browse files Browse the repository at this point in the history
Fixes #6210
  • Loading branch information
novikov82 authored Dec 11, 2024
1 parent e029812 commit ff5ee95
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class TabDesignerViewModel extends Base {
locTooltipName: "ed.lockQuestionsTooltip",
iconName: "icon-questionlock-24x24",
iconSize: "auto",
active: this.creator.expandCollapseManager.questionsLocked,
visible: new ComputedUpdater<boolean>(() => this.creator.expandCollapseButtonVisibility != "never"),
action: (action) => {
action.active = !action.active;
Expand Down
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/expand-collapse-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export class ExpandCollapseManager {
this.updateCollapsed(elements || this.getCollapsableElements(), isCollapsed, reason);
}

public get questionsLocked() {
return this._lockQuestions;
}
public lockQuestions(locked: boolean) {
this._lockQuestions = locked;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/survey-creator-core/tests/tabs/designer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,22 @@ test("Check adorners lock questions for expand/collapse all", (): any => {
expect(questionAdorner.collapsed).toBeFalsy();
});

test("Check lock questions action on tab change", (): any => {
surveySettings.animationEnabled = false;
const creator = new CreatorTester();
creator.expandCollapseButtonVisibility = "onhover";
const designerPlugin = <TabDesignerPlugin>(
creator.getPlugin("designer")
);
const lockQuestions = designerPlugin.model.surfaceToolbar.getActionById("lockQuestions");
lockQuestions.action(lockQuestions);
expect(lockQuestions.active).toBeTruthy();
designerPlugin.deactivate();
designerPlugin.activate();
const lockQuestionsNew = designerPlugin.model.surfaceToolbar.getActionById("lockQuestions");
expect(lockQuestionsNew.active).toBeTruthy();
});

test("expand/collapse event and expand all", () => {
surveySettings.animationEnabled = false;
const creator = new CreatorTester();
Expand Down

0 comments on commit ff5ee95

Please sign in to comment.