diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-07-30 13:15:50 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-07-30 13:42:09 +0000 |
| commit | afb3c28fccd485fe599bcf872a0a44eccadd6199 (patch) | |
| tree | ff5b3de181032f4a8c28ec74b38e4cdcf8c5aaf9 /addons/web/static/tests/core | |
| parent | a86795e60e1f137d1657caf4b480dc62d0275800 (diff) | |
[FIX] web: restore modal backdrops click behavior
Since https://github.com/odoo/odoo/commit/2ad49ec93e39ae5d59ccc17884408870e1c86c5e,
all dialogs were able to be closed by clicking on the backdrop which was
not a desired behavior.
Indeed, the 'backdrop' option of the BS component was misused.
closes odoo/odoo#35300
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/tests/core')
| -rw-r--r-- | addons/web/static/tests/core/widget_tests.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/tests/core/widget_tests.js b/addons/web/static/tests/core/widget_tests.js index 13515e08641..fabda247938 100644 --- a/addons/web/static/tests/core/widget_tests.js +++ b/addons/web/static/tests/core/widget_tests.js @@ -3,6 +3,7 @@ odoo.define('web.widget_tests', function (require) { var AjaxService = require('web.AjaxService'); var core = require('web.core'); +var Dialog = require('web.Dialog'); var QWeb = require('web.QWeb'); var Widget = require('web.Widget'); var testUtils = require('web.test_utils'); @@ -482,6 +483,24 @@ QUnit.module('core', {}, function () { assert.verifySteps(['destroy'], "child should have been detroyed only once"); }); + + QUnit.module('Widgets, Dialog'); + + QUnit.test("don't close dialog on backdrop click", async function (assert) { + assert.expect(3); + + var dialog = new Dialog(null); + dialog.open(); + await dialog.opened(); + + assert.strictEqual($('.modal.show').length, 1, "a dialog should have opened"); + var $backdrop = $('.modal-backdrop'); + assert.strictEqual($backdrop.length, 1, "the dialog should have a modal backdrop"); + testUtils.dom.click('.modal.show'); // Click on backdrop is in fact a direct click on the .modal element + assert.strictEqual($('.modal.show').length, 1, "the dialog should still be opened"); + + dialog.close(); + }); }); }); |
