2019-07-26 03:47:36 +02:00
|
|
|
set_global('emoji_codes', zrequire('emoji_codes', 'generated/emoji/emoji_codes'));
|
2017-11-08 17:17:46 +01:00
|
|
|
zrequire('emoji');
|
|
|
|
zrequire('emoji_picker');
|
2017-08-19 01:15:18 +02:00
|
|
|
|
2018-05-15 12:40:07 +02:00
|
|
|
run_test('initialize', () => {
|
2017-08-19 01:15:18 +02:00
|
|
|
emoji.update_emojis({});
|
|
|
|
emoji_picker.initialize();
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const complete_emoji_catalog = _.sortBy(emoji_picker.complete_emoji_catalog, 'name');
|
2020-02-05 05:45:02 +01:00
|
|
|
assert.equal(complete_emoji_catalog.length, 10);
|
2018-07-20 13:43:22 +02:00
|
|
|
assert.equal(_.keys(emoji.emojis_by_name).length, 1037);
|
2017-08-19 01:15:18 +02:00
|
|
|
|
|
|
|
function assert_emoji_category(ele, icon, num) {
|
|
|
|
assert.equal(ele.icon, icon);
|
|
|
|
assert.equal(ele.emojis.length, num);
|
|
|
|
function check_emojis(val) {
|
|
|
|
_.each(ele.emojis, function (emoji) {
|
|
|
|
assert.equal(emoji.is_realm_emoji, val);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (ele.name === 'Custom') {
|
|
|
|
check_emojis(true);
|
|
|
|
} else {
|
|
|
|
check_emojis(false);
|
|
|
|
}
|
|
|
|
}
|
2020-02-05 05:45:02 +01:00
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-car', 170);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-hashtag', 180);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-smile-o', 129);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-star-o', 6);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-thumbs-o-up', 102);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-lightbulb-o', 191);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-cutlery', 92);
|
2017-08-19 01:15:18 +02:00
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-cog', 1);
|
2020-02-05 05:45:02 +01:00
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-leaf', 104);
|
|
|
|
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-soccer-ball-o', 63);
|
2018-05-15 12:40:07 +02:00
|
|
|
});
|