summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorLucas Lefèvre <lul@odoo.com>2020-05-18 09:12:58 +0000
committerPierre Rousseau <pro@odoo.com>2020-06-11 07:41:02 +0000
commit997d21a67e7c634d16367bafc5ce9d7b4c4e228d (patch)
tree5bc45fa549837744a64fabee20163117eead140b /addons/web/static/tests
parent09cfde14bd086bd190a8c34a157557fa363d0438 (diff)
[IMP] web: Allow to use a custom control panel
The abilty to use a custom control panel for an action seems to have been lost with 18e5416. With this commit the action config can specify a custom component to use as control panel. Usefull for o-spreadsheet integration. Task 2238915 closes odoo/odoo#52807 Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index 3a452b20d52..02ba1d2472d 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -19,6 +19,7 @@ var Widget = require('web.Widget');
var createActionManager = testUtils.createActionManager;
const cpHelpers = testUtils.controlPanel;
+const { xml } = owl.tags;
QUnit.module('ActionManager', {
beforeEach: function () {
@@ -1882,6 +1883,29 @@ QUnit.module('ActionManager', {
delete core.action_registry.map.HelloWorldTest;
});
+ QUnit.test('action can use a custom control panel', async function (assert) {
+ assert.expect(1);
+
+ class CustomControlPanel extends owl.Component {}
+ CustomControlPanel.template = xml/* xml */`
+ <div class="custom-control-panel">My custom control panel</div>
+ `
+ const ClientAction = AbstractAction.extend({
+ hasControlPanel: true,
+ config: {
+ ControlPanel: CustomControlPanel
+ },
+ });
+ const actionManager = await createActionManager();
+ core.action_registry.add('HelloWorldTest', ClientAction);
+ await actionManager.doAction('HelloWorldTest');
+ assert.containsOnce(actionManager, '.custom-control-panel',
+ "should have a custom control panel");
+
+ actionManager.destroy();
+ delete core.action_registry.map.HelloWorldTest;
+ });
+
QUnit.test('breadcrumb is updated on title change', async function (assert) {
assert.expect(2);