summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-21 18:48:13 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-21 18:48:13 +0200
commitef6b574eda3c3c5c8e911f2e8923e24ea8b50b50 (patch)
treea7f41d2feb24bf87a80ed67e529ed25a105b6416 /addons/web/static/tests
parent0c34698c478ab3adc7d768ad140fa4a4dd3d0969 (diff)
parent6cc7d3f9451eb41a472053dc3c04da0bbd3c7d1e (diff)
[MERGE] forward port branch saas-11.3 up to 6cc7d3f9451
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/views/graph_tests.js19
-rw-r--r--addons/web/static/tests/views/list_tests.js39
2 files changed, 58 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js
index 5f7227815c1..4939a8c9b37 100644
--- a/addons/web/static/tests/views/graph_tests.js
+++ b/addons/web/static/tests/views/graph_tests.js
@@ -190,6 +190,25 @@ QUnit.module('Views', {
});
QUnit.test('no content helper', function (assert) {
+ assert.expect(2);
+ this.data.foo.records = [];
+
+ var graph = createView({
+ View: GraphView,
+ model: "foo",
+ data: this.data,
+ arch: '<graph string="Gloups">' +
+ '<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);
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 8aa70c1c099..95f2af74f09 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -663,6 +663,45 @@ QUnit.module('Views', {
list.destroy();
});
+ QUnit.test('selection is kept on render without reload', function (assert) {
+ assert.expect(5);
+
+ var list = createView({
+ View: ListView,
+ model: 'foo',
+ data: this.data,
+ groupBy: ['foo'],
+ viewOptions: {hasSidebar: true},
+ arch: '<tree>' +
+ '<field name="foo"/>' +
+ '<field name="int_field" sum="Sum"/>' +
+ '</tree>',
+ });
+
+ // open blip grouping and check all lines
+ list.$('.o_group_header:contains("blip (2)")').click();
+ list.$('.o_data_row input').click();
+ assert.strictEqual(true, list.sidebar.$el.is(':visible'),
+ "element checked so sidebar")
+
+ // open yop grouping and verify blip are still checked
+ list.$('.o_group_header:contains("yop (1)")').click()
+ assert.strictEqual(2, list.$('.o_data_row input:checked').length,
+ "opening a grouping does not uncheck others");
+ assert.strictEqual(true, list.sidebar.$el.is(':visible'),
+ "element checked so sidebar")
+
+ // close and open blip grouping and verify blip are unchecked
+ list.$('.o_group_header:contains("blip (2)")').click();
+ list.$('.o_group_header:contains("blip (2)")').click();
+ assert.strictEqual(0, list.$('.o_data_row input:checked').length,
+ "opening and closing a grouping uncheck its elements");
+ assert.strictEqual(false, list.sidebar.$el.is(':visible'),
+ "no element checked so no sidebar")
+
+ list.destroy();
+ });
+
QUnit.test('aggregates are computed correctly', function (assert) {
assert.expect(4);