diff options
| author | RomainLibert <rli@odoo.com> | 2018-07-03 15:34:32 +0200 |
|---|---|---|
| committer | RomainLibert <rli@odoo.com> | 2018-07-10 12:25:24 +0200 |
| commit | dc75248b89bcb6e839bcdf30830cdc5dbb9d80ec (patch) | |
| tree | 59249d1f8483dd306715eea200f817499b9c168c /addons/web/static/tests | |
| parent | b87a95b6d6b846b660506a3f4ef3472ebc4df809 (diff) | |
[IMP] web: sort measures in graph view and pivot view
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/graph_tests.js | 24 | ||||
| -rw-r--r-- | addons/web/static/tests/views/pivot_tests.js | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js index 5f7227815c1..60e6680993c 100644 --- a/addons/web/static/tests/views/graph_tests.js +++ b/addons/web/static/tests/views/graph_tests.js @@ -622,6 +622,30 @@ QUnit.module('Views', { assert.ok(true,"should not generate any error"); graph.destroy(); }); + + QUnit.test('graph measures should be alphabetically sorted', function (assert) { + assert.expect(2); + + var data = this.data; + data.foo.fields.bouh = {string: "bouh", type: "integer"}; + + var graph = createView({ + View: GraphView, + model: "foo", + data: data, + arch: '<graph string="Partners">' + + '<field name="foo" type="measure"/>' + + '<field name="bouh" type="measure"/>' + + '</graph>', + }) + + assert.strictEqual(graph.$buttons.find('.o_graph_measures_list li:first').data('field'), 'bouh', + "Bouh should be the first measure"); + assert.strictEqual(graph.$buttons.find('.o_graph_measures_list li:last').data('field'), '__count__', + "Count should be the last measure"); + + graph.destroy(); + }); }); }); diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js index 4d7358f2574..70eee5b3431 100644 --- a/addons/web/static/tests/views/pivot_tests.js +++ b/addons/web/static/tests/views/pivot_tests.js @@ -1178,4 +1178,28 @@ QUnit.module('Views', { "should have 6 rows"); pivot.destroy(); }); + + QUnit.test('pivot measures should be alphabetically sorted', function (assert) { + assert.expect(2); + + var data = this.data; + data.partner.fields.bouh = {string: "bouh", type: "integer"}; + + var pivot = createView({ + View: PivotView, + model: "partner", + data: data, + arch: '<pivot>' + + '<field name="foo" type="measure"/>' + + '<field name="bouh" type="measure"/>' + + '</pivot>', + }) + + assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list li:first').data('field'), 'bouh', + "Bouh should be the first measure"); + assert.strictEqual(pivot.$buttons.find('.o_pivot_measures_list li:last').data('field'), '__count', + "Count should be the last measure"); + + pivot.destroy(); + }); });}); |
