Skip to content

Commit

Permalink
Fix setActionsMode is not updating mode for actions with disableShrin…
Browse files Browse the repository at this point in the history
…k: true (#9078)
  • Loading branch information
dk981234 authored Nov 20, 2024
1 parent 3115189 commit fb19134
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/survey-core/src/actions/adaptive-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ export class AdaptiveActionContainer<T extends Action = Action> extends ActionCo
}
public setActionsMode(mode: actionModeType) {
this.actions.forEach((action) => {
if(mode == "small" && action.disableShrink) return;
action.mode = mode;
if(mode == "small" && action.disableShrink) {
action.mode = "large";
} else {
action.mode = mode;
}
});
}
public dispose(): void {
Expand Down
17 changes: 17 additions & 0 deletions packages/survey-core/tests/responsivityTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,4 +593,21 @@ QUnit.test("check title change calls raise update", function (assert) {
assert.equal(log, "->called: true->called: true", "called from title change");
item1.title = "Test";
assert.equal(log, "->called: true->called: true");
});

QUnit.test("check actions mode is set correctly when disableShrink is set", function (assert) {
const model: AdaptiveActionContainer = new AdaptiveActionContainer();
const action = model.addAction({
disableShrink: true,
title: "test"
});
assert.equal(action.mode, "large");
model.setActionsMode("removed");
assert.equal(action.mode, "removed");
model.setActionsMode("large");
assert.equal(action.mode, "large");
model.setActionsMode("popup");
assert.equal(action.mode, "popup");
model.setActionsMode("small");
assert.equal(action.mode, "large");
});

0 comments on commit fb19134

Please sign in to comment.