summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-06-27 17:56:00 +0200
committerMartin Geubelle <mge@odoo.com>2017-06-28 16:53:45 +0200
commit157732cfb15d743c66c36a1bdcb350026a0473e4 (patch)
treee142b7175052844d24a0430700713373dbf190e5 /addons/web/static/tests/fields/basic_fields_tests.js
parent98602e93cc3f8586db5d22932aecdd5192584a55 (diff)
[FIX] web: FieldText: keep editing the textarea after enter
In the editable list, when pressing enter, the cursor goes to the next line and the current row is saved. This should not be the case for a textarea (i.e. in the FieldText widget). In this particular case, we just want to continue editing the textarea.
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 8f26c922a83..50daedb7dcb 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -1043,6 +1043,40 @@ QUnit.module('basic_fields', {
_t.database.multi_lang = multiLang;
});
+ QUnit.test('go to next line (and not the next row) when pressing enter', function (assert) {
+ assert.expect(4);
+
+ this.data.partner.fields.foo.type = 'text';
+ var list = createView({
+ View: ListView,
+ model: 'partner',
+ data: this.data,
+ arch: '<list editable="top">' +
+ '<field name="int_field"/>' +
+ '<field name="foo"/>' +
+ '<field name="qux"/>' +
+ '</list>',
+ });
+
+ list.$('tbody tr:first .o_list_text').click();
+ var $textarea = list.$('textarea.o_field_text');
+ assert.strictEqual($textarea.length, 1, "should have a text area");
+ assert.strictEqual($textarea.val(), 'yop', 'should still be "yop" in edit');
+
+ assert.strictEqual(list.$('textarea').get(0), document.activeElement,
+ "text area should have the focus");
+
+ // click on enter
+ list.$('textarea')
+ .trigger({type: "keydown", which: $.ui.keyCode.ENTER})
+ .trigger({type: "keyup", which: $.ui.keyCode.ENTER});
+
+ assert.strictEqual(list.$('textarea').first().get(0), document.activeElement,
+ "text area should still have the focus");
+
+ list.destroy();
+ });
+
QUnit.module('FieldBinary');
QUnit.test('binary fields are correctly rendered', function (assert) {