From e6bc5bfde60713a06d0aff09937c976414896a08 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 17 Sep 2021 13:23:43 +0000 Subject: [PATCH] [IMP] web: add graph test from legacy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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] 11eb4542ab924fe2250fea4613cb1875683194b2 closes odoo/odoo#76778 X-original-commit: c5ac7fc541cbdb0a7fe7c9d01849bcc9a615a78c Related: odoo/enterprise#20992 Signed-off-by: Géry Debongnie (ged) --- .../static/tests/views/graph_view_tests.js | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/addons/web/static/tests/views/graph_view_tests.js b/addons/web/static/tests/views/graph_view_tests.js index 0c853c97356..f938b9f0562 100644 --- a/addons/web/static/tests/views/graph_view_tests.js +++ b/addons/web/static/tests/views/graph_view_tests.js @@ -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: ` + + + + + `, + searchViewArch: ` + + + + + `, + 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] }); + }); });