diff options
| author | Mohammed Shekha <msh@odoo.com> | 2021-02-01 09:42:00 +0000 |
|---|---|---|
| committer | Mohammed Shekha <msh@odoo.com> | 2021-02-17 11:00:19 +0000 |
| commit | e695cb7c7d6eb989fd0540412d137410363a483f (patch) | |
| tree | b76acb5a833491b4ee7021b0a07312ea90188c8d /addons/web/static/tests | |
| parent | e5d0cc6ff14d731f3b9fc5b8a446fab5d8e9990e (diff) | |
[FIX] web: fix issue of notebook page with invisiblity modifier
before this commit: when there is only one page in the notebook tag and
there is a boolean field in form to show/hide that notebook page based on
invisibility attrs, if we toggle boolean field notebook hides, that's OK
but when we toggle boolean field again then notebook page is displayed but
it is not active and due to that content of notebook page is not displayed.
after this commit: when there is only one page in notebook and it has attrs
for invisibilty, when we toggle boolean field to hide/show notebook page
then notebook page as well as content is toggled.
task-2449053
closes odoo/odoo#66338
X-original-commit: a0b5ecd344d6ac79d8e4d194cfabf3d639259c73
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 89d1797589d..2cd9130353c 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -875,6 +875,44 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('invisible attrs on notebook page which has only one page', async function (assert) { + assert.expect(4); + + var form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<sheet>' + + '<field name="bar"/>' + + '<notebook>' + + '<page string="Foo" attrs=\'{"invisible": [["bar", "!=", false]]}\'>' + + '<field name="foo"/>' + + '</page>' + + '</notebook>' + + '</sheet>' + + '</form>', + res_id: 1, + viewOptions: { + mode: 'edit', + }, + }); + + assert.notOk(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'), + 'first tab should not be active'); + assert.ok(form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'), + 'first tab should be invisible'); + + // enable checkbox + await testUtils.dom.click(form.$('.o_field_boolean input')); + assert.ok(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'), + 'first tab should be active'); + assert.notOk(form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'), + 'first tab should be visible'); + + form.destroy(); + }); + QUnit.test('first notebook page invisible', async function (assert) { assert.expect(2); |
