summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-10-09 11:37:30 +0200
committerChristophe Simonis <chs@odoo.com>2018-10-09 11:37:30 +0200
commit835b77ba94bd42cd071c8077ff9a86ce977fddab (patch)
treeb53dfe3553f0cd90681270b0fdd6ae96436bf2ae /addons/web/static/tests/fields/basic_fields_tests.js
parentc36dedb0958548d0fe3f83d1d17c223ae26d247a (diff)
parentebe43bad9eff9875e7b75f41aa17b90b1d9912a7 (diff)
[MERGE] forward port branch 12.0 up to ebe43bad9ef
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js52
1 files changed, 40 insertions, 12 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 6e2188d2998..c1d51b3a1c5 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -718,7 +718,7 @@ QUnit.module('basic_fields', {
'<field name="qux" options="{\'type\': \'number\'}"/>' +
'</form>',
res_id: 4,
- translateParameters: {
+ translateParameters: {
thousands_sep: ",",
grouping: [3, 0],
},
@@ -752,7 +752,7 @@ QUnit.module('basic_fields', {
'<field name="qux"/>' +
'</form>',
res_id: 4,
- translateParameters: {
+ translateParameters: {
thousands_sep: ",",
grouping: [3, 0],
},
@@ -761,7 +761,7 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('.o_field_widget').attr('type'), 'text',
'Float field with option type must have a text type (default type).');
-
+
form.$('input').val('123456.7890').trigger('input');
form.$buttons.find('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();
@@ -1246,7 +1246,10 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('input field: change password value', function (assert) {
+ QUnit.skip('input field: change password value', function (assert) {
+ // password policy needs an RPC call to initialize &
+ // presents somewhat differently (custom widget), need way
+ // to augment/override tests
assert.expect(4);
var form = createView({
@@ -1259,7 +1262,7 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.notOk(form.$('.o_field_char').text() === "yop",
+ assert.notEqual(form.$('.o_field_char').text(), "yop",
"password field value should not be visible in read mode");
assert.strictEqual(form.$('.o_field_char').text(), "***",
"password field value should be hidden with '*' in read mode");
@@ -1274,7 +1277,7 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('input field: empty password', function (assert) {
+ QUnit.skip('input field: empty password', function (assert) {
assert.expect(3);
this.data.partner.records[0].foo = false;
@@ -2772,7 +2775,32 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('datetime field in form view 2', function (assert) {
+
+ QUnit.test('datetime field not visible in form view should not capture the focus on keyboard navigation', function (assert) {
+ assert.expect(1);
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch:'<form string="Partners"><field name="txt"/>' +
+ '<field name="datetime" invisible="True"/></form>',
+ res_id: 1,
+ viewOptions: {
+ mode: 'edit',
+ },
+ });
+
+ form.$el.find('textarea[name=txt]').trigger($.Event('keydown', {
+ which: $.ui.keyCode.TAB,
+ keyCode: $.ui.keyCode.TAB,
+ }));
+ assert.strictEqual(document.activeElement, form.$buttons.find('.o_form_button_save')[0],
+ "the save button should be selected, because the datepicker did not capture the focus");
+ form.destroy();
+ });
+
+ QUnit.test('datetime field with datetime formatted without second', function (assert) {
assert.expect(2);
this.data.partner.fields.datetime.default = "2017-08-02 12:00:05";
@@ -3514,7 +3542,7 @@ QUnit.module('basic_fields', {
'<field name="int_field" options="{\'type\': \'number\'}"/>' +
'</form>',
res_id: 4,
- translateParameters: {
+ translateParameters: {
thousands_sep: ",",
grouping: [3, 0],
},
@@ -3525,7 +3553,7 @@ QUnit.module('basic_fields', {
'Integer field with option type must have a type attribute.');
assert.strictEqual(form.$('.o_field_widget').attr('type'), 'number',
'Integer field with option type must have a type attribute equals to "number".');
-
+
form.$('input').val('1234567890').trigger('input');
form.$buttons.find('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();
@@ -3534,7 +3562,7 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('.o_field_widget').text(), '1,234,567,890',
'Integer value must be formatted in readonly view even if the input type is number.');
-
+
form.destroy();
});
@@ -3549,7 +3577,7 @@ QUnit.module('basic_fields', {
'<field name="int_field"/>' +
'</form>',
res_id: 4,
- translateParameters: {
+ translateParameters: {
thousands_sep: ",",
grouping: [3, 0],
},
@@ -3558,7 +3586,7 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('.o_field_widget').attr('type'), 'text',
'Integer field without option type must have a text type (default type).');
-
+
form.$('input').val('1234567890').trigger('input');
form.$buttons.find('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();