summaryrefslogtreecommitdiff
path: root/addons/note/static
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-08-13 16:26:35 +0000
committerSébastien Theys <seb@odoo.com>2020-08-13 16:26:35 +0000
commitc2918c139b8f1026b57a257fbb74570d7a224c98 (patch)
tree6b1a5cbf5b048dd86048119cd66f5fa382595a7b /addons/note/static
parent41527531b7b6f727e25a5a68aedb49609fbb1d3a (diff)
[IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server: - add support for mocked `fetch` - add support for `active_test` - add support for x2m `in` in domains - add support for default values computed from a function - implement a more natural "next id" compute - allow initial data without ids - ensure write and x2m commands integrity - improve bad data/bad commands error messages - always warn for failing RPC, not only in debug mode - fix all existing tests that had inconsistency data Other changes done in mail (or dependents) that are not just related to tests: - remove `direct_partner` from formatter result ->`correspondent` can be computed from other keys, especially `members` - fix `livechat_visitor` convertData -> only process if there is value - add `current_partner` and `current_user_id` as `init_messaging` result -> easier to mock than session - remove usage of `need_moderation` -> that was just a search indirection to `moderation_status` - adapt `partner_id` -> `res_partner_id` key in `_notification_format` -> to be consistent with field name - add name in result of `mail_partner_format` -> sometimes display_name is not the same - remove usage of `is_moderator` -> that was just an indirection to `moderation_channel_ids` Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523 task-2287171 closes odoo/odoo#55854 X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d Related: odoo/enterprise#12391 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/note/static')
-rw-r--r--addons/note/static/tests/systray_activity_menu_tests.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/addons/note/static/tests/systray_activity_menu_tests.js b/addons/note/static/tests/systray_activity_menu_tests.js
index f560e0031d2..095bbb235b7 100644
--- a/addons/note/static/tests/systray_activity_menu_tests.js
+++ b/addons/note/static/tests/systray_activity_menu_tests.js
@@ -1,25 +1,26 @@
odoo.define('note.systray.ActivityMenuTests', function (require) {
"use strict";
-const { start } = require('mail/static/src/utils/test_utils.js');
+const { afterEach, beforeEach, start } = require('mail/static/src/utils/test_utils.js');
var ActivityMenu = require('mail.systray.ActivityMenu');
var testUtils = require('web.test_utils');
QUnit.module('note', {}, function () {
-
QUnit.module("ActivityMenu", {
- beforeEach: function () {
- this.data = {
+ beforeEach() {
+ beforeEach(this);
+
+ Object.assign(this.data, {
'mail.activity.menu': {
fields: {
name: { type: "char" },
model: { type: "char" },
type: { type: "char" },
- planned_count: { type: "integer"},
- today_count: { type: "integer"},
- overdue_count: { type: "integer"},
- total_count: { type: "integer"}
+ planned_count: { type: "integer" },
+ today_count: { type: "integer" },
+ overdue_count: { type: "integer" },
+ total_count: { type: "integer" }
},
records: [],
},
@@ -29,7 +30,10 @@ QUnit.module("ActivityMenu", {
},
records: [],
}
- };
+ });
+ },
+ afterEach() {
+ afterEach(this);
},
});
@@ -38,6 +42,7 @@ QUnit.test('note activity menu widget: create note from activity menu', async fu
var self = this;
const { widget } = await start({
+ data: this.data,
mockRPC: function (route, args) {
if (args.method === 'systray_get_activities') {
return Promise.resolve(self.data['mail.activity.menu'].records);
@@ -72,7 +77,7 @@ QUnit.test('note activity menu widget: create note from activity menu', async fu
const activityMenu = new ActivityMenu(widget);
await activityMenu.appendTo($('#qunit-fixture'));
- assert.hasClass(activityMenu.$el,'o_mail_systray_item',
+ assert.hasClass(activityMenu.$el, 'o_mail_systray_item',
'should be the instance of widget');
assert.strictEqual(activityMenu.$('.o_notification_counter').text(), '0',
"should not have any activity notification initially");
@@ -121,4 +126,5 @@ QUnit.test('note activity menu widget: create note from activity menu', async fu
widget.destroy();
});
});
+
});