Files
odoo_source/addons/mail/static/tests/tools/debug_manager_tests.js
T
ThanhDodeurOdoo d12b883155 [IMP] mail, web: attachments & messages in debug actions.
- added two new actions to the form view debug action list,
  both opens list (+ form) views of messages and attachments respectively
  for which the domain is restricted to the current record.

task: 1860031
2018-09-13 11:50:26 +02:00

58 lines
1.8 KiB
JavaScript

odoo.define('mail.debugManagerTests', function (require) {
"use strict";
var testUtils = require('web.test_utils');
var createDebugManager = testUtils.createDebugManager;
QUnit.module('Mail DebugManager', {}, function () {
QUnit.test("Manage Messages", function (assert) {
assert.expect(3);
var debugManager = createDebugManager({
intercepts: {
do_action: function (event) {
assert.deepEqual(event.data.action, {
res_model: 'mail.message',
name: "Manage Messages",
views: [[false, 'list'], [false, 'form']],
type: 'ir.actions.act_window',
domain: [['res_id', '=', 5], ['model', '=', 'testModel']],
});
},
},
});
debugManager.appendTo($('#qunit-fixture'));
// Simulate update debug manager from web client
var action = {
views: [{
displayName: "Form",
fieldsView: {
view_id: 1,
},
type: "form",
}],
};
var view = {
viewType: "form",
getSelectedIds: function () {
return [5];
},
modelName: 'testModel',
};
debugManager.update('action', action, view);
var $messageMenu = debugManager.$('a[data-action=getMailMessages]');
assert.strictEqual($messageMenu.length, 1, "should have Manage Message menu item");
assert.strictEqual($messageMenu.text().trim(), "Manage Messages",
"should have correct menu item text");
$messageMenu.click();
debugManager.destroy();
});
});
});