Commit 5ffb09bd authored by JC Brand's avatar JC Brand

Updates #161: Treat sent files also as oob messages

parent ab09379a
...@@ -337,6 +337,7 @@ ...@@ -337,6 +337,7 @@
expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1'); expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1');
message.save({ message.save({
'upload': _converse.SUCCESS, 'upload': _converse.SUCCESS,
'oob_url': message.get('get'),
'message': message.get('get') 'message': message.get('get')
}); });
}); });
...@@ -365,9 +366,10 @@ ...@@ -365,9 +366,10 @@
}, 1000); }, 1000);
}).then(function () { }).then(function () {
// Check that the image renders // Check that the image renders
expect(view.el.querySelector('.chat-message .chat-msg-content').innerHTML).toEqual( expect(view.el.querySelector('.chat-msg .chat-msg-media').innerHTML.trim()).toEqual(
'<a target="_blank" rel="noopener" href="http://localhost:8000/logo/conversejs-filled.svg">'+ '<a href="http://localhost:8000/logo/conversejs-filled.svg" target="_blank" rel="noopener">'+
'<img class="chat-image" src="http://localhost:8000/logo/conversejs-filled.svg"></a>') '<img class="chat-image img-thumbnail" src="http://localhost:8000/logo/conversejs-filled.svg">'+
'</a>');
XMLHttpRequest.prototype.send = send_backup; XMLHttpRequest.prototype.send = send_backup;
done(); done();
}); });
...@@ -442,6 +444,7 @@ ...@@ -442,6 +444,7 @@
expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1'); expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1');
message.save({ message.save({
'upload': _converse.SUCCESS, 'upload': _converse.SUCCESS,
'oob_url': message.get('get'),
'message': message.get('get') 'message': message.get('get')
}); });
}); });
...@@ -470,9 +473,9 @@ ...@@ -470,9 +473,9 @@
}, 1000); }, 1000);
}).then(function () { }).then(function () {
// Check that the image renders // Check that the image renders
expect(view.el.querySelector('.chat-message .chat-msg-content').innerHTML).toEqual( expect(view.el.querySelector('.chat-msg .chat-msg-media').innerHTML.trim()).toEqual(
'<a target="_blank" rel="noopener" href="http://localhost:8000/logo/conversejs-filled.svg">'+ '<a href="http://localhost:8000/logo/conversejs-filled.svg" target="_blank" rel="noopener">'+
'<img class="chat-image" src="http://localhost:8000/logo/conversejs-filled.svg"></a>') '<img class="chat-image img-thumbnail" src="http://localhost:8000/logo/conversejs-filled.svg"></a>')
XMLHttpRequest.prototype.send = send_backup; XMLHttpRequest.prototype.send = send_backup;
done(); done();
}); });
...@@ -680,7 +683,7 @@ ...@@ -680,7 +683,7 @@
expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('0.5'); expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('0.5');
message.set('progress', 1); message.set('progress', 1);
expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1'); expect(view.el.querySelector('.chat-content progress').getAttribute('value')).toBe('1');
expect(view.el.querySelector('.chat-content .chat-msg-content').textContent).toBe('Uploading file: my-juliet.jpg, 22.91 KB'); expect(view.el.querySelector('.chat-content .chat-msg-text').textContent).toBe('Uploading file: my-juliet.jpg, 22.91 KB');
done(); done();
}); });
var sent_stanza; var sent_stanza;
......
...@@ -148,6 +148,7 @@ ...@@ -148,6 +148,7 @@
if (xhr.status === 200 || xhr.status === 201) { if (xhr.status === 200 || xhr.status === 201) {
this.save({ this.save({
'upload': _converse.SUCCESS, 'upload': _converse.SUCCESS,
'oob_url': this.get('get'),
'message': this.get('get') 'message': this.get('get')
}); });
} else { } else {
......
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