diff options
| author | Alexandre Kühn <aku@odoo.com> | 2019-09-04 07:46:45 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2019-09-04 10:29:07 +0000 |
| commit | e7aff236b8073b952a0e554d9897a8f88d5c4c91 (patch) | |
| tree | fe81fb980d9afd2d1eceffc8a88abe6a69ac2fb4 /addons/mail/static/tests/thread_window | |
| parent | 3ec676be002e4c68907f862c649d7fba6e2eb5e8 (diff) | |
[FIX] mail: no message attachment delete in discuss and chat window
Delete attachment from message makes only sense from chatter.
Task-Id 2058455
Diffstat (limited to 'addons/mail/static/tests/thread_window')
| -rw-r--r-- | addons/mail/static/tests/thread_window/basic_thread_window_tests.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/addons/mail/static/tests/thread_window/basic_thread_window_tests.js b/addons/mail/static/tests/thread_window/basic_thread_window_tests.js index 3200ae38d85..3dc8ac0336d 100644 --- a/addons/mail/static/tests/thread_window/basic_thread_window_tests.js +++ b/addons/mail/static/tests/thread_window/basic_thread_window_tests.js @@ -850,6 +850,59 @@ QUnit.test('receive 2 new DM messages in quick succession (no chat window initia parent.destroy(); }); +QUnit.test('non-deletable message attachments', async function (assert) { + assert.expect(3); + + this.data['mail.channel'].records = [{ + id: 1, + name: "General", + channel_type: 'channel', + }]; + this.data['mail.message'].records = [{ + attachment_ids: [{ + filename: "text.txt", + id: 250, + mimetype: 'text/plain', + name: "text.txt", + }, { + filename: "image.png", + id: 251, + mimetype: 'image/png', + name: "image.png", + }], + author_id: [5, "Demo User"], + body: "<p>test</p>", + channel_ids: [1], + id: 100, + model: 'mail.channel', + record_name: "general", + res_id: 1, + }]; + const parent = this.createParent({ + data: this.data, + services: this.services, + }); + await testUtils.nextTick(); + const channel = parent.call('mail_service', 'getChannel', 1); + channel.detach(); + await testUtils.nextTick(); + assert.containsOnce( + $, + '.o_thread_window', + "a thread window should be open"); + assert.containsN( + $('.o_thread_window'), + '.o_attachment', + 2, + "thread window should have 2 attachments"); + assert.containsNone( + $('.o_thread_window .o_attachment'), + 'o_attachment_delete_cross', + "attachments should not be deletable"); + + parent.destroy(); +}); + }); }); }); |
