summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-05-11 13:29:52 +0200
committerDavid Monjoie <dmo@odoo.com>2017-05-12 14:53:48 +0200
commit42d95cbfc3d85a8ab79e5ac6fceee5d8f7c6c550 (patch)
tree9bc3c2b562ae2aa59579cc9e054f17e96fc5a769 /addons/web/static/tests/fields
parent310588b8136527837e76f152d93b5d8079b8087c (diff)
[FIX] web: keep focus on checkboxes after rerendering
Previously, when a checkbox was re-rendered, it was losing focus since it was removed and re-created. Now, if the checkbox itself is the origin point of the re-rendering, we give the focus to the newly re-rendered checkbox, resulting in a seamless experience just as if the checkbox was never removed and re-rendered.
Diffstat (limited to 'addons/web/static/tests/fields')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 04d0588bfab..8417e503676 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -123,7 +123,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldBoolean');
QUnit.test('boolean field in form view', function (assert) {
- assert.expect(11);
+ assert.expect(12);
var form = createView({
View: FormView,
@@ -183,6 +183,12 @@ QUnit.module('basic_fields', {
.trigger({type: "keyup", which: $.ui.keyCode.ENTER});
assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1,
"checkbox should now be checked");
+ // blindly press enter again, it should uncheck the checkbox
+ $(document.activeElement).trigger({type: "keydown", which: $.ui.keyCode.ENTER});
+ assert.strictEqual(form.$('.o_field_boolean input:checked').length, 0,
+ "checkbox should not be checked");
+ // blindly press enter again, it should check the checkbox back
+ $(document.activeElement).trigger({type: "keydown", which: $.ui.keyCode.ENTER});
// save
form.$buttons.find('.o_form_button_save').click();