diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-02 10:52:55 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-02 10:52:55 +0100 |
| commit | 5e055a2afd23bd4e6a29c18c86d1978dcd98fc9f (patch) | |
| tree | 058c2cef359de70f7bbabacaa63446fa189af12e /addons/mail/static/tests/chatter_tests.js | |
| parent | 486777654009aa372a21e9d6dd52e8c22173ee16 (diff) | |
| parent | f6ca72b3ce9ecc9007ae5825d2c648e3b26b098e (diff) | |
[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9
Diffstat (limited to 'addons/mail/static/tests/chatter_tests.js')
| -rw-r--r-- | addons/mail/static/tests/chatter_tests.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index aff69b58197..d4d10f71746 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -786,6 +786,59 @@ QUnit.test('chatter: post, receive and star messages', function (assert) { }); }); +QUnit.test('chatter: post a message disable the send button', function(assert) { + assert.expect(3); + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + services: this.services, + arch: '<form string="Partners">' + + '<sheet>' + + '<field name="foo"/>' + + '</sheet>' + + '<div class="oe_chatter">' + + '<field name="message_ids" widget="mail_thread"/>' + + '</div>' + + '</form>', + res_id: 2, + session: {}, + mockRPC: function (route, args) { + if (args.method === 'message_get_suggested_recipients') { + return $.when({2: []}); + } + if (args.method === 'message_post') { + assert.ok(form.$('.o_composer_button_send').prop("disabled"), + "Send button should be disabled when a message is being sent"); + return $.when(57923); + } + if (args.method === 'message_format') { + return $.when([{ + author_id: ["42", "Me"], + model: 'partner', + }]); + } + return this._super(route, args); + }, + intercepts: { + get_messages: function (ev) { + ev.stopPropagation(); + ev.data.callback($.when([])); + }, + }, + }); + + form.$('.o_chatter_button_new_message').click(); + assert.notOk(form.$('.o_composer_button_send').prop('disabled'), + "Send button should be enabled when posting a message"); + form.$('.oe_chatter .o_composer_text_field:first()').val("My first message"); + form.$('.oe_chatter .o_composer_button_send').click(); + form.$('.o_chatter_button_new_message').click(); + assert.notOk(form.$('.o_composer_button_send').prop('disabled'), + "Send button should be enabled when posting another message"); + form.destroy(); +}); + QUnit.test('chatter: receive notif when document is open', function (assert) { assert.expect(2); |
