diff options
Diffstat (limited to 'addons/mail/static/tests/thread_window/basic_thread_window_tests.js')
| -rw-r--r-- | addons/mail/static/tests/thread_window/basic_thread_window_tests.js | 138 |
1 files changed, 0 insertions, 138 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 597e197ca9d..87e3c536998 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 @@ -587,37 +587,6 @@ QUnit.test('do not auto-focus chat window on receiving new message from new DM', parent.destroy(); }); -QUnit.test('out-of-office status in thread window', async function (assert) { - assert.expect(1); - this.data.initMessaging = { - channel_slots: { - channel_channel: [{ - id: 1, - name: "DM", - channel_type: "chat", - message_unread_counter: 0, - direct_partner: [{ id: 666, name: 'DemoUser1', im_status: 'online', out_of_office_message: 'Please don\'t disturb'}], - }], - }, - }; - var parent = this.createParent({ - data: this.data, - services: this.services, - }); - await testUtils.nextTick(); - - // detach channel 1, so that it opens corresponding thread window. - var channel = parent.call('mail_service', 'getChannel', 1); - await testUtils.nextTick(); - channel.detach(); - await testUtils.nextTick(); - - var $threadWindow = $('.o_thread_window'); - assert.containsOnce($threadWindow, '.o_out_of_office_text'); - - parent.destroy(); -}); - QUnit.test('no out-of-office status in thread window', async function (assert) { assert.expect(1); this.data.initMessaging = { @@ -649,113 +618,6 @@ QUnit.test('no out-of-office status in thread window', async function (assert) { parent.destroy(); }); -QUnit.test('auto-update out-of-office info on im_status change', async function (assert) { - assert.expect(5); - - var imStatusDefs = [testUtils.makeTestPromise(), testUtils.makeTestPromise()]; - var channelInfoDefs = [testUtils.makeTestPromise(), testUtils.makeTestPromise()]; - var timeoutMock = mailTestUtils.patchMailTimeouts(); - var step = 0; - - this.data.initMessaging = { - channel_slots: { - channel_channel: [{ - id: 1, - name: "DM", - channel_type: "chat", - message_unread_counter: 0, - direct_partner: [{ - id: 666, - name: 'DemoUser1', - im_status: 'online', - }], - }], - }, - }; - - var parent = this.createParent({ - data: this.data, - services: this.services, - mockRPC: function (route, args) { - if (route === '/longpolling/im_status') { - step++; - if (step === 1) { - imStatusDefs[0].resolve(); - return Promise.resolve([ - { - id: 666, - im_status: 'leave', - }, - ]); - } else if (step === 2) { - imStatusDefs[1].resolve(); - return Promise.resolve([ - { - id: 666, - im_status: 'online', - }, - ]); - } - } - if (args.method === 'channel_info') { - if (step === 1) { - channelInfoDefs[0].resolve(); - return Promise.resolve([{ - id: 1, - direct_partner: [{ - out_of_office_message: "Leave me alone", - out_of_office_date_end: false, - }], - }]); - } - else if (step === 2) { - channelInfoDefs[1].resolve(); - return Promise.resolve([{ - id: 1, - direct_partner: [{ - out_of_office_message: false, - out_of_office_date_end: false, - }], - }]); - } - } - return this._super.apply(this, arguments); - }, - }); - await testUtils.nextTick(); - - // detach channel 1, so that it opens corresponding thread window. - parent.call('mail_service', 'getChannel', 1).detach(); - await testUtils.nextTick(); - - assert.containsNone($, '.o_out_of_office', - "should contain no out of office section on chat window initially"); - - timeoutMock.addTime(51*1000); // wait for next im status fetch - - await Promise.all([imStatusDefs[0], channelInfoDefs[0]]); - await testUtils.nextTick(); - assert.containsOnce($, '.o_out_of_office', - "should contain out of office section on chat window"); - assert.containsOnce($, '.o_out_of_office > .o_out_of_office_text', - "should contain out of office text on chat window"); - assert.ok( - $('.o_out_of_office > .o_out_of_office_text') - .text() - .replace(/\s/g, "") - .indexOf("Leavemealone") !== -1, - "should contain out of office text on chat window"); - timeoutMock.addTime(51*1000); // wait for next im status fetch - - await Promise.all([imStatusDefs[1], channelInfoDefs[1]]); - await testUtils.nextTick(); - assert.containsNone($, '.o_out_of_office', - "should no longer contain out of office section on chat window"); - - timeoutMock.runPendingTimeouts(); - parent.destroy(); -}); - QUnit.test('receive 2 new DM messages in quick succession (no chat window initially)', async function (assert) { assert.expect(3); |
