diff options
Diffstat (limited to 'addons/web/static/tests/views/pivot_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/pivot_tests.js | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js index ccbf24895dd..5dbc03e1a2b 100644 --- a/addons/web/static/tests/views/pivot_tests.js +++ b/addons/web/static/tests/views/pivot_tests.js @@ -1096,7 +1096,7 @@ QUnit.module('Views', { pivot.destroy(); }); - QUnit.skip('Reload, group by columns, reload', function (assert) { + QUnit.test('Reload, group by columns, reload', function (assert) { assert.expect(2); var pivot = createView({ @@ -1118,7 +1118,7 @@ QUnit.module('Views', { pivot_row_groupby: []}; // Check that column groupbys were not lost - assert.deepEqual(pivot.getContext(), expectedContext, + assert.deepEqual(pivot.getOwnedQueryParams(), {context: expectedContext}, 'Column groupby not lost after first reload'); // Set a column groupby @@ -1132,12 +1132,44 @@ QUnit.module('Views', { pivot_measures: ['__count'], pivot_row_groupby: []}; - assert.deepEqual(pivot.getContext(), expectedContext, + assert.deepEqual(pivot.getOwnedQueryParams(), {context: expectedContext}, 'Column groupby not lost after second reload'); pivot.destroy(); }); + QUnit.test('Empty results keep groupbys', function (assert) { + assert.expect(2); + + var pivot = createView({ + View: PivotView, + model: "partner", + data: this.data, + arch: '<pivot/>', + }); + + // Set a column groupby + pivot.$('thead .o_pivot_header_cell_closed').click(); + pivot.$('.o_field_selection .dropdown-item[data-field=customer]').click(); + + // Set a domain for empty results + pivot.update({domain: [['id', '=', false]]}); + + var expectedContext = {pivot_column_groupby: ['customer'], + pivot_measures: ['__count'], + pivot_row_groupby: []}; + assert.deepEqual(pivot.getOwnedQueryParams(), {context: expectedContext}, + 'Column groupby not lost after empty results'); + + // Set a domain for not empty results + pivot.update({domain: [['product_id', '=', 37]]}); + + assert.deepEqual(pivot.getOwnedQueryParams(), {context: expectedContext}, + 'Column groupby not lost after reload after empty results'); + + pivot.destroy(); + }); + QUnit.test('correctly uses pivot_ keys from the context', function (assert) { assert.expect(7); |
