FIX: Toggle search menu when click the same button (#13781)

This commit is contained in:
Penar Musaraj 2021-07-19 19:01:09 -04:00 committed by GitHub
parent fe5be427c3
commit e3144fc0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -286,7 +286,7 @@ export default createWidget("search-menu", {
});
},
mouseDownOutside() {
clickOutside() {
this.sendWidgetAction("toggleSearchMenu");
},

View File

@ -52,6 +52,22 @@ acceptance("Search - Anonymous", function (needs) {
);
});
test("search button toggles search menu", async function (assert) {
await visit("/");
await click("#search-button");
assert.ok(exists(".search-menu"));
await click(".d-header"); // click outside
assert.ok(!exists(".search-menu"));
await click("#search-button");
assert.ok(exists(".search-menu"));
await click("#search-button"); // toggle same button
assert.ok(!exists(".search-menu"));
});
test("search for a tag", async function (assert) {
await visit("/");