From 22bbe421822e6cbb85aa196ec76d340e5e0c7de6 Mon Sep 17 00:00:00 2001 From: "Bruno Boi (boi)" Date: Mon, 9 Dec 2024 12:03:48 +0000 Subject: [PATCH] [FIX] base,web: class attr for & Before this commit, the class attribute for and views was not allowed. As there is no valid reason not to do so, this commit now allows it. Part-of: odoo/odoo#189786 Signed-off-by: Lucas Perais (lpe) --- addons/web/static/tests/views/graph/graph_view.test.js | 9 +++++++++ addons/web/static/tests/views/pivot_view.test.js | 9 +++++++++ odoo/addons/base/rng/graph_view.rng | 1 + odoo/addons/base/rng/pivot_view.rng | 1 + 4 files changed, 20 insertions(+) diff --git a/addons/web/static/tests/views/graph/graph_view.test.js b/addons/web/static/tests/views/graph/graph_view.test.js index 3b059e8314a07..6a612a042a5d4 100644 --- a/addons/web/static/tests/views/graph/graph_view.test.js +++ b/addons/web/static/tests/views/graph/graph_view.test.js @@ -177,6 +177,15 @@ defineModels([Foo, Color, Product]); setupChartJsForTests(); +test('graph view with "class" attribute', async () => { + await mountView({ + type: "graph", + resModel: "foo", + arch: ``, + }); + expect(".o_graph_view").toHaveClass("foobar-class"); +}); + test("simple bar chart rendering", async () => { const view = await mountView({ type: "graph", resModel: "foo" }); diff --git a/addons/web/static/tests/views/pivot_view.test.js b/addons/web/static/tests/views/pivot_view.test.js index bd522042555b3..3223c1dd54237 100644 --- a/addons/web/static/tests/views/pivot_view.test.js +++ b/addons/web/static/tests/views/pivot_view.test.js @@ -202,6 +202,15 @@ test('pivot view without "string" attribute', async () => { expect(model.metaData.title.toString()).toBe(_t("Untitled")); }); +test('pivot view with "class" attribute', async () => { + await mountView({ + type: "pivot", + resModel: "partner", + arch: ``, + }); + expect(".o_pivot_view").toHaveClass("foobar-class"); +}); + test("simple pivot rendering", async () => { expect.assertions(4); diff --git a/odoo/addons/base/rng/graph_view.rng b/odoo/addons/base/rng/graph_view.rng index 05aad5b050816..d2ee8fbb0c5ae 100644 --- a/odoo/addons/base/rng/graph_view.rng +++ b/odoo/addons/base/rng/graph_view.rng @@ -18,6 +18,7 @@ + diff --git a/odoo/addons/base/rng/pivot_view.rng b/odoo/addons/base/rng/pivot_view.rng index 23a77407594ea..f8844d642db62 100644 --- a/odoo/addons/base/rng/pivot_view.rng +++ b/odoo/addons/base/rng/pivot_view.rng @@ -8,6 +8,7 @@ +