diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-06-28 19:01:52 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-06-28 19:01:52 +0200 |
| commit | c8bb02141d2801c243ae65ba6800b07f090bb5c6 (patch) | |
| tree | 2d099c5577df4783a6db3d853cf0141bf41c1aa9 /addons/web/static/tests/chrome | |
| parent | 4e2733e83a1f42773fb28f66431a0d6fb0393be9 (diff) | |
| parent | 3cdcbce93cbde548d2d24426ee8de1d93f06706e (diff) | |
[MERGE] forward port branch saas-11.3 up to 3cdcbce93cb
Diffstat (limited to 'addons/web/static/tests/chrome')
| -rw-r--r-- | addons/web/static/tests/chrome/action_manager_tests.js | 73 |
1 files changed, 73 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 b0a90173363..216e6cf6756 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -98,6 +98,9 @@ QUnit.module('ActionManager', { name: 'A Client Action', tag: 'ClientAction', type: 'ir.actions.client', + }, { + id: 10, + type: 'ir.actions.act_window_close', }]; this.archs = { @@ -2416,6 +2419,51 @@ QUnit.module('ActionManager', { actionManager.destroy(); }); + QUnit.test('requests for execute_action of type object: disable buttons', function (assert) { + assert.expect(2); + + var self = this; + var def; + var actionManager = createActionManager({ + actions: this.actions, + archs: this.archs, + data: this.data, + mockRPC: function (route, args) { + if (route === '/web/dataset/call_button') { + return $.when(false); + } else if (args.method === 'read') { + // Block the 'read' call + var result = this._super.apply(this, arguments); + return $.when(def).then(_.constant(result)); + } + return this._super.apply(this, arguments); + }, + }); + actionManager.doAction(3); + + // open a record in form view + actionManager.$('.o_list_view .o_data_row:first').click(); + + // click on 'Call method' button (should call an Object method) + def = $.Deferred(); + actionManager.$('.o_form_view button:contains(Call method)').click(); + + // Buttons should be disabled + assert.strictEqual( + actionManager.$('.o_form_view button:contains(Call method)').attr('disabled'), + 'disabled', 'buttons should be disabled') + + // Release the 'read' call + def.resolve(); + + // Buttons should be enabled after the reload + assert.strictEqual( + actionManager.$('.o_form_view button:contains(Call method)').attr('disabled'), + undefined, 'buttons should be disabled') + + actionManager.destroy(); + }); + QUnit.test('can open different records from a multi record view', function (assert) { assert.expect(11); @@ -3015,6 +3063,31 @@ QUnit.module('ActionManager', { actionManager.destroy(); }); + QUnit.test('chained action on_close', function (assert) { + assert.expect(3); + + function on_close() { + assert.step('Close Action'); + }; + + var actionManager = createActionManager({ + actions: this.actions, + archs: this.archs, + data: this.data, + }); + actionManager.doAction(5, {on_close: on_close}); + + // a target=new action shouldn't activate the on_close + actionManager.doAction(5); + assert.verifySteps([]); + + // An act_window_close should trigger the on_close + actionManager.doAction(10); + assert.verifySteps(['Close Action']); + + actionManager.destroy(); + }); + QUnit.test('footer buttons are moved to the dialog footer', function (assert) { assert.expect(3); |
