diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-27 15:07:50 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-08-27 16:51:50 +0000 |
| commit | c690f63de88b74bf6576fa83adcba3d57bcb1a74 (patch) | |
| tree | 7c9e23cb73bd96c14e73b98992b65f155bae8e1e /addons/mail/static/src/components/message/message_tests.js | |
| parent | ae9a6aa200b5a66d5da1dc166f99261bc5ad06d0 (diff) | |
[FIX] mail: prevent "record created" from being twice in the chatter
task-2280184
closes odoo/odoo#56691
X-original-commit: 1af2cc1b2190623739085de83870fb415cbdccf1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/message/message_tests.js')
| -rw-r--r-- | addons/mail/static/src/components/message/message_tests.js | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/addons/mail/static/src/components/message/message_tests.js b/addons/mail/static/src/components/message/message_tests.js index 8e2669a8698..7f10771ce0d 100644 --- a/addons/mail/static/src/components/message/message_tests.js +++ b/addons/mail/static/src/components/message/message_tests.js @@ -108,7 +108,8 @@ QUnit.test('basic rendering', async function (assert) { 1, "message should display the content" ); - assert.strictEqual(messageEl.querySelector(`:scope .o_Message_content`).innerHTML, + assert.strictEqual( + messageEl.querySelector(`:scope .o_Message_content`).innerHTML, "<p>Test</p>", "message should display the correct content" ); @@ -738,6 +739,50 @@ QUnit.test('prevent attachment delete on non-authored message', async function ( ); }); +QUnit.test('subtype description should be displayed if it is different than body', async function (assert) { + assert.expect(2); + + await this.start(); + const message = this.env.models['mail.message'].create({ + body: "<p>Hello</p>", + id: 100, + subtype_description: 'Bonjour', + }); + await this.createMessageComponent(message); + assert.containsOnce( + document.body, + '.o_Message_content', + "message should have content" + ); + assert.strictEqual( + document.querySelector(`.o_Message_content`).textContent, + "HelloBonjour", + "message content should display both body and subtype description when they are different" + ); +}); + +QUnit.test('subtype description should not be displayed if it is similar to body', async function (assert) { + assert.expect(2); + + await this.start(); + const message = this.env.models['mail.message'].create({ + body: "<p>Hello</p>", + id: 100, + subtype_description: 'hello', + }); + await this.createMessageComponent(message); + assert.containsOnce( + document.body, + '.o_Message_content', + "message should have content" + ); + assert.strictEqual( + document.querySelector(`.o_Message_content`).textContent, + "Hello", + "message content should display only body when subtype description is similar" + ); +}); + }); }); }); |
