summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/graph_tests.js
diff options
context:
space:
mode:
authorJigar Patel <jat@openerp.com>2017-07-19 14:18:12 +0530
committerGéry Debongnie <ged@odoo.com>2017-07-19 10:50:21 +0200
commitb63e22f50ea8cce8deaa7dcc0d1c5649d2d2880b (patch)
tree97de8a98ea4e12f1882298343f01b00eb5e7b880 /addons/web/static/tests/views/graph_tests.js
parentefd158523438cebd96f9f2e7243873f222a97fea (diff)
[FIX] web: Groupby not working on Pivot and Graph view
The groupby property was wrongly set in some cases: if a graph/pivot view is defined as a groupby on field F, but there is another groupby key G in the context, it will take F instead of G (at initial load).
Diffstat (limited to 'addons/web/static/tests/views/graph_tests.js')
-rw-r--r--addons/web/static/tests/views/graph_tests.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js
index 7a7d22d96d6..33b2fd8ffbd 100644
--- a/addons/web/static/tests/views/graph_tests.js
+++ b/addons/web/static/tests/views/graph_tests.js
@@ -344,6 +344,34 @@ QUnit.module('Views', {
done();
});
});
+
+ QUnit.test('correctly use group_by key from the context', function (assert) {
+ var done = assert.async();
+ assert.expect(2);
+
+ var graph = createView({
+ View: GraphView,
+ model: 'foo',
+ data: this.data,
+ arch: '<graph><field name="product_id" /></graph>',
+ groupBy: ['color_id'],
+ viewOptions: {
+ context: {
+ graph_measure: 'foo',
+ graph_mode: 'line',
+ },
+ },
+ });
+ return concurrency.delay(0).then(function () {
+ assert.strictEqual(graph.$('text:contains(xphone)').length, 0,
+ 'should not contain a text element with product in legend');
+ assert.strictEqual(graph.$('text:contains(red)').length, 1,
+ 'should contain a text element with color in legend');
+ graph.destroy();
+ done();
+ });
+ });
+
});
});