diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-01-04 16:17:14 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-01-26 19:26:03 +0100 |
| commit | cf178a2f068acd4b4c4fc2cda00b6ef8f6dc79c0 (patch) | |
| tree | 8cc09ab6d4d81619654c008058f5b28874eae150 /addons/web/static/tests | |
| parent | cb339842d4d8b19f3870127c00a6868af2e95004 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/fields/basic_fields_tests.js | 26 | ||||
| -rw-r--r-- | addons/web/static/tests/helpers/test_utils.js | 1 |
2 files changed, 12 insertions, 15 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index 4fd9d6ee84e..44f00d1d7f9 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -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, + }, }, }); diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 260436ff152..468b25e5733 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -346,6 +346,7 @@ function addMockEnvironment(widget, params) { initialConfig.device = _.clone(config.device); if ('device' in params.config) { _.extend(config.device, params.config.device); + config.device.isMobile = config.device.size_class <= config.device.SIZES.XS; } if ('debug' in params.config) { config.debug = params.config.debug; |
