summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-03-31 16:32:09 +0200
committerDavid Monjoie <dmo@odoo.com>2017-06-02 15:12:55 +0200
commit2d26ed05a7630be98a8e2a465f0578414ed5f936 (patch)
tree76a5099e309bf55d3ae037f0fb61c45436c03aa5 /addons/web/static/tests/fields/relational_fields_tests.js
parent31f581972451a99b93baa230ff8ba60b763ed280 (diff)
[FIX] web: fix handle widget functionality
Also added tests for handle in list view and inside an x2many.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 8ea1ea9ef21..4f326e14f98 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -1010,6 +1010,62 @@ QUnit.module('relational_fields', {
form.destroy();
});
+ QUnit.test('embedded one2many with handle widget', function (assert) {
+ assert.expect(8);
+
+ this.data.partner.records[0].p = [1, 2, 4];
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch:'<form string="Partners">' +
+ '<sheet>' +
+ '<notebook>' +
+ '<page string="P page">' +
+ '<field name="p">' +
+ '<tree default_order="int_field">' +
+ '<field name="int_field" widget="handle"/>' +
+ '<field name="foo"/>' +
+ '</tree>' +
+ '</field>' +
+ '</page>' +
+ '</notebook>' +
+ '</sheet>' +
+ '</form>',
+ res_id: 1,
+ });
+
+ testUtils.intercept(form, "field_changed", function (event) {
+ assert.step(event.data.changes.p.data.int_field.toString());
+ }, true);
+
+ assert.strictEqual(form.$('td.o_data_cell:not(.o_handle_cell)').text(), "My little Foo Valueblipyop",
+ "should have the 3 rows in the correct order")
+
+ form.$buttons.find('.o_form_button_edit').click();
+ assert.strictEqual(form.$('td.o_data_cell:not(.o_handle_cell)').text(), "My little Foo Valueblipyop",
+ "should still have the 3 rows in the correct order")
+
+ // Drag and drop the fourth line in second position
+ testUtils.dragAndDrop(
+ form.$('.ui-sortable-handle').eq(1),
+ form.$('tbody tr').first(),
+ {position: 'top'}
+ );
+
+ assert.verifySteps(["0", "1", "2"],
+ "sequences values should be incremental starting from the previous minimum one");
+
+ assert.strictEqual(form.$('td.o_data_cell:not(.o_handle_cell)').text(), "blipMy little Foo Valueyop",
+ "should have the 3 rows in the new order")
+
+ form.$buttons.find('.o_form_button_save').click();
+ assert.strictEqual(form.$('td.o_data_cell:not(.o_handle_cell)').text(), "blipMy little Foo Valueyop",
+ "should still have the 3 rows in the new order")
+
+ form.destroy();
+ });
+
QUnit.test('one2many field when using the pager', function (assert) {
assert.expect(13);