From c3d1eda0176b44fd3e43364427f8f00a28615c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Tue, 3 Apr 2018 15:52:17 +0200 Subject: [PATCH] [FIX] web,account,google_calendar: chasing breaking spaces Before this commit, some breaking spaces were present in the js code. Such spaces are misinterpreted and worked by luck. This has become a problem with exported js bunldes (e.g. the external_lib bundle in im_livechat). This commit replaces breaking spaces by regular spaces. --- .../account/static/tests/reconciliation_tests.js | 14 +++++++------- .../static/tests/google_calendar_tests.js | 4 ++-- addons/web/static/src/js/core/rpc.js | 14 +++++++------- .../static/src/js/views/basic/basic_controller.js | 4 ++-- .../static/tests/fields/upgrade_fields_tests.js | 2 +- addons/web/static/tests/helpers/mock_server.js | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/account/static/tests/reconciliation_tests.js b/addons/account/static/tests/reconciliation_tests.js index 96ba1e97871..1c72b5d3e52 100644 --- a/addons/account/static/tests/reconciliation_tests.js +++ b/addons/account/static/tests/reconciliation_tests.js @@ -956,7 +956,7 @@ QUnit.module('account', { }); clientAction.appendTo($('#qunit-fixture')); - assert.strictEqual(clientAction.$('.accounting_view tfoot .cell_right, .accounting_view tfoot .cell_left').text().replace(/[$, ]+/g, ''), " 1175.00 32.58 2000.00", "should display the open balance values"); + assert.strictEqual(clientAction.$('.accounting_view tfoot .cell_right, .accounting_view tfoot .cell_left').text().replace(/[$, ]+/g, ''), " 1175.00 32.58 2000.00", "should display the open balance values"); var widget = clientAction.widgets[0]; @@ -988,8 +988,8 @@ QUnit.module('account', { widget.$('.create .create_amount input').val('1100.00').trigger('input'); - assert.strictEqual(widget.$('.accounting_view tbody .cell_right').text(), "$ 1100.00", "should display the value 1100.00 in right column"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_right').text(), "$ 75.00", "should display 'Open Balance' line because the rest to reconcile is 75.00"); + assert.strictEqual(widget.$('.accounting_view tbody .cell_right').text(), "$ 1100.00", "should display the value 1100.00 in right column"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_right').text(), "$ 75.00", "should display 'Open Balance' line because the rest to reconcile is 75.00"); assert.strictEqual(widget.$('.accounting_view tbody tr').length, 1, "should have ever only the created reconcile line"); assert.strictEqual(widget.$('.accounting_view tbody tr').text().replace(/[\n\r\s$,]+/g, ' '), " 101200 SAJ/2014/002 and SAJ/2014/003 1100.00 ", "the new line should be update the amout"); @@ -1001,9 +1001,9 @@ QUnit.module('account', { $('.ui-autocomplete .ui-menu-item a:contains(101000 Current Assets)').trigger('mouseenter').trigger('click'); widget.$('.create .create_label input').val('test0').trigger('input'); - assert.strictEqual(widget.$('.accounting_view tbody .cell_left:last').text(), "$ 100.00", "should display the value 100.00 in left column"); + assert.strictEqual(widget.$('.accounting_view tbody .cell_left:last').text(), "$ 100.00", "should display the value 100.00 in left column"); assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Open balance", "should display 'Open Balance'"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_right').text(), "$ 175.00", "should display 'Open Balance' line because the rest to reconcile is 175.00"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_right').text(), "$ 175.00", "should display 'Open Balance' line because the rest to reconcile is 175.00"); assert.strictEqual(widget.$('.accounting_view tbody tr').length, 2, "should have 2 created reconcile lines"); assert.strictEqual(widget.$('.accounting_view tbody tr:eq(1)').text().replace(/[\n\r\s$,]+/g, ' '), " 101000 test0 100.00 ", "the new line should have the selected account, name and amout"); @@ -1018,9 +1018,9 @@ QUnit.module('account', { $('.ui-autocomplete .ui-menu-item a:contains(101000 Current Assets)').trigger('mouseenter').trigger('click'); widget.$('.create .create_label input').val('test1').trigger('input'); - assert.strictEqual(widget.$('.accounting_view tbody .cell_right:last').text(), "$ 200.00", "should display the value 200.00 in left column"); + assert.strictEqual(widget.$('.accounting_view tbody .cell_right:last').text(), "$ 200.00", "should display the value 200.00 in left column"); assert.strictEqual(widget.$('.accounting_view tfoot .cell_label').text(), "Create Write-off", "should display 'Create Write-off'"); - assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$ 25.00", "should display 'Create Write-off' with 25.00 in left column"); + assert.strictEqual(widget.$('.accounting_view tfoot .cell_left').text(), "$ 25.00", "should display 'Create Write-off' with 25.00 in left column"); assert.strictEqual(widget.$('.accounting_view tbody tr').length, 3, "should have 3 created reconcile lines"); clientAction.destroy(); diff --git a/addons/google_calendar/static/tests/google_calendar_tests.js b/addons/google_calendar/static/tests/google_calendar_tests.js index 6edd786afd0..2a8c11574f4 100644 --- a/addons/google_calendar/static/tests/google_calendar_tests.js +++ b/addons/google_calendar/static/tests/google_calendar_tests.js @@ -27,8 +27,8 @@ QUnit.module('Google Calendar', { type: {string: "type", type: "integer"}, }, records: [ - {id: 5, user_id: 4, partner_id: 4, name: "event 1", start: "2016-12-13 15:55:05", stop: "2016-12-15 18:55:05", allday: false, partner_ids: [], type: 2}, - {id: 6, user_id: 4, partner_id: 4, name: "event 2", start: "2016-12-18 08:00:00", stop: "2016-12-18 09:00:00", allday: false, partner_ids: [], type: 3} + {id: 5, user_id: 4, partner_id: 4, name: "event 1", start: "2016-12-13 15:55:05", stop: "2016-12-15 18:55:05", allday: false, partner_ids: [], type: 2}, + {id: 6, user_id: 4, partner_id: 4, name: "event 2", start: "2016-12-18 08:00:00", stop: "2016-12-18 09:00:00", allday: false, partner_ids: [], type: 3} ], check_access_rights: function () { return $.when(true); diff --git a/addons/web/static/src/js/core/rpc.js b/addons/web/static/src/js/core/rpc.js index 53d298c9019..cc56cb74ebb 100644 --- a/addons/web/static/src/js/core/rpc.js +++ b/addons/web/static/src/js/core/rpc.js @@ -52,19 +52,19 @@ return { if (options.method === 'read_group') { if (!(params.args && params.args[0] !== undefined)) { - params.kwargs.domain = options.domain || params.domain || params.kwargs.domain || []; + params.kwargs.domain = options.domain || params.domain || params.kwargs.domain || []; } if (!(params.args && params.args[1] !== undefined)) { - params.kwargs.fields = options.fields || params.fields || params.kwargs.fields || []; + params.kwargs.fields = options.fields || params.fields || params.kwargs.fields || []; } if (!(params.args && params.args[2] !== undefined)) { - params.kwargs.groupby = options.groupBy || params.groupBy || params.kwargs.groupby || []; + params.kwargs.groupby = options.groupBy || params.groupBy || params.kwargs.groupby || []; } - params.kwargs.offset = options.offset || params.offset || params.kwargs.offset; - params.kwargs.limit = options.limit || params.limit || params.kwargs.limit; + params.kwargs.offset = options.offset || params.offset || params.kwargs.offset; + params.kwargs.limit = options.limit || params.limit || params.kwargs.limit; // In kwargs, we look for "orderby" rather than "orderBy" (note the absence of capital B), // since the Python argument to the actual function is "orderby". - var orderBy = options.orderBy || params.orderBy || params.kwargs.orderby; + var orderBy = options.orderBy || params.orderBy || params.kwargs.orderby; params.kwargs.orderby = orderBy ? this._serializeSort(orderBy) : orderBy; params.kwargs.lazy = 'lazy' in options ? options.lazy : params.lazy; } @@ -72,7 +72,7 @@ return { if (options.method === 'search_read') { // call the model method params.kwargs.domain = options.domain || params.domain || params.kwargs.domain; - params.kwargs.fields = options.fields || params.fields || params.kwargs.fields; + params.kwargs.fields = options.fields || params.fields || params.kwargs.fields; params.kwargs.offset = options.offset || params.offset || params.kwargs.offset; params.kwargs.limit = options.limit || params.limit || params.kwargs.limit; // In kwargs, we look for "order" rather than "orderBy" since the Python diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 328daf956ee..93b8d1ce82d 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -306,7 +306,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { * * @private */ - _disableButtons: function () { + _disableButtons: function () { if (this.$buttons) { this.$buttons.find('button').attr('disabled', true); } @@ -352,7 +352,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { * * @private */ - _enableButtons: function () { + _enableButtons: function () { if (this.$buttons) { this.$buttons.find('button').removeAttr('disabled'); } diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/fields/upgrade_fields_tests.js index 427ec7b54e3..1cb8eff1b60 100644 --- a/addons/web/static/tests/fields/upgrade_fields_tests.js +++ b/addons/web/static/tests/fields/upgrade_fields_tests.js @@ -56,7 +56,7 @@ QUnit.module('upgrade_fields', { "the upgrade label shouldn't be inside the field section"); assert.strictEqual(form.$('.o_label .label').length, 1, "the upgrade label should be inside the label section"); - assert.strictEqual(form.$('.o_label').text(), "Bar EnterpriseCoucou", + assert.strictEqual(form.$('.o_label').text(), "Bar EnterpriseCoucou", "the upgrade label should be inside the label section"); form.destroy(); }); diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/helpers/mock_server.js index b7addb7cb45..99a673e6129 100644 --- a/addons/web/static/tests/helpers/mock_server.js +++ b/addons/web/static/tests/helpers/mock_server.js @@ -792,7 +792,7 @@ var MockServer = Class.extend({ var result = this._mockSearchReadController({ model: model, domain: kwargs.domain || args[0], - fields: kwargs.fields || args[1], + fields: kwargs.fields || args[1], offset: kwargs.offset || args[2], limit: kwargs.limit || args[3], order: kwargs.order || args[4],