diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-04-13 15:35:54 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-13 16:16:18 +0200 |
| commit | 9c43ad85d463ef8f1fb4b8d16924bc71c0885a55 (patch) | |
| tree | 0889b77c4177a56f723a77b62c5f9e262b47c17b /addons/web/static | |
| parent | ec988d412187877c086e01ea007c1ce07d7b1860 (diff) | |
[FIX] web: Form: apply style attribute on rendered nodes
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_renderer.js | 3 | ||||
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index e2ec7b3de70..ff02fc85337 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -252,6 +252,9 @@ return BasicRenderer.extend({ if (node.attrs.class) { $el.addClass(node.attrs.class); } + if (node.attrs.style) { + $el.attr('style', node.attrs.style); + } }, /** * @private diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 727db44faa1..904be6baaa1 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -96,7 +96,7 @@ QUnit.module('Views', { QUnit.module('FormView'); QUnit.test('simple form rendering', function (assert) { - assert.expect(10); + assert.expect(12); var form = createView({ View: FormView, @@ -106,8 +106,8 @@ QUnit.module('Views', { '<div class="test" style="opacity: 0.5;">some html<span>aa</span></div>' + '<sheet>' + '<group>' + - '<group>' + - '<field name="foo"/>' + + '<group style="background-color: red">' + + '<field name="foo" style="color: blue"/>' + '<field name="bar"/>' + '<field name="int_field" string="f3_description"/>' + '<field name="qux"/>' + @@ -139,6 +139,11 @@ QUnit.module('Views', { assert.strictEqual(form.$('span:contains(blip)').length, 1, "should contain span with field value"); + assert.strictEqual(form.$('.o_group .o_group:first').attr('style'), 'background-color: red', + "should apply style attribute on groups"); + assert.strictEqual(form.$('.o_form_field[name=foo]').attr('style'), 'color: blue', + "should apply style attribute on fields"); + assert.strictEqual(form.$('label:contains(something_id)').length, 0, "should not contain f3 string description"); assert.strictEqual(form.$('label:contains(f3_description)').length, 1, |
