mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: Adds support for image resize in the message bubble (#8182)
This commit is contained in:
@@ -28,6 +28,32 @@ describe('#MessageFormatter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('content with image and has "cw_image_height" query at the end of URL', () => {
|
||||
it('should set image height correctly', () => {
|
||||
const message =
|
||||
'Chatwoot is an opensource tool. ';
|
||||
expect(new MessageFormatter(message).formattedMessage).toMatch(
|
||||
'<p>Chatwoot is an opensource tool. <img src="http://chatwoot.com/chatwoot.png?cw_image_height=24px" alt="" style="height: 24px;" /></p>'
|
||||
);
|
||||
});
|
||||
|
||||
it('should set image height correctly if its original size', () => {
|
||||
const message =
|
||||
'Chatwoot is an opensource tool. ';
|
||||
expect(new MessageFormatter(message).formattedMessage).toMatch(
|
||||
'<p>Chatwoot is an opensource tool. <img src="http://chatwoot.com/chatwoot.png?cw_image_height=auto" alt="" style="height: auto;" /></p>'
|
||||
);
|
||||
});
|
||||
|
||||
it('should not set height', () => {
|
||||
const message =
|
||||
'Chatwoot is an opensource tool. ';
|
||||
expect(new MessageFormatter(message).formattedMessage).toMatch(
|
||||
'<p>Chatwoot is an opensource tool. <img src="http://chatwoot.com/chatwoot.png" alt="" /></p>'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tweets', () => {
|
||||
it('should return the same string if not tags or @mentions', () => {
|
||||
const message = 'Chatwoot is an opensource tool';
|
||||
|
||||
Reference in New Issue
Block a user