Skip to content

Commit

Permalink
#6945 Adaptive Container incorrectly calculates width for hidden acti…
Browse files Browse the repository at this point in the history
…ons (#6946)

* Fixes #6945

* #6945 - fix test

* 36945 - fixed test

* #6945 Adaptive Container incorrectly calculates width for hidden actions - revert example html
Fixes #6945
  • Loading branch information
novikov82 committed Sep 13, 2023
1 parent 9028106 commit 6de4a7b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/common-styles/sv-actionbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ button.sv-action-bar-item {
height: 0px;
overflow: hidden;
visibility: hidden;
.sv-action__content {
min-width: fit-content;
}
}

.sv-action__content {
Expand Down
32 changes: 31 additions & 1 deletion testCafe/survey/titleActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { frameworks, url, initSurvey } from "../helper";
import { frameworks, url, initSurvey, url_test, applyTheme } from "../helper";
import { Selector, ClientFunction, fixture, test } from "testcafe";
const title = "titleActions";

Expand Down Expand Up @@ -311,3 +311,33 @@ frameworks.forEach((framework) => {
.expect(dotsItem.visible).notOk();
});
});

const themeName = "defaultV2";

frameworks.forEach((framework) => {
fixture`${framework} ${title}`
.page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => {
await applyTheme(themeName);
});
test("check hidden action content has non-zero width", async (t) => {
await initSurvey(framework, json, {
onGetQuestionTitleActions: (_, opt) => {
opt.titleActions = [
{
title: "Action",
visible: false,
action: () => {
opt.question.state = "expanded";
},
},
];
},
});
const hiddenAction = Selector("h5 .sv-action.sv-action--hidden");
await t
.expect(hiddenAction.find(".sv-action__content").offsetWidth).gt(0)
.expect(ClientFunction(() => {
return window["survey"].getAllQuestions()[0].getTitleToolbar().actions[0].maxDimension;
})()).gt(0);
});
});

0 comments on commit 6de4a7b

Please sign in to comment.