diff options
Diffstat (limited to 'addons/web/static/tests/views/graph_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/graph_tests.js | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js index 07f7d060347..f7d22f27a64 100644 --- a/addons/web/static/tests/views/graph_tests.js +++ b/addons/web/static/tests/views/graph_tests.js @@ -90,7 +90,6 @@ QUnit.module('Views', { }); }); - QUnit.test('default type attribute', function (assert) { assert.expect(1); @@ -106,7 +105,6 @@ QUnit.module('Views', { graph.destroy(); }); - QUnit.test('switching mode', function (assert) { assert.expect(6); @@ -191,7 +189,6 @@ QUnit.module('Views', { }); }); - QUnit.test('no content helper', function (assert) { var done = assert.async(); assert.expect(4); @@ -442,6 +439,43 @@ QUnit.module('Views', { graph.destroy(); }); + + QUnit.test('initial groupby is kept when reloading', function (assert) { + var done = assert.async(); + assert.expect(4); + + var graph = createView({ + View: GraphView, + model: 'foo', + data: this.data, + arch: '<graph>' + + '<field name="product_id" type="row"/>' + + '<field name="foo" type="measure"/>' + + '</graph>', + mockRPC: function (route, args) { + if (args.method === 'read_group') { + assert.deepEqual(args.kwargs.groupby, ['product_id'], + "should group by the correct field"); + } + return this._super.apply(this, arguments); + }, + }); + + + return concurrency.delay(0).then(function () { + assert.strictEqual(graph.$('.nv-groups rect').length, 2, + "should display two groups"); + + graph.reload({groupBy: []}); + return concurrency.delay(0).then(function () { + assert.strictEqual(graph.$('.nv-groups rect').length, 2, + "should still display two groups"); + + graph.destroy(); + done(); + }); + }); + }); }); }); |
