summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/graph_tests.js
diff options
context:
space:
mode:
authorAdrien Dieudonne <adr@odoo.com>2018-09-25 14:46:17 +0200
committerAdrien Dieudonne <adr@odoo.com>2018-09-25 15:36:29 +0200
commita8ffbe28b277ac8cd384a700a48a72e363714dab (patch)
treed3b6cac46f714b95b35fe17b2b2dcf46f4b47e19 /addons/web/static/tests/views/graph_tests.js
parent5a439a85efc21aab6dc17e4624c40c30772849a8 (diff)
[FIX] web: undefined graph when pie chart has no data
Before this commit, a crash occured when the no content helper was rendered on an pie chart without data.
Diffstat (limited to 'addons/web/static/tests/views/graph_tests.js')
-rw-r--r--addons/web/static/tests/views/graph_tests.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js
index 5c9e5b67d6f..595ed3f31dd 100644
--- a/addons/web/static/tests/views/graph_tests.js
+++ b/addons/web/static/tests/views/graph_tests.js
@@ -225,7 +225,7 @@ QUnit.module('Views', {
});
});
- QUnit.test('no content helper', function (assert) {
+ QUnit.test('no content helper (bar chart)', function (assert) {
assert.expect(2);
this.data.foo.records = [];
@@ -244,6 +244,25 @@ QUnit.module('Views', {
graph.destroy();
});
+ QUnit.test('no content helper (pie chart)', function (assert) {
+ assert.expect(2);
+ this.data.foo.records = []
+
+ var graph = createView({
+ View: GraphView,
+ model: "foo",
+ data: this.data,
+ arch: '<graph type="pie">' +
+ '<field name="product_id"/>' +
+ '</graph>',
+ });
+ assert.strictEqual(graph.$('div.o_graph_svg_container svg.nvd3-svg').length, 0,
+ "should not contain a div with a svg element");
+ assert.strictEqual(graph.$('div.o_view_nocontent').length, 1,
+ "should display the no content helper");
+ graph.destroy();
+ });
+
QUnit.test('no content helper after update', function (assert) {
var done = assert.async();
assert.expect(4);