- JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the <title/> tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems.
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
odoo.define('web.upgrade_fields_tests', function (require) {
|
||
"use strict";
|
||
|
||
var FormView = require('web.FormView');
|
||
var testUtils = require('web.test_utils');
|
||
|
||
var createView = testUtils.createView;
|
||
|
||
QUnit.module('fields', {}, function () {
|
||
|
||
QUnit.module('upgrade_fields', {
|
||
beforeEach: function () {
|
||
this.data = {
|
||
partner: {
|
||
fields: {
|
||
bar: {string: "Bar", type: "boolean"},
|
||
},
|
||
}
|
||
};
|
||
},
|
||
}, function () {
|
||
|
||
QUnit.module('UpgradeBoolean');
|
||
|
||
QUnit.test('widget upgrade_boolean in a form view', function (assert) {
|
||
assert.expect(1);
|
||
|
||
var form = createView({
|
||
View: FormView,
|
||
model: 'partner',
|
||
data: this.data,
|
||
arch: '<form><field name="bar" widget="upgrade_boolean"/></form>',
|
||
});
|
||
|
||
form.$('input:checkbox').click();
|
||
assert.strictEqual($('.modal').length, 1,
|
||
"the 'Upgrade to Enterprise' dialog should be opened");
|
||
|
||
form.destroy();
|
||
});
|
||
|
||
QUnit.test('widget upgrade_boolean in a form view', function (assert) {
|
||
assert.expect(3);
|
||
|
||
var form = createView({
|
||
View: FormView,
|
||
model: 'partner',
|
||
data: this.data,
|
||
arch: '<form>' +
|
||
'<div class="o_field"><field name="bar" widget="upgrade_boolean"/></div>' +
|
||
'<div class="o_label"><label for="bar"/><div>Coucou</div></div>' +
|
||
'</form>',
|
||
});
|
||
|
||
assert.strictEqual(form.$('.o_field .label').length, 0,
|
||
"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",
|
||
"the upgrade label should be inside the label section");
|
||
form.destroy();
|
||
});
|
||
|
||
});
|
||
});
|
||
});
|