FIX: Regression with special `a` keyword in search (#19063)

Fixes a regression introduced in ac7bf98.
This commit is contained in:
Penar Musaraj 2022-11-16 21:51:29 -05:00 committed by GitHub
parent 7465fadca0
commit 0ef8d0a7bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View File

@ -373,7 +373,7 @@ export default createWidget("search-menu", {
return; return;
} }
if (e.key === "A") { if (e.which === 65 /* a */) {
if (document.activeElement?.classList.contains("search-link")) { if (document.activeElement?.classList.contains("search-link")) {
if (document.querySelector("#reply-control.open")) { if (document.querySelector("#reply-control.open")) {
// add a link and focus composer // add a link and focus composer

View File

@ -374,6 +374,17 @@ acceptance("Search - Authenticated", function (needs) {
return helper.response(searchFixtures["search/query"]); return helper.response(searchFixtures["search/query"]);
}); });
server.get("/inline-onebox", () =>
helper.response({
"inline-oneboxes": [
{
url: "http://www.something.com",
title: searchFixtures["search/query"].topics[0].title,
},
],
})
);
}); });
test("Right filters are shown in full page search", async function (assert) { test("Right filters are shown in full page search", async function (assert) {
@ -519,6 +530,30 @@ acceptance("Search - Authenticated", function (needs) {
assert.ok(exists(query(`.search-menu`)), "search dropdown is visible"); assert.ok(exists(query(`.search-menu`)), "search dropdown is visible");
}); });
test("search while composer is open", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".reply");
await fillIn(".d-editor-input", "a link");
await click("#search-button");
await fillIn("#search-term", "dev");
await triggerKeyEvent("#search-term", "keydown", "Enter");
await triggerKeyEvent(".search-menu", "keydown", "ArrowDown");
await triggerKeyEvent("#search-term", "keydown", 65); // maps to lowercase a
assert.ok(
query(".d-editor-input").value.includes("a link"),
"still has the original composer content"
);
assert.ok(
query(".d-editor-input").value.includes(
searchFixtures["search/query"].topics[0].slug
),
"adds link from search to composer"
);
});
test("Shows recent search results", async function (assert) { test("Shows recent search results", async function (assert) {
await visit("/"); await visit("/");
await click("#search-button"); await click("#search-button");