Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6828 Dropdown is active on Creator design surface #6829

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dropdownListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class DropdownListModel extends Base {
}

public onClick(event: any): void {
if(this.question.readOnly) return;
if (this.question.readOnly || this.question.isDesignMode) return;
this._popupModel.toggleVisibility();
this.focusItemOnClickAndPopup();
if (this.searchEnabled && !!event && !!event.target) {
Expand Down
18 changes: 18 additions & 0 deletions tests/dropdown_list_model_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,3 +846,21 @@ QUnit.test("lazy loading clear value", function (assert) {
assert.equal(dropdownListModel.inputStringRendered, "");
});

QUnit.test("Dropdown should noy be open on click in design mode", (assert) => {
const survey = new SurveyModel(jsonDropdown);
const question = <QuestionDropdownModel>survey.getAllQuestions()[0];
const dropdownListModel = question.dropdownListModel;
assert.ok(dropdownListModel.popupModel);

const list: ListModel = dropdownListModel.popupModel.contentComponentData.model as ListModel;
assert.equal(list.actions.length, 28);
assert.notOk(dropdownListModel.popupModel.isVisible);
dropdownListModel.onClick(new Event("click"));
assert.ok(dropdownListModel.popupModel.isVisible);
dropdownListModel.onClick(new Event("click"));
assert.notOk(dropdownListModel.popupModel.isVisible);
survey.setDesignMode(true);

dropdownListModel.onClick(new Event("click"));
assert.notOk(dropdownListModel.popupModel.isVisible);
});