mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 13:03:45 +08:00
FIX: Regression with special a
keyword in search (#19063)
Fixes a regression introduced in ac7bf98
.
This commit is contained in:
parent
7465fadca0
commit
0ef8d0a7bc
|
@ -373,7 +373,7 @@ export default createWidget("search-menu", {
|
|||
return;
|
||||
}
|
||||
|
||||
if (e.key === "A") {
|
||||
if (e.which === 65 /* a */) {
|
||||
if (document.activeElement?.classList.contains("search-link")) {
|
||||
if (document.querySelector("#reply-control.open")) {
|
||||
// add a link and focus composer
|
||||
|
|
|
@ -374,6 +374,17 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
|
||||
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) {
|
||||
|
@ -519,6 +530,30 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
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) {
|
||||
await visit("/");
|
||||
await click("#search-button");
|
||||
|
|
Loading…
Reference in New Issue
Block a user