diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-10-27 14:09:20 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-10-27 14:09:20 +0200 |
| commit | e918271f7600d9f77dc6631e48814f0daf951ad8 (patch) | |
| tree | 295629178de5fe3a1cf1dcb8d780661d82df1877 /addons/web/static/tests/views/form_tests.js | |
| parent | 2f0435f08112251abce2591f44e748896c030420 (diff) | |
| parent | 8fdac4b6b2f2fccafc95ea65b976c7e4028d9832 (diff) | |
[MERGE] forward port branch saas-16 up to 8fdac4b6b2f
Diffstat (limited to 'addons/web/static/tests/views/form_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 1b32857c951..e4e33af0a8f 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -5355,6 +5355,53 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('buttons with "confirm" attribute save before calling the method', function (assert) { + assert.expect(9); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<header>' + + '<button name="post" class="p" string="Confirm" type="object" ' + + 'confirm="Very dangerous. U sure?"/>' + + '</header>' + + '<sheet>' + + '<field name="foo"/>' + + '</sheet>' + + '</form>', + mockRPC: function (route, args) { + assert.step(args.method); + return this._super.apply(this, arguments); + }, + intercepts: { + execute_action: function (event) { + assert.step('execute_action'); + }, + }, + }); + + // click on button, and cancel in confirm dialog + form.$('.o_statusbar_buttons button').click(); + assert.ok(form.$('.o_statusbar_buttons button').prop('disabled'), + 'button should be disabled'); + $('.modal .modal-footer button.btn-default').click(); + assert.ok(!form.$('.o_statusbar_buttons button').prop('disabled'), + 'button should no longer be disabled'); + + assert.verifySteps(['default_get']); + + // click on button, and click on ok in confirm dialog + form.$('.o_statusbar_buttons button').click(); + assert.verifySteps(['default_get']); + $('.modal .modal-footer button.btn-primary').click(); + + assert.verifySteps(['default_get', 'create', 'read', 'execute_action']); + + form.destroy(); + }); + QUnit.test('buttons are disabled until action is resolved (in dialogs)', function (assert) { assert.expect(3); |
