diff options
| author | David Monjoie <dmo@odoo.com> | 2017-04-13 14:11:03 +0200 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2017-05-02 15:24:54 +0200 |
| commit | e02cee4ea694d9a1f85db8c6c2286ea0480298aa (patch) | |
| tree | 7053c7336197efe6cdf3da0b806c212262a41a10 /addons/web/static/tests/fields | |
| parent | 4e4c89969c88c1b4d1fd4814b54b80ae2312e8a3 (diff) | |
[FIX] web: fix missing idForLabel on some widgets
Widgets which manipulates their dom in _renderEdit were left out
from the previous implementation since this processing was done
only once when the widget is rendered the first time. If the
widget regenerates a new input upon reset for example, then it
would lack the idForLabel.
Diffstat (limited to 'addons/web/static/tests/fields')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index fa5b1224728..4d14d47215c 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -120,13 +120,13 @@ QUnit.module('basic_fields', { QUnit.module('FieldBoolean'); QUnit.test('boolean field in form view', function (assert) { - assert.expect(7); + assert.expect(11); var form = createView({ View: FormView, model: 'partner', data: this.data, - arch: '<form><field name="bar"/></form>', + arch: '<form><label for="bar" string="Awesome checkbox"/><field name="bar"/></form>', res_id: 1, }); @@ -152,6 +152,27 @@ 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(); + assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1, + "checkbox should now be checked"); + + // uncheck it back + form.$('.o_field_boolean input').click(); + assert.strictEqual(form.$('.o_field_boolean input:checked').length, 0, + "checkbox should now be unchecked"); + + // check the checkbox by clicking on label + form.$('label').click(); + assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1, + "checkbox should now be checked"); + + // uncheck it back + form.$('label').click(); + assert.strictEqual(form.$('.o_field_boolean input:checked').length, 0, + "checkbox should now be unchecked"); + // check the checkbox by hitting the "enter" key after focusing it form.$('.o_field_boolean input') .trigger("focusin") |
