Fix name of text emote sending & fix tests
parent
bf037ed6c7
commit
bbfc05b0c0
|
@ -536,7 +536,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
// bit of a hack, but the alternative would be quite complicated
|
// bit of a hack, but the alternative would be quite complicated
|
||||||
if (contentHTML) contentHTML = contentHTML.replace('/me', '');
|
if (contentHTML) contentHTML = contentHTML.replace('/me', '');
|
||||||
sendHtmlFn = this.client.sendHtmlEmote;
|
sendHtmlFn = this.client.sendHtmlEmote;
|
||||||
sendTextFn = this.client.sendTextEmote;
|
sendTextFn = this.client.sendEmoteMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: We don't actually seem to use this history?
|
// XXX: We don't actually seem to use this history?
|
||||||
|
|
|
@ -68,15 +68,17 @@ describe('MessageComposerInput', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not send messages when composer is empty', () => {
|
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.enableRichtext(true);
|
||||||
mci.handleReturn(sinon.stub());
|
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', () => {
|
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);
|
mci.enableRichtext(true);
|
||||||
addTextToDraft('a');
|
addTextToDraft('a');
|
||||||
mci.handleKeyCommand('toggle-mode');
|
mci.handleKeyCommand('toggle-mode');
|
||||||
|
@ -87,7 +89,7 @@ describe('MessageComposerInput', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not change content unnecessarily on Markdown -> RTE conversion', () => {
|
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);
|
mci.enableRichtext(false);
|
||||||
addTextToDraft('a');
|
addTextToDraft('a');
|
||||||
mci.handleKeyCommand('toggle-mode');
|
mci.handleKeyCommand('toggle-mode');
|
||||||
|
@ -97,7 +99,7 @@ describe('MessageComposerInput', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send emoji messages in rich text', () => {
|
it('should send emoji messages in rich text', () => {
|
||||||
const spy = sinon.spy(client, 'sendHtmlMessage');
|
const spy = sinon.spy(client, 'sendTextMessage');
|
||||||
mci.enableRichtext(true);
|
mci.enableRichtext(true);
|
||||||
addTextToDraft('☹');
|
addTextToDraft('☹');
|
||||||
mci.handleReturn(sinon.stub());
|
mci.handleReturn(sinon.stub());
|
||||||
|
@ -106,7 +108,7 @@ describe('MessageComposerInput', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send emoji messages in Markdown', () => {
|
it('should send emoji messages in Markdown', () => {
|
||||||
const spy = sinon.spy(client, 'sendHtmlMessage');
|
const spy = sinon.spy(client, 'sendTextMessage');
|
||||||
mci.enableRichtext(false);
|
mci.enableRichtext(false);
|
||||||
addTextToDraft('☹');
|
addTextToDraft('☹');
|
||||||
mci.handleReturn(sinon.stub());
|
mci.handleReturn(sinon.stub());
|
||||||
|
@ -139,7 +141,7 @@ describe('MessageComposerInput', () => {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
it('should insert formatting characters in Markdown mode', () => {
|
it('should insert formatting characters in Markdown mode', () => {
|
||||||
const spy = sinon.spy(client, 'sendHtmlMessage');
|
const spy = sinon.spy(client, 'sendTextMessage');
|
||||||
mci.enableRichtext(false);
|
mci.enableRichtext(false);
|
||||||
mci.handleKeyCommand('italic');
|
mci.handleKeyCommand('italic');
|
||||||
mci.handleReturn(sinon.stub());
|
mci.handleReturn(sinon.stub());
|
||||||
|
|
|
@ -54,6 +54,7 @@ export function stubClient() {
|
||||||
},
|
},
|
||||||
setAccountData: sinon.stub(),
|
setAccountData: sinon.stub(),
|
||||||
sendTyping: sinon.stub().returns(q({})),
|
sendTyping: sinon.stub().returns(q({})),
|
||||||
|
sendTextMessage: () => q({}),
|
||||||
sendHtmlMessage: () => q({}),
|
sendHtmlMessage: () => q({}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue