summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/chrome/action_manager_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-10-09 02:08:17 +0200
committerChristophe Simonis <chs@odoo.com>2019-10-09 02:08:17 +0200
commitd74b4518052066446e2a1975a91ce53c745ca75a (patch)
treec08180f88a512d15e37fbec628931f02b3825f65 /addons/web/static/tests/chrome/action_manager_tests.js
parentec162dd0cb5622ab6e56db1a63dab5f531a96f4a (diff)
parentf4105eb9c7010f8693e5d2fd20c0bd9d9cc2e483 (diff)
[MERGE] forward port branch 13.0 up to f4105eb9c70
Diffstat (limited to 'addons/web/static/tests/chrome/action_manager_tests.js')
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js39
1 files changed, 39 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 002a52f572f..b878e642b4f 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -4227,6 +4227,45 @@ QUnit.module('ActionManager', {
actionManager.destroy();
});
+
+ QUnit.test('Call twice clearUncommittedChanges in a row does not display twice the discard warning', async function (assert) {
+ assert.expect(4);
+
+ var actionManager = await createActionManager({
+ actions: this.actions,
+ archs: this.archs,
+ data: this.data,
+ intercepts: {
+ clear_uncommitted_changes: function () {
+ actionManager.clearUncommittedChanges();
+ },
+ },
+ });
+
+ // execute an action and edit existing record
+ await actionManager.doAction(3);
+
+ await testUtils.dom.click(actionManager.$('.o_list_view .o_data_row:first'));
+ assert.containsOnce(actionManager, '.o_form_view.o_form_readonly');
+
+ await testUtils.dom.click($('.o_control_panel .o_form_button_edit'));
+ assert.containsOnce(actionManager, '.o_form_view.o_form_editable');
+
+ await testUtils.fields.editInput(actionManager.$('input[name=foo]'), 'val');
+ actionManager.trigger_up('clear_uncommitted_changes');
+ await testUtils.nextTick();
+
+ assert.containsOnce($('body'), '.modal'); // confirm discard dialog
+ // confirm discard changes
+ await testUtils.dom.click($('.modal .modal-footer .btn-primary'));
+
+ actionManager.trigger_up('clear_uncommitted_changes');
+ await testUtils.nextTick();
+
+ assert.containsNone($('body'), '.modal');
+
+ actionManager.destroy();
+ });
});
});