summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/pivot_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/views/pivot_tests.js')
-rw-r--r--addons/web/static/tests/views/pivot_tests.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js
index c3acdb52399..267437845b0 100644
--- a/addons/web/static/tests/views/pivot_tests.js
+++ b/addons/web/static/tests/views/pivot_tests.js
@@ -825,4 +825,38 @@ QUnit.module('Views', {
pivot.destroy();
});
+ QUnit.test('correctly use group_by key from the context', function (assert) {
+ assert.expect(7);
+
+ var pivot = createView({
+ View: PivotView,
+ model: 'partner',
+ data: this.data,
+ arch: '<pivot>' +
+ '<field name="customer" type="col" />' +
+ '<field name="foo" type="measure" />' +
+ '</pivot>',
+ groupBy: ['product_id'],
+ });
+
+ assert.strictEqual(pivot.$('thead .o_pivot_header_cell_opened').length, 1,
+ 'column: should have one opened header');
+ assert.strictEqual(pivot.$('thead .o_pivot_header_cell_closed:contains(First)').length, 1,
+ 'column: should display one closed header with "First"');
+ assert.strictEqual(pivot.$('thead .o_pivot_header_cell_closed:contains(Second)').length, 1,
+ 'column: should display one closed header with "Second"');
+
+ assert.strictEqual(pivot.$('tbody .o_pivot_header_cell_opened').length, 1,
+ 'row: should have one opened header');
+ assert.strictEqual(pivot.$('tbody .o_pivot_header_cell_closed:contains(xphone)').length, 1,
+ 'row: should display one closed header with "xphone"');
+ assert.strictEqual(pivot.$('tbody .o_pivot_header_cell_closed:contains(xpad)').length, 1,
+ 'row: should display one closed header with "xpad"');
+
+ assert.strictEqual(pivot.$('tbody tr:first td:nth(3)').text(), '32',
+ 'selected measure should be foo, with total 32');
+
+ pivot.destroy();
+ });
+
});});