summaryrefslogtreecommitdiff
path: root/addons/web/static/test/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-03-30 11:51:45 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commitc60743428d9c47af1f18a331ebeadaebb23e3d4c (patch)
tree6fe35ec538a951a7b908a33a60fabe8badad5b82 /addons/web/static/test/fields/basic_fields_tests.js
parentc74ab1a146034a4eb99f1ac78743a3765dfa5169 (diff)
[FIX] web: typo in function name (FieldBoolean._onKeydown)
When focusing a checkbox field and hitting the "enter" key, the checkbox should change its status. Before this commit, this produced a traceback instead as it was trying to call the `_onKeyDown` function while it was defined as `_onKeydown`. Also the `_onKeydown` method is in fact declared in the `AbstractField` parent implementation, so there is no point in declaring the event binding twice. Also, part of the `FieldBoolean._onKeydown` code was in common with its parent `AbstractField._onKeydown` code so remove it as there is no point in duplicating it. Note: this `_onKeydown` method has to be refactored as it is breaking form view navigation anyway. Also modify an existing test to check the checkbox keyboard navigation.
Diffstat (limited to 'addons/web/static/test/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/test/fields/basic_fields_tests.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/web/static/test/fields/basic_fields_tests.js b/addons/web/static/test/fields/basic_fields_tests.js
index 004653ab680..b1488e72a0b 100644
--- a/addons/web/static/test/fields/basic_fields_tests.js
+++ b/addons/web/static/test/fields/basic_fields_tests.js
@@ -109,7 +109,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldBoolean');
- QUnit.test('boolean field in form view', function(assert) {
+ QUnit.test('boolean field in form view', function (assert) {
assert.expect(7);
var form = createView({
@@ -142,8 +142,11 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('.o_field_boolean input:checked').length, 0,
"checkbox should still be unchecked");
- // check the checkbox
- form.$('.o_field_boolean input').click();
+ // check the checkbox by hitting the "enter" key after focusing it
+ form.$('.o_field_boolean input')
+ .trigger("focusin")
+ .trigger({type: "keydown", which: $.ui.keyCode.ENTER})
+ .trigger({type: "keyup", which: $.ui.keyCode.ENTER});
assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1,
"checkbox should now be checked");
@@ -154,7 +157,7 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('boolean field in editable list view', function(assert) {
+ QUnit.test('boolean field in editable list view', function (assert) {
assert.expect(11);
var list = createView({