diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-12-12 11:38:25 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-12-12 11:38:25 +0100 |
| commit | f351dd8cab980a67ee17c431574d8ba9c37b8fdc (patch) | |
| tree | 2cb6e64d0a5083aade80206ea7fbfbcda69992b8 /addons/web/static/tests | |
| parent | 1144235d06a2ad42060c05d4ece145ce46a660e1 (diff) | |
| parent | 047e2b28de4653f11e097e6232d7fb79d54ce3af (diff) | |
[MERGE] forward port branch 12.0 up to 047e2b28de4
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/chrome/action_manager_tests.js | 56 | ||||
| -rw-r--r-- | addons/web/static/tests/core/py_utils_tests.js | 7 | ||||
| -rw-r--r-- | addons/web/static/tests/views/graph_tests.js | 33 | ||||
| -rw-r--r-- | addons/web/static/tests/views/pivot_tests.js | 17 |
4 files changed, 110 insertions, 3 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 6c0b0d96703..7eea78ded29 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -2202,6 +2202,62 @@ QUnit.module('ActionManager', { actionManager.destroy(); }); + QUnit.test('orderedBy in context is not propagated when executing another action', function (assert) { + assert.expect(6); + + this.data.partner.fields.foo.sortable = true, + + this.archs['partner,false,form'] = '<header>' + + '<button name="8" string="Execute action" type="action"/>' + + '</header>'; + + var searchReadCount = 0; + var actionManager = createActionManager({ + actions: this.actions, + archs: this.archs, + data: this.data, + mockRPC: function (route, args) { + if (route === '/web/dataset/search_read') { + if (searchReadCount === 1) { + assert.strictEqual(args.model, 'partner'); + assert.notOk(args.sort); + } + if (searchReadCount === 2) { + assert.strictEqual(args.model, 'partner'); + assert.strictEqual(args.sort, "foo ASC"); + } + if (searchReadCount === 3) { + assert.strictEqual(args.model, 'pony'); + assert.notOk(args.sort); + } + searchReadCount += 1; + } + return this._super.apply(this, arguments); + }, + }); + actionManager.doAction(3); + + // Simulate the activation of a filter + var searchData = { + domains: [[["foo", "=", "yop"]]], + contexts: [{ + orderedBy: [], + }], + }; + actionManager.trigger_up('search', searchData); + + // Sort records + actionManager.$('.o_list_view th.o_column_sortable').click(); + + // get to the form view of the model, on the first record + actionManager.$('.o_data_cell:first').click(); + + // Change model by clicking on the button within the form + actionManager.$('.o_form_view button').click(); + + actionManager.destroy(); + }); + QUnit.test('breadcrumbs are updated when switching between views', function (assert) { assert.expect(10); diff --git a/addons/web/static/tests/core/py_utils_tests.js b/addons/web/static/tests/core/py_utils_tests.js index d59fd30f957..be5760fc6c7 100644 --- a/addons/web/static/tests/core/py_utils_tests.js +++ b/addons/web/static/tests/core/py_utils_tests.js @@ -1254,6 +1254,13 @@ QUnit.module('core', function () { assert.checkAST(expr); }); + QUnit.test("parse escaped quoted strings", function (assert) { + assert.expect(2); + + assert.checkAST(`'\"'`, "a string containing \""); + assert.checkAST(`'\'`, "a string containing \'"); + }); + QUnit.module('pyutils (_normalizeDomain)'); QUnit.assert.checkNormalization = function (domain, normalizedDomain) { diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js index 73f2179dc8f..d651afc030c 100644 --- a/addons/web/static/tests/views/graph_tests.js +++ b/addons/web/static/tests/views/graph_tests.js @@ -785,13 +785,40 @@ QUnit.module('Views', { '</graph>', }); - assert.strictEqual(graph.$("svg.nvd3-svg:contains('Undefined')").length, 0); - assert.strictEqual(graph.$("svg.nvd3-svg:contains('March')").length, 1); + assert.strictEqual(graph.$("svg.nvd3-svg .nv-x:contains('Undefined')").length, 0); + assert.strictEqual(graph.$("svg.nvd3-svg:contains('January')").length, 1); testUtils.dom.click(graph.$buttons.find('.o_graph_button[data-mode=bar]')); - assert.strictEqual(graph.$("svg.nvd3-svg:contains('Undefined')").length, 1); + assert.strictEqual(graph.$("svg.nvd3-svg .nv-x:contains('Undefined')").length, 1); + assert.strictEqual(graph.$("svg.nvd3-svg:contains('January')").length, 1); + + graph.destroy(); + }); + + QUnit.test('Undefined should appear in bar, pie graph but not in line graph with multiple groupbys', function (assert) { + assert.expect(6); + + var graph = createView({ + View: GraphView, + model: "foo", + groupBy:['date', 'color_id'], + data: this.data, + arch: '<graph string="Partners" type="line">' + + '<field name="bar"/>' + + '</graph>', + }); + + assert.strictEqual(graph.$("svg.nvd3-svg .nv-x:contains('Undefined')").length, 0); assert.strictEqual(graph.$("svg.nvd3-svg:contains('January')").length, 1); + graph.$buttons.find('.o_graph_button[data-mode=bar]').click(); + assert.strictEqual(graph.$("svg.nvd3-svg .nv-x:contains('Undefined')").length, 1); + assert.strictEqual(graph.$("svg.nvd3-svg:contains('January')").length, 1); + + // Undefined should not appear after switching back to line chart + graph.$buttons.find('.o_graph_button[data-mode=line]').click(); + assert.strictEqual(graph.$("svg.nvd3-svg .nv-x:contains('Undefined')").length, 0); + assert.strictEqual(graph.$("svg.nvd3-svg:contains('January')").length, 1); graph.destroy(); }); }); diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/views/pivot_tests.js index 46c28529bed..3e3ba9fd89a 100644 --- a/addons/web/static/tests/views/pivot_tests.js +++ b/addons/web/static/tests/views/pivot_tests.js @@ -149,6 +149,23 @@ QUnit.module('Views', { pivot.destroy(); }); + QUnit.test('pivot rendering with string attribute on non stored field', function (assert) { + assert.expect(1); + + this.data.partner.fields.fubar = {string: "Fubar", type: "integer", store:false}; + + var pivot = createView({ + View: PivotView, + model: "partner", + data: this.data, + arch: '<pivot string="Partners">' + + '<field name="fubar" string="fubar" type="measure"/>' + + '</pivot>', + }); + assert.ok(pivot.$el.hasClass('o_pivot'),'Non stored fields can have a string attribute'); + pivot.destroy(); + }); + QUnit.test('pivot rendering with invisible attribute on field', function (assert) { assert.expect(2); // when invisible, a field should neither be an active measure, |
