mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: Don't display duplicated emoji in picker
This commit is contained in:
parent
22249806a8
commit
2dcad9772f
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
|
@ -28,6 +29,15 @@ acceptance("EmojiPicker", function (needs) {
|
|||
assert.notOk(exists(".emoji-picker.opened"), "it closes the picker");
|
||||
});
|
||||
|
||||
test("filters emoji", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click("button.emoji.btn");
|
||||
await fillIn(".emoji-picker input.filter", "guitar");
|
||||
|
||||
assert.strictEqual(query(`.emoji-picker .results img`).title, "guitar");
|
||||
});
|
||||
|
||||
test("emoji picker triggers event when picking emoji", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
|
|
@ -150,4 +150,12 @@ discourseModule("Unit | Utility | emoji", function () {
|
|||
"green_apple",
|
||||
]);
|
||||
});
|
||||
|
||||
test("search does not return duplicated results", function (assert) {
|
||||
const matches = emojiSearch("bow").filter(
|
||||
(emoji) => emoji === "bowing_man"
|
||||
);
|
||||
|
||||
assert.deepEqual(matches, ["bowing_man"]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -223,7 +223,9 @@ export function emojiSearch(term, options) {
|
|||
}
|
||||
|
||||
if (searchAliases[term]) {
|
||||
results.push.apply(results, searchAliases[term]);
|
||||
for (const emoji of searchAliases[term]) {
|
||||
addResult(emoji);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < toSearch.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user