Skip to content

Commit

Permalink
[FIX] web: emoji picker search with 1 char
Browse files Browse the repository at this point in the history
Before this commit, searching emoji required at least 2 chars.
There is no reason to not allow 1 char, especially when searching
some emoji that are best found with a single char, e.g. "9️⃣" with
"9".

closes odoo#199084

X-original-commit: 36fcb71
Signed-off-by: Sébastien Theys (seb) <[email protected]>
Signed-off-by: Alexandre Kühn (aku) <[email protected]>
  • Loading branch information
alexkuhn committed Feb 24, 2025
1 parent 9255c48 commit 6318167
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions addons/mail/static/tests/emoji/emoji.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ test("search emoji from keywords", async () => {
await click("button[aria-label='Emojis']");
await insertText("input[placeholder='Search emoji']", "mexican");
await contains(".o-Emoji", { text: "🌮" });
await insertText("input[placeholder='Search emoji']", "9", { replace: true });
await contains(".o-Emoji:eq(0)", { text: "🕘" });
await contains(".o-Emoji:eq(1)", { text: "🕤" });
await contains(".o-Emoji:eq(2)", { text: "9️⃣" });
});

test("search emoji from keywords should be case insensitive", async () => {
Expand Down
2 changes: 1 addition & 1 deletion addons/web/static/src/core/emoji_picker/emoji_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export class EmojiPicker extends Component {
if (recentEmojis.length > 0 && this.searchTerm) {
emojisToDisplay = emojisToDisplay.filter((emoji) => !recentEmojis.includes(emoji));
}
if (this.searchTerm.length > 1) {
if (this.searchTerm.length > 0) {
return fuzzyLookup(this.searchTerm, emojisToDisplay, (emoji) => [
emoji.name,
...emoji.keywords,
Expand Down

0 comments on commit 6318167

Please sign in to comment.