Skip to content
Permalink
Browse files

[IMP]

  • Loading branch information...
msh-odoo committed Nov 8, 2019
1 parent 663d1d8 commit ffb0b6da6407afca759238c4888fa9d1b328613d
Showing with 16 additions and 20 deletions.
  1. +3 −5 addons/mail/static/src/js/form_controller.js
  2. +13 −15 addons/mail/static/tests/chatter_tests.js
@@ -13,8 +13,6 @@ FormController.include({
new_message: '_onNewMessage',
}),

// TODO: Should be moved to crm.lead

//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
@@ -23,9 +21,9 @@ FormController.include({
*
* @override
*/
saveRecord: function () {
var chatter = this.renderer.chatter
return this._super.apply(this, arguments).then(changedFields => {
saveRecord() {
var chatter = this.renderer.chatter;
return this._super(...arguments).then(changedFields => {
if (chatter) {
chatter.trigger_up('reset_suggested_partners');
}
@@ -3328,7 +3328,7 @@ QUnit.test('chatter: display suggested partners only once', async function (asse
QUnit.test('chatter: display modified partner info in follower info of composer without refreshing', async function (assert) {
assert.expect(5);

let email_changed = false;
let formSaved = false;

const form = await createView({
View: FormView,
@@ -3346,34 +3346,32 @@ QUnit.test('chatter: display modified partner info in follower info of composer
</div>
</form>`,
res_id: 2,
viewOptions: {
mode: 'edit',
},
async mockRPC(route, args) {
if (route === '/mail/get_suggested_recipients') {
assert.step('calling the route -> /get_suggested_recipients');
if (email_changed) {
return {
2: [[2, "HELLO2", "HELLO2"]],
}
}
else {
return {
2: [[2, "HELLO", "HELLO"]],
};
assert.step('get_suggested_recipients');
if (formSaved) {
return { 2: [[2, "HELLO2"]], };
}
return { 2: [[2, "HELLO"]], };
}
return this._super(route, args);
},
});

await testUtils.dom.click(form.$('.o_chatter_button_new_message'));
assert.strictEqual(
form.$('div.o_composer_suggested_partners label').text().replace(/\s+/g, ''),
"HELLO",
"should have the correct original email label");
await testUtils.dom.click(form.$('.o_form_button_edit'));
await testUtils.fields.editInput(form.$('.o_field_char'),'HELLO2');
await testUtils.fields.editInput(form.$('.o_field_char'), 'HELLO2');
await testUtils.dom.click(form.$('.o_form_button_save'));
email_changed = true;
formSaved = true;
await testUtils.dom.click(form.$('.o_chatter_button_new_message'));
assert.verifySteps(['calling the route -> /get_suggested_recipients','calling the route -> /get_suggested_recipients'],'route should be called two times');
assert.verifySteps(['get_suggested_recipients', 'get_suggested_recipients'],
'route should be called two times');
assert.strictEqual(
form.$('div.o_composer_suggested_partners label').text().replace(/\s+/g, ''),
"HELLO2",

0 comments on commit ffb0b6d

Please sign in to comment.
You can’t perform that action at this time.