mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 11:15:53 +03:00
Fix name of text emote sending & fix tests
This commit is contained in:
parent
bf037ed6c7
commit
bbfc05b0c0
3 changed files with 11 additions and 8 deletions
|
@ -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?
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -54,6 +54,7 @@ export function stubClient() {
|
|||
},
|
||||
setAccountData: sinon.stub(),
|
||||
sendTyping: sinon.stub().returns(q({})),
|
||||
sendTextMessage: () => q({}),
|
||||
sendHtmlMessage: () => q({}),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue