[REF] web: better mock images routes

Before this commit, only the routes which began by '/web/image' were
mocked (simply ignored). This forgot the case were it is a full URL
(http://www.test.com/web/image). Now, also mock the static images
routes (for .png and .jpg).
This commit is contained in:
qsm-odoo
2017-09-05 12:13:55 +02:00
parent 7a4de30cee
commit 489db80101
3 changed files with 1 additions and 18 deletions
@@ -123,9 +123,6 @@ QUnit.test('basic functionality, with one sub action', function (assert) {
if (route === '/web/dataset/search_read') {
assert.deepEqual(args.domain, [['foo', '!=', 'False']], "the domain should be passed");
}
if (route === '/board/static/src/img/layout_1-1-1.png') {
return $.when();
}
if (route === '/web/view/add_custom') {
assert.step('add custom');
return $.when(true);
@@ -207,9 +204,6 @@ QUnit.test('can sort a sub list', function (assert) {
'</board>' +
'</form>',
mockRPC: function (route) {
if (route === '/board/static/src/img/layout_1-1-1.png') {
return $.when();
}
if (route === '/web/action/load') {
return $.when({
res_model: 'partner',
@@ -249,9 +243,6 @@ QUnit.test('can open a record', function (assert) {
'</board>' +
'</form>',
mockRPC: function (route) {
if (route === '/board/static/src/img/layout_1-1-1.png') {
return $.when();
}
if (route === '/web/action/load') {
return $.when({
res_model: 'partner',
@@ -295,9 +286,6 @@ QUnit.test('can drag and drop a view', function (assert) {
'</board>' +
'</form>',
mockRPC: function (route) {
if (route === '/board/static/src/img/layout_1-1-1.png') {
return $.when();
}
if (route === '/web/action/load') {
return $.when({
res_model: 'partner',
@@ -345,9 +333,6 @@ QUnit.test('twice the same action in a dashboard', function (assert) {
'</board>' +
'</form>',
mockRPC: function (route) {
if (route === '/board/static/src/img/layout_1-1-1.png') {
return $.when();
}
if (route === '/web/action/load') {
return $.when({
res_model: 'partner',
@@ -93,8 +93,6 @@ QUnit.module('Google Calendar', {
{id: 7, user_id: 4, partner_id: 4, name: "event from google calendar", start: "2016-12-28 15:55:05", stop: "2016-12-29 18:55:05", allday: false, partner_ids: [], type: 2}
);
return $.when({status: 'need_refresh'});
} else if (route === '/google_calendar/static/src/img/calendar_32.png') {
return $.when();
} else if (route === '/web/dataset/call_kw/calendar.event/search_read') {
assert.step(route);
}
@@ -846,7 +846,7 @@ var MockServer = Class.extend({
case '/web/dataset/search_read':
return $.when(this._mockSearchReadController(args));
}
if (route.indexOf('/web/image/') === 0) {
if (route.indexOf('/web/image') >= 0 || _.contains(['.png', '.jpg'], route.substr(route.length - 4))) {
return $.when();
}
switch (args.method) {