Skip to content

Commit

Permalink
work for the #8493 (#8497)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov authored Jul 2, 2024
1 parent c7aa246 commit 22aa156
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dropdownListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export class DropdownListModel extends Base {
}

public onClick(event: any): void {
if (this.question.readOnly || this.question.isDesignMode || this.question.isPreviewStyle) return;
if (this.question.readOnly || this.question.isDesignMode || this.question.isPreviewStyle || this.question.isReadOnlyAttr) return;
this._popupModel.toggleVisibility();
this.focusItemOnClickAndPopup();
this.question.focus();
Expand Down
13 changes: 13 additions & 0 deletions tests/dropdown_list_model_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,19 @@ QUnit.test("Dropdown should not be open on click in preview mode", (assert) => {
assert.notOk(popupModel.isVisible);
});

QUnit.test("Dropdown should not be open on click in display mode", (assert) => {
const survey = new SurveyModel(jsonDropdown);
survey.mode = "display";

const question = <QuestionDropdownModel>survey.getAllQuestions()[0];

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

QUnit.test("order & locale change", function (assert) {
const survey = new SurveyModel({ elements: [
{ type: "dropdown", name: "q1", choicesOrder: "asc",
Expand Down

0 comments on commit 22aa156

Please sign in to comment.