瀏覽代碼

Updated package-lock. Fix tests.

JC Brand 8 年之前
父節點
當前提交
3fabe88970
共有 4 個文件被更改,包括 289 次插入187 次删除
  1. 1 1
      Makefile
  2. 268 140
      package-lock.json
  3. 0 33
      spec/chatbox.js
  4. 20 13
      src/utils.js

+ 1 - 1
Makefile

@@ -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

文件差異過大導致無法顯示
+ 268 - 140
package-lock.json


+ 0 - 33
spec/chatbox.js

@@ -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'], {},

+ 20 - 13
src/utils.js

@@ -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));

部分文件因文件數量過多而無法顯示