diff options
| author | Odoo's Mergebot <xmo+roboto@odoo.com> | 2019-09-03 13:06:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-03 13:06:23 +0200 |
| commit | 85c5d0a4be4bf7afb7d15f0b5a07cc0daecaa1a5 (patch) | |
| tree | cb11f94d3c993e83e93a386914075d9e8e8a3cde /addons/mail/static/tests/document_thread_window_tests.js | |
| parent | 82c0e9b620bfbd409914e1941e5c8e9117982bd1 (diff) | |
| parent | 40b57ca824e967a9221f7834e4c9b3db7a4849d0 (diff) | |
[MERGE][FIX] bus, mail, web: several cross-tab communication fixes
### [FIX] bus: background slave tabs should not loose notifications
Slave tabs missed some notifications in case the local storage
event's `newValue` did not match actual value in local storage. This
happens when master tab overwrites a value that slave tabs did not
take the time to read. Slave tabs should now always handle all local
storage events.
Task-ID 2044231
### [FIX] bus, mail: correctly synchronize document chat windows
Cross-tab synchronization of document chat windows resulted sometimes
with an infinite loop. This happens due to tabs relying on actual
value in the local storage and all document chat windows state being
set as a single local storage entry. Cross-tab communication of
document chat windows now is relying on event's `newValue`, and each
document chat window has its own local storage entry. Changes from
local storage no longer writes again in the local storage, so that
it no longer makes an echo (= infinite loop).
Task-Id 2034997
closes odoo/odoo#36177
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/tests/document_thread_window_tests.js')
| -rw-r--r-- | addons/mail/static/tests/document_thread_window_tests.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/addons/mail/static/tests/document_thread_window_tests.js b/addons/mail/static/tests/document_thread_window_tests.js index bdab46e91ef..fe2b31b2811 100644 --- a/addons/mail/static/tests/document_thread_window_tests.js +++ b/addons/mail/static/tests/document_thread_window_tests.js @@ -201,7 +201,7 @@ QUnit.test('post messages in a document thread window', function (assert) { testUtils.intercept(messagingMenu, 'call_service', function (ev) { if (ev.data.service === 'local_storage' && ev.data.method === 'setItem' && ev.data.args[0] === 'mail.document_threads_last_message') { - assert.deepEqual(ev.data.args[1], newMessage, + assert.deepEqual(ev.data.args[1].messageData, newMessage, "should write sent message in local storage, to share info with other tabs"); } }, true); @@ -229,7 +229,7 @@ QUnit.test('post messages in a document thread window', function (assert) { }); QUnit.test('open, fold, unfold and close a document thread window', function (assert) { - assert.expect(8); + assert.expect(24); var messagingMenu = new MessagingMenu(); testUtils.addMockEnvironment(messagingMenu, { @@ -239,7 +239,13 @@ QUnit.test('open, fold, unfold and close a document thread window', function (as }); testUtils.intercept(messagingMenu, 'call_service', function (ev) { if (ev.data.service === 'local_storage' && ev.data.method === 'setItem') { - assert.step(ev.data.args); + const key = ev.data.args[0]; + const state = ev.data.args[1].state; + assert.strictEqual(key, 'mail.document_threads_state/some.res.model_1'); + assert.ok(state); + assert.ok(state.name); + assert.ok(state.windowState); + assert.step(`${key}: { name: "${state.name}", windowState: '${state.windowState}' }`); } }, true); messagingMenu.appendTo($('#qunit-fixture')); @@ -262,10 +268,10 @@ QUnit.test('open, fold, unfold and close a document thread window', function (as $('.o_thread_window .o_thread_window_close').click(); assert.verifySteps([ - ['mail.document_threads_state', {"some.res.model_1": {"name": "Some Record", "windowState": "open"}}], - ['mail.document_threads_state', {"some.res.model_1": {"name": "Some Record", "windowState": "folded"}}], - ['mail.document_threads_state', {"some.res.model_1": {"name": "Some Record", "windowState": "open"}}], - ['mail.document_threads_state', {"some.res.model_1": {"name": "Some Record", "windowState": "closed"}}], + `mail.document_threads_state/some.res.model_1: { name: "Some Record", windowState: 'open' }`, + `mail.document_threads_state/some.res.model_1: { name: "Some Record", windowState: 'folded' }`, + `mail.document_threads_state/some.res.model_1: { name: "Some Record", windowState: 'open' }`, + `mail.document_threads_state/some.res.model_1: { name: "Some Record", windowState: 'closed' }`, ]); messagingMenu.destroy(); |
