summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2018-08-27 14:57:55 +0200
committerSébastien Theys <seb@odoo.com>2018-08-28 09:54:12 +0200
commita175c1d2022bd117366c9b7e917851bba3b31051 (patch)
tree6f1bb333b4b8915f329b88e65b937725bae583b2 /addons/web/static/tests/fields/relational_fields_tests.js
parent82a6f4f1994d3f706a709e110645de457a4fe558 (diff)
[FIX] web: o2m correctly left-align the first create button
When there is no handle field, there was an unnecessary margin-left. When there was a handle field, the margin-left wasn't the correct way to align it. PR: #26566 Task: 1869469
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js46
1 files changed, 38 insertions, 8 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 390190ca02c..15499234c49 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -9832,8 +9832,8 @@ QUnit.module('relational_fields', {
form.destroy();
});
- QUnit.test('add a line custom control editable', function (assert) {
- assert.expect(4);
+ QUnit.test('o2m add a line custom control create editable', function (assert) {
+ assert.expect(5);
var form = createView({
View: FormView,
@@ -9862,8 +9862,10 @@ QUnit.module('relational_fields', {
});
// new controls correctly added
- assert.strictEqual($('.o_field_x2many_list_row_add').length, 1);
- assert.strictEqual($('.o_field_x2many_list_row_add').text(), "Add foodAdd pizzaAdd pasta");
+ var $td = form.$('.o_field_x2many_list_row_add');
+ assert.strictEqual($td.length, 1);
+ assert.strictEqual($td.closest('tr').find('td').length, 1);
+ assert.strictEqual($td.text(), "Add foodAdd pizzaAdd pasta");
// click add food
// check it's empty
@@ -9882,8 +9884,8 @@ QUnit.module('relational_fields', {
form.destroy();
});
- QUnit.test('add a line custom control non-editable', function (assert) {
- assert.expect(5);
+ QUnit.test('o2m add a line custom control create non-editable', function (assert) {
+ assert.expect(6);
var form = createView({
View: FormView,
@@ -9912,8 +9914,10 @@ QUnit.module('relational_fields', {
});
// new controls correctly added
- assert.strictEqual($('.o_field_x2many_list_row_add').length, 1);
- assert.strictEqual($('.o_field_x2many_list_row_add').text(), "Add foodAdd pizzaAdd pasta");
+ var $td = form.$('.o_field_x2many_list_row_add');
+ assert.strictEqual($td.length, 1);
+ assert.strictEqual($td.closest('tr').find('td').length, 1);
+ assert.strictEqual($td.text(), "Add foodAdd pizzaAdd pasta");
// click add food
// check it's empty
@@ -9938,6 +9942,32 @@ QUnit.module('relational_fields', {
form.destroy();
});
+ QUnit.test('o2m add a line custom control create align with handle', function (assert) {
+ assert.expect(3);
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch:
+ '<form string="Partners">' +
+ '<field name="p">' +
+ '<tree>' +
+ '<field name="int_field" widget="handle"/>' +
+ '</tree>' +
+ '</field>' +
+ '</form>',
+ });
+
+ // controls correctly added, at one column offset when handle is present
+ var $tr = form.$('.o_field_x2many_list_row_add').closest('tr');
+ assert.strictEqual($tr.find('td').length, 2);
+ assert.strictEqual($tr.find('td:eq(0)').text(), "");
+ assert.strictEqual($tr.find('td:eq(1)').text(), "Add a line");
+
+ form.destroy();
+ });
+
QUnit.test('one2many form view with action button', function (assert) {
// once the action button is clicked, the record is reloaded (via the
// on_close handler, executed because the python method does not return