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

Disallow multiple dropdowns #17083

Open
wants to merge 4 commits into
base: gh-pages
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
coverage/
coverage/
.idea/
6 changes: 4 additions & 2 deletions awesomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ _.prototype = {
this._list = list;
}
else if (typeof list === "string" && list.indexOf(",") > -1) {
this._list = list.split(/\s*,\s*/);
this._list = list.split(/\s*,\s*/);
}
else { // Element or CSS selector
list = $(list);
Expand Down Expand Up @@ -292,7 +292,9 @@ _.prototype = {
if (this.ul.children.length === 0) {
this.close({ reason: "nomatches" });
} else {
this.open();
// If the dropdown is already open, don't open again.
if (!this.isOpened)
this.open();
}
}
else {
Expand Down
3 changes: 2 additions & 1 deletion test/api/evaluateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe("awesomplete.evaluate", function () {
spyOn(this.subject, "open");
this.subject.evaluate();

expect(this.subject.open).toHaveBeenCalled();
if (!this.subject.isOpened)
expect(this.subject.open).toHaveBeenCalled();
});

it("fills completer with found items", function () {
Expand Down