From 56c222c8e6957d1cd456d2ce30b4ea31f9aab77e Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Fri, 23 Oct 2020 08:23:05 +0000 Subject: [PATCH] [FIX] mail: adds a test for the chatter of new records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a test for the fix odoo/odoo/pull/58769 that ensures that the chatter is properly cleared when creating a new record. task-2348472 closes odoo/odoo#60731 X-original-commit: 5e46850072f142fb17b72d8738dc4f1c60e3a786 Signed-off-by: Sébastien Theys (seb) --- .../form_renderer/form_renderer_tests.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js b/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js index e57317a7496..0984885ddb4 100644 --- a/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js +++ b/addons/mail/static/src/widgets/form_renderer/form_renderer_tests.js @@ -922,6 +922,40 @@ QUnit.test('Attachments that have been unlinked from server should be visually u ); }); +QUnit.test('chatter just contains "creating a new record" message during the creation of a new record after having displayed a chatter for an existing record', async function (assert) { + assert.expect(2); + + this.data['res.partner'].records.push({ id: 12 }); + await this.createView({ + data: this.data, + hasView: true, + View: FormView, + model: 'res.partner', + res_id: 12, + arch: ` +
+
+ +
+
+ `, + }); + + await afterNextRender(() => { + document.querySelector('.o_form_button_create').click(); + }); + assert.containsOnce( + document.body, + '.o_Message', + "Should have a single message when creating a new record" + ); + assert.strictEqual( + document.querySelector('.o_Message_content').textContent, + 'Creating a new record...', + "the message content should be in accord to the creation of this record" + ); +}); + }); }); });