Fix tests

// FREEBIE
This commit is contained in:
lilia 2016-09-01 13:31:36 -07:00
parent bf1d6fc02f
commit 7e0df07e88
3 changed files with 11 additions and 9 deletions

View file

@ -13,7 +13,7 @@
} }
this.inits.env = 1; this.inits.env = 1;
this.include_title = true; this.include_title = true;
this.img_sets.apple.path = 'images/emoji/apple/'; this.img_sets.apple.path = '/images/emoji/apple/';
this.replace_mode = 'img'; this.replace_mode = 'img';
}; };
EmojiConvertor.prototype.replace_unified = function(str) { EmojiConvertor.prototype.replace_unified = function(str) {
@ -43,7 +43,7 @@
emoji.init_colons(); emoji.init_colons();
window.emoji_util.parse = function($el) { window.emoji_util.parse = function($el) {
$el.html(emoji.replace_unified($el.text())); $el.html(emoji.replace_unified($el.html()));
}; };
})(); })();

View file

@ -32,10 +32,12 @@
</script> </script>
<script type='text/x-tmpl-mustache' id='message'> <script type='text/x-tmpl-mustache' id='message'>
{{> avatar }} {{> avatar }}
<div class="bubble"> <div class='bubble {{ avatar.color }}'>
<div class='sender'>{{ sender }}</div> <div class='sender' dir='auto'>{{ sender }}</div>
<div class='attachments'></div> <div class='attachments'></div>
<p class="content">{{ message }}</p> <p class='content' dir='auto'>
{{ #message }}<span class='body'>{{ message }}</span>{{ /message }}
</p>
<div class='meta'> <div class='meta'>
<span class='timestamp' data-timestamp={{ timestamp }}></span> <span class='timestamp' data-timestamp={{ timestamp }}></span>
<span class='status hide'></span> <span class='status hide'></span>

View file

@ -58,7 +58,7 @@ describe('MessageView', function() {
message.set('body', url); message.set('body', url);
var view = new Whisper.MessageView({model: message}); var view = new Whisper.MessageView({model: message});
view.render(); view.render();
var link = view.$el.find('.content a'); var link = view.$el.find('.body a');
assert.strictEqual(link.length, 1); assert.strictEqual(link.length, 1);
assert.strictEqual(link.text(), url); assert.strictEqual(link.text(), url);
assert.strictEqual(link.attr('href'), url); assert.strictEqual(link.attr('href'), url);
@ -73,14 +73,14 @@ describe('MessageView', function() {
assert.strictEqual(view.$el.find('script').length, 0); // should not appear as html assert.strictEqual(view.$el.find('script').length, 0); // should not appear as html
}); });
it('supports twemoji', function() { it('supports emoji', function() {
message.set('body', 'I \u2764\uFE0F emoji!'); message.set('body', 'I \u2764\uFE0F emoji!');
var view = new Whisper.MessageView({model: message}); var view = new Whisper.MessageView({model: message});
view.render(); view.render();
var img = view.$el.find('.content img'); var img = view.$el.find('.content img');
assert.strictEqual(img.length, 1); assert.strictEqual(img.length, 1);
assert.strictEqual(img.attr('src'), '/images/twemoji/16x16/2764.png'); assert.strictEqual(img.attr('src'), '/images/emoji/apple/2764.png');
assert.strictEqual(img.attr('alt'), '\u2764\uFE0F'); assert.strictEqual(img.attr('title'), ':heart:');
assert.strictEqual(img.attr('class'), 'emoji'); assert.strictEqual(img.attr('class'), 'emoji');
}); });
}); });