Commit 3fabe889 authored by JC Brand's avatar JC Brand

Updated package-lock. Fix tests.

parent 67578c97
......@@ -110,7 +110,7 @@ stamp-bundler: Gemfile
.PHONY: clean
clean:
-rm -f stamp-npm stamp-bundler
-rm -f stamp-npm stamp-bundler package-lock.json
-rm -rf node_modules .bundle
.PHONY: dev
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1238,39 +1238,6 @@
done();
}));
it("should display emoticons correctly",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'current');
test_utils.openControlBox();
test_utils.openContactsPanel(_converse);
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
test_utils.openChatBoxFor(_converse, contact_jid);
var view = _converse.chatboxviews.get(contact_jid);
var messages = [':)', ';)', ':D', ':P', '8)', '>:)', ':S', ':\\', '>:(', ':(', ':O', '(^.^)b', '<3'];
var emoticons = [
'<span class="emoticon icon-smiley"></span>', '<span class="emoticon icon-wink"></span>',
'<span class="emoticon icon-grin"></span>', '<span class="emoticon icon-tongue"></span>',
'<span class="emoticon icon-cool"></span>', '<span class="emoticon icon-evil"></span>',
'<span class="emoticon icon-confused"></span>', '<span class="emoticon icon-wondering"></span>',
'<span class="emoticon icon-angry"></span>', '<span class="emoticon icon-sad"></span>',
'<span class="emoticon icon-shocked"></span>', '<span class="emoticon icon-thumbs-up"></span>',
'<span class="emoticon icon-heart"></span>'
];
spyOn(view, 'sendMessage').and.callThrough();
for (var i = 0; i < messages.length; i++) {
var message = messages[i];
test_utils.sendMessage(view, message);
expect(view.sendMessage).toHaveBeenCalled();
var msg = view.$el.find('.chat-content').find('.chat-message').last().find('.chat-msg-content');
expect(msg.html()).toEqual(emoticons[i]);
}
done();
}));
it("can contain hyperlinks, which will be clickable",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
......
......@@ -574,23 +574,30 @@
* lists of emojis in that category as values.
*/
if (_.isUndefined(this.emojis_by_category)) {
var emojis = _.values(_.mapValues(emojione.emojioneList, function (value, key, o) {
const emojis = _.values(_.mapValues(emojione.emojioneList, function (value, key, o) {
value._shortname = key;
return value
}));
var tones = [':tone1:', ':tone2:', ':tone3:', ':tone4:', ':tone5:'];
var excluded = [':kiss_ww:', ':kiss_mm:', ':kiss_woman_man:'];
var excluded_substrings = [':woman', ':man', ':women_', ':men_', '_man_', '_woman_', '_woman:', '_man:'];
var categories = _.uniq(_.map(emojis, _.partial(_.get, _, 'category')));
var emojis_by_category = {};
_.forEach(categories, function (cat) {
var list = _.sortBy(_.filter(emojis, ['category', cat]), ['uc_base']);
list = _.filter(list, function (item) {
return !_.includes(_.concat(tones, excluded), item._shortname) &&
!_.some(excluded_substrings, _.partial(_.includes, item._shortname));
});
const tones = [':tone1:', ':tone2:', ':tone3:', ':tone4:', ':tone5:'];
const excluded = [':kiss_ww:', ':kiss_mm:', ':kiss_woman_man:'];
const excluded_substrings = [
':woman', ':man', ':women_', ':men_', '_man_', '_woman_', '_woman:', '_man:'
];
const excluded_categories = ['modifier'];
const categories = _.difference(
_.uniq(_.map(emojis, _.partial(_.get, _, 'category'))),
excluded_categories
);
const emojis_by_category = {};
_.forEach(categories, (cat) => {
let list = _.sortBy(_.filter(emojis, ['category', cat]), ['uc_base']);
list = _.filter(
list,
(item) => !_.includes(_.concat(tones, excluded), item._shortname) &&
!_.some(excluded_substrings, _.partial(_.includes, item._shortname))
);
if (cat === 'people') {
var idx = _.findIndex(list, ['uc_base', '1f600']);
const idx = _.findIndex(list, ['uc_base', '1f600']);
list = _.union(_.slice(list, idx), _.slice(list, 0, idx+1));
} else if (cat === 'activity') {
list = _.union(_.slice(list, 27-1), _.slice(list, 0, 27));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment