diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 016282a68b..d361a4ad95 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -536,7 +536,7 @@ export default class MessageComposerInput extends React.Component { // bit of a hack, but the alternative would be quite complicated if (contentHTML) contentHTML = contentHTML.replace('/me', ''); sendHtmlFn = this.client.sendHtmlEmote; - sendTextFn = this.client.sendTextEmote; + sendTextFn = this.client.sendEmoteMessage; } // XXX: We don't actually seem to use this history? diff --git a/test/components/views/rooms/MessageComposerInput-test.js b/test/components/views/rooms/MessageComposerInput-test.js index 126034a40b..fe59722bcb 100644 --- a/test/components/views/rooms/MessageComposerInput-test.js +++ b/test/components/views/rooms/MessageComposerInput-test.js @@ -68,15 +68,17 @@ describe('MessageComposerInput', () => { }); it('should not send messages when composer is empty', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const textSpy = sinon.spy(client, 'sendTextMessage'); + const htmlSpy = sinon.spy(client, 'sendHtmlMessage'); mci.enableRichtext(true); mci.handleReturn(sinon.stub()); - expect(spy.calledOnce).toEqual(false, 'should not send message'); + expect(textSpy.calledOnce).toEqual(false, 'should not send text message'); + expect(htmlSpy.calledOnce).toEqual(false, 'should not send html message'); }); it('should not change content unnecessarily on RTE -> Markdown conversion', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const spy = sinon.spy(client, 'sendTextMessage'); mci.enableRichtext(true); addTextToDraft('a'); mci.handleKeyCommand('toggle-mode'); @@ -87,7 +89,7 @@ describe('MessageComposerInput', () => { }); it('should not change content unnecessarily on Markdown -> RTE conversion', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const spy = sinon.spy(client, 'sendTextMessage'); mci.enableRichtext(false); addTextToDraft('a'); mci.handleKeyCommand('toggle-mode'); @@ -97,7 +99,7 @@ describe('MessageComposerInput', () => { }); it('should send emoji messages in rich text', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const spy = sinon.spy(client, 'sendTextMessage'); mci.enableRichtext(true); addTextToDraft('☹'); mci.handleReturn(sinon.stub()); @@ -106,7 +108,7 @@ describe('MessageComposerInput', () => { }); it('should send emoji messages in Markdown', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const spy = sinon.spy(client, 'sendTextMessage'); mci.enableRichtext(false); addTextToDraft('☹'); mci.handleReturn(sinon.stub()); @@ -139,7 +141,7 @@ describe('MessageComposerInput', () => { // }); it('should insert formatting characters in Markdown mode', () => { - const spy = sinon.spy(client, 'sendHtmlMessage'); + const spy = sinon.spy(client, 'sendTextMessage'); mci.enableRichtext(false); mci.handleKeyCommand('italic'); mci.handleReturn(sinon.stub()); diff --git a/test/test-utils.js b/test/test-utils.js index e4c01d5c52..9df623d732 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -54,6 +54,7 @@ export function stubClient() { }, setAccountData: sinon.stub(), sendTyping: sinon.stub().returns(q({})), + sendTextMessage: () => q({}), sendHtmlMessage: () => q({}), };