Skip to content

Commit

Permalink
A popup appears at an incorrect position after enabling the Dropdown …
Browse files Browse the repository at this point in the history
…question

Fixes #6683
  • Loading branch information
Aleksey Novikov committed Aug 10, 2023
1 parent 3433fce commit 60470bb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dropdownListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export class DropdownListModel extends Base {
}

public onClick(event: any): void {
if(this.question.readOnly) return;
this._popupModel.toggleVisibility();
this.focusItemOnClickAndPopup();
if (this.searchEnabled && !!event && !!event.target) {
Expand Down
36 changes: 36 additions & 0 deletions testCafe/questions/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1945,4 +1945,40 @@ frameworks.forEach((framework) => {
.click(questionDropdownV2Select, { offsetX: dropdownWidth - 20, offsetY: 20 })
.expect(popupContainer.visible).notOk();
});

test.page(`${url_test}${theme}/${framework}`)("Dropdown shold not be open when disabled", async (t) => {
await t.resizeWindow(800, 600);
const jsonWithDropDown = {
pages: [
{
name: "page1",
elements: [
{
type: "boolean",
name: "Editable",
defaultValueExpression: "false"
},
{
type: "dropdown",
name: "Dropdown",
enableIf: "{Editable} = true",
choices: ["Item 1", "Item 2", "Item 3"]
}
]
}
]
};
await initSurvey(framework, jsonWithDropDown);

const questionDropdownV2Select = Selector(".sd-dropdown");
const popupContainer = Selector(".sv-popup__container").filterVisible();
await t

.click(questionDropdownV2Select)
.expect(popupContainer.visible).notOk()

.click(Selector(".sd-boolean__label").withText("Yes"))
.expect(Selector(".sd-boolean__thumb-text").withText("Yes").visible).ok()
.expect(popupContainer.visible).notOk();
});
});

0 comments on commit 60470bb

Please sign in to comment.