mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
chat: Give chatNewMessage
hook access to the raw message object
This commit is contained in:
parent
fc5a3f553d
commit
2597b940f4
4 changed files with 30 additions and 1 deletions
|
@ -60,5 +60,24 @@ describe('chat hooks', function () {
|
|||
]);
|
||||
});
|
||||
}
|
||||
|
||||
it('message is an object', async function () {
|
||||
await Promise.all([
|
||||
checkHook('chatNewMessage', ({message}) => {
|
||||
expect(message).to.be.an('object');
|
||||
}),
|
||||
helper.sendChatMessage(`${this.test.title}{enter}`),
|
||||
]);
|
||||
});
|
||||
|
||||
it('message.text is not processed', async function () {
|
||||
const msg = '<script>alert("foo");</script> https://etherpad.org';
|
||||
await Promise.all([
|
||||
checkHook('chatNewMessage', ({message: {text}}) => {
|
||||
expect(text).to.equal(`${msg}\n`);
|
||||
}),
|
||||
helper.sendChatMessage(`${msg}{enter}`),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue