mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
DEV: emoji helper: add the ability to set custom title (#17517)
This commit is contained in:
parent
80bda4a9db
commit
48e2caf7b7
@ -11,4 +11,13 @@ module("Integration | Helper | emoji", function (hooks) {
|
||||
await render(hbs`{{emoji "tada"}}`);
|
||||
assert.ok(exists(`.emoji[title="tada"]`));
|
||||
});
|
||||
|
||||
test("it renders custom title", async function (assert) {
|
||||
const title = "custom title";
|
||||
this.set("title", title);
|
||||
|
||||
await render(hbs`{{emoji "tada" title=this.title}}`);
|
||||
|
||||
assert.ok(exists(`.emoji[title="${title}"]`));
|
||||
});
|
||||
});
|
||||
|
@ -92,12 +92,13 @@ export function performEmojiUnescape(string, opts) {
|
||||
(isEmoticon || hasEndingColon || isUnicodeEmoticon) &&
|
||||
isReplacableInlineEmoji(string, index, opts.inlineEmoji);
|
||||
|
||||
const title = opts.title ?? emojiVal;
|
||||
return url && isReplacable
|
||||
? `<img width="20" height="20" src='${url}' ${
|
||||
opts.skipTitle ? "" : `title='${emojiVal}'`
|
||||
opts.skipTitle ? "" : `title='${title}'`
|
||||
} ${
|
||||
opts.lazy ? "loading='lazy' " : ""
|
||||
}alt='${emojiVal}' class='${classes}'>`
|
||||
}alt='${title}' class='${classes}'>`
|
||||
: m;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user