[IMP] web: add graph test from legacy

Commit [1] fixed a bug in the legacy graph view and introduced a
test. This was done while we were re-writting the graph view in
owl. This commit adds the test added by [1] in the new graph test
suite.

[1] 11eb4542ab

closes odoo/odoo#76778

X-original-commit: c5ac7fc541cbdb0a7fe7c9d01849bcc9a615a78c
Related: odoo/enterprise#20992
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit is contained in:
Aaron Bohy
2021-09-17 23:59:34 +00:00
parent 040c73fe69
commit e6bc5bfde6
@@ -17,6 +17,7 @@ import {
toggleGroupByMenu,
toggleMenu,
toggleMenuItem,
toggleMenuItemOption,
toggleSaveFavorite,
} from "@web/../tests/search/helpers";
@@ -3422,4 +3423,55 @@ QUnit.module("Views", (hooks) => {
});
checkModeIs(assert, graph, "bar");
});
QUnit.test("only process most recent data for concurrent groupby", async function (assert) {
assert.expect(6);
let def;
const graph = await makeView({
serverData,
type: "graph",
resModel: "foo",
arch: `
<graph>
<field name="product_id" type="row"/>
<field name="foo" type="measure"/>
</graph>
`,
searchViewArch: `
<search>
<filter name="group_by_color" string="Color" context="{ 'group_by': 'color_id' }"/>
<filter name="group_by_date" string="Date" context="{ 'group_by': 'date' }"/>
</search>
`,
mockRPC() {
return Promise.resolve(def);
},
});
checkLabels(assert, graph, ["xphone", "xpad"]);
checkDatasets(assert, graph, "data", { data: [82, 157] });
def = makeDeferred();
await toggleGroupByMenu(graph);
await toggleMenuItem(graph, "Color");
await toggleMenuItem(graph, "Color");
await toggleMenuItem(graph, "Date");
await toggleMenuItemOption(graph, "Date", "Month");
checkLabels(assert, graph, ["xphone", "xpad"]);
checkDatasets(assert, graph, "data", { data: [82, 157] });
def.resolve();
await nextTick();
checkLabels(assert, graph, [
"January 2016",
"March 2016",
"May 2016",
"Undefined",
"April 2016",
]);
checkDatasets(assert, graph, "data", { data: [56, 26, 4, 105, 48] });
});
});