Skip to content

Commit

Permalink
[FIX] base,web: class attr for <graph/> & <pivot/>
Browse files Browse the repository at this point in the history
Before this commit, the class attribute for <graph/> and <pivot/> views
was not allowed.

As there is no valid reason not to do so, this commit now allows it.

Part-of: odoo#189786
Signed-off-by: Lucas Perais (lpe) <[email protected]>
  • Loading branch information
brboi committed Dec 9, 2024
1 parent 2a696c4 commit 22bbe42
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions addons/web/static/tests/views/graph/graph_view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ defineModels([Foo, Color, Product]);

setupChartJsForTests();

test('graph view with "class" attribute', async () => {
await mountView({
type: "graph",
resModel: "foo",
arch: `<graph class="foobar-class"/>`,
});
expect(".o_graph_view").toHaveClass("foobar-class");
});

test("simple bar chart rendering", async () => {
const view = await mountView({ type: "graph", resModel: "foo" });

Expand Down
9 changes: 9 additions & 0 deletions addons/web/static/tests/views/pivot_view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: `<pivot class="foobar-class"/>`,
});
expect(".o_pivot_view").toHaveClass("foobar-class");
});

test("simple pivot rendering", async () => {
expect.assertions(4);

Expand Down
1 change: 1 addition & 0 deletions odoo/addons/base/rng/graph_view.rng
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</rng:choice>
</rng:attribute>
</rng:optional>
<rng:optional><rng:attribute name="class"/></rng:optional>
<rng:optional><rng:attribute name="js_class"/></rng:optional>
<rng:optional><rng:attribute name="stacked"/></rng:optional>
<rng:optional><rng:attribute name="order"/></rng:optional>
Expand Down
1 change: 1 addition & 0 deletions odoo/addons/base/rng/pivot_view.rng
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<rng:include href="common.rng"/>
<rng:define name="pivot">
<rng:element name="pivot">
<rng:optional><rng:attribute name="class"/></rng:optional>
<rng:optional><rng:attribute name="sample"/></rng:optional>
<rng:optional><rng:attribute name="string"/></rng:optional>
<rng:optional><rng:attribute name="stacked"/></rng:optional>
Expand Down

0 comments on commit 22bbe42

Please sign in to comment.