[FIX] mail: adds a test for the chatter of new records

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) <seb@odoo.com>
This commit is contained in:
Thanh Dodeur
2020-10-26 11:48:30 +00:00
parent a0868bc1ec
commit 56c222c8e6
@@ -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: `
<form>
<div class="oe_chatter">
<field name="message_ids"/>
</div>
</form>
`,
});
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"
);
});
});
});
});