Fix Emoji detection

And move to Zotero.Utilities.Internal.isOnlyEmoji()

Fixes #2643
This commit is contained in:
Dan Stillman 2022-06-07 20:02:48 -04:00
parent 3481def4f6
commit 011b60af61
3 changed files with 26 additions and 7 deletions

View file

@ -68,6 +68,25 @@ describe("Zotero.Utilities.Internal", function () {
});
describe("#isOnlyEmoji()", function () {
it("should return true for emoji", function () {
assert.isTrue(Zotero.Utilities.Internal.isOnlyEmoji("🐩"));
});
it("should return true for emoji with text representation that use Variation Selector-16", function () {
assert.isTrue(Zotero.Utilities.Internal.isOnlyEmoji("⭐️"));
});
it("should return true for emoji made up of multiple characters with ZWJ", function () {
assert.isTrue(Zotero.Utilities.Internal.isOnlyEmoji("👨‍🌾"));
});
it("should return false for integer", function () {
assert.isFalse(Zotero.Utilities.Internal.isOnlyEmoji("0"));
});
});
describe("#delayGenerator", function () {
var spy;