[IMP] web,*: config: add XXS size to config.device

In Less, the size_class XXS is defined and used in media queries.
This rev. adds it in JS for sake of consistency.

Code in addons comparing the size_class needed to be adapted due
to the new XXS size_class.

Moreover, we now use the helper 'config.device.isMobile' everywhere
we should, instead of manually comparing the size_class.

Finally, we changed the way the config.device has to be specified
in the test environment. From now on, only the size_class should be
set, and the isMobile flag is computed automatically.
This commit is contained in:
Aaron Bohy
2018-01-26 19:26:03 +01:00
parent cb339842d4
commit cf178a2f06
13 changed files with 29 additions and 32 deletions
@@ -3,6 +3,7 @@ odoo.define('web.basic_fields_tests', function (require) {
var basicFields = require('web.basic_fields');
var concurrency = require('web.concurrency');
var config = require('web.config');
var core = require('web.core');
var FormView = require('web.FormView');
var KanbanView = require('web.KanbanView');
@@ -2987,9 +2988,8 @@ QUnit.module('basic_fields', {
res_id: 1,
config: {
device: {
size_class: 0, // Screen XS
SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
}
size_class: config.device.SIZES.XS,
},
},
});
@@ -3032,9 +3032,8 @@ QUnit.module('basic_fields', {
arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>',
config: {
device: {
size_class: 0, // Screen XS
SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
}
size_class: config.device.SIZES.XS,
},
},
});
@@ -3097,9 +3096,8 @@ QUnit.module('basic_fields', {
res_id: 1,
config: {
device: {
size_class: 1, // Screen SM
SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
}
size_class: config.device.SIZES.SM,
},
},
});
@@ -3145,9 +3143,8 @@ QUnit.module('basic_fields', {
arch: '<tree editable="bottom"><field name="foo" widget="phone"/></tree>',
config: {
device: {
size_class: 1, // Screen SM
SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
}
size_class: config.device.SIZES.SM,
},
},
});
@@ -3199,9 +3196,8 @@ QUnit.module('basic_fields', {
},
config: {
device: {
size_class: 0,
SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
}
size_class: config.device.SIZES.XS,
},
},
});