diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-03-31 23:28:58 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 7056ec1ac6e6c23231d9044bb60efc2a0bdb7ae2 (patch) | |
| tree | a7aa305521e8ce8eb080b66fe826cd600d83b82f /addons/web/static/test | |
| parent | 21324ded09883d08ec951b0e3cc80ff5ed270aed (diff) | |
[FIX] web: various bugs with pivot view and no data
The pivot view had various small issues causing a crash when
transitioning from and to a 'no data' state.
Diffstat (limited to 'addons/web/static/test')
| -rw-r--r-- | addons/web/static/test/views/pivot_tests.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/addons/web/static/test/views/pivot_tests.js b/addons/web/static/test/views/pivot_tests.js index def0896abce..fc4c4fc4874 100644 --- a/addons/web/static/test/views/pivot_tests.js +++ b/addons/web/static/test/views/pivot_tests.js @@ -389,6 +389,53 @@ QUnit.module('Views', { pivot.destroy(); }); + QUnit.test('no content helper when no data, part 2', function (assert) { + assert.expect(1); + + this.data.partner.records = []; + + var pivot = createView({ + View: PivotView, + model: "partner", + data: this.data, + arch: '<pivot string="Partners"></pivot>', + }); + + assert.strictEqual(pivot.$('.oe_view_nocontent').length, 1, + "should have a no_content_helper"); + pivot.destroy(); + }); + + QUnit.test('no content helper when no data, part 3', function (assert) { + assert.expect(4); + + var pivot = createView({ + View: PivotView, + model: "partner", + data: this.data, + arch: '<pivot string="Partners"></pivot>', + viewOptions: { + domain: [['foo', '=', 12345]] + }, + }); + + assert.strictEqual(pivot.$('.oe_view_nocontent').length, 1, + "should have a no_content_helper"); + pivot.update({domain: [['foo', '=', 12345]]}); + assert.strictEqual(pivot.$('.oe_view_nocontent').length, 1, + "should still have a no_content_helper"); + pivot.update({domain: []}); + assert.strictEqual(pivot.$('.oe_view_nocontent').length, 0, + "should not have a no_content_helper"); + + // tries to open a field selection menu, to make sure it was not + // removed from the dom. + pivot.$('.o_pivot_header_cell_closed').first().click(); + assert.strictEqual(pivot.$('ul.o_pivot_field_menu').length, 1, + "the field selector menu exists"); + pivot.destroy(); + }); + QUnit.test('tries to restore previous state after domain change', function (assert) { assert.expect(5); |
