summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js500
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js380
-rw-r--r--addons/web/static/tests/views/calendar_tests.js16
-rw-r--r--addons/web/static/tests/views/form_tests.js244
-rw-r--r--addons/web/static/tests/views/kanban_tests.js14
-rw-r--r--addons/web/static/tests/views/list_tests.js61
6 files changed, 604 insertions, 611 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 02f59278786..54907582685 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -322,7 +322,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldFloat');
- QUnit.test('float field when unset', function(assert) {
+ QUnit.test('float field when unset', function (assert) {
assert.expect(1);
var form = createView({
@@ -337,7 +337,7 @@ QUnit.module('basic_fields', {
res_id: 4,
});
- assert.ok(form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(form.$('.o_field_widget').hasClass('o_field_empty'),
'Non-set float field should be recognized as unset.');
form.destroy();
@@ -359,7 +359,7 @@ QUnit.module('basic_fields', {
'</form>',
res_id: 1,
});
- assert.strictEqual(form.$('span.o_form_field_number:contains(0.4)').length, 1,
+ assert.strictEqual(form.$('span.o_field_number:contains(0.4)').length, 1,
"should contain a number rounded to 1 decimal");
form.destroy();
});
@@ -379,22 +379,22 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.ok(!form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(!form.$('.o_field_widget').hasClass('o_field_empty'),
'Float field should be considered set for value 0.');
- assert.strictEqual(form.$('.o_form_field.o_form_field_number').first().text(), '0.000',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '0.000',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '0.000',
+ assert.strictEqual(form.$('input').val(), '0.000',
'The value should be rendered with correct precision.');
- form.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '108.2458938598598',
+ form.$('input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').val(), '108.2458938598598',
'The value should not be formated yet.');
- form.$('input.o_form_input').val('18.8958938598598').trigger('input');
+ form.$('input').val('18.8958938598598').trigger('input');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_form_field_number').first().text(), '18.896',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '18.896',
'The new value should be rounded properly.');
form.destroy();
@@ -420,23 +420,23 @@ QUnit.module('basic_fields', {
var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first();
$cell.click();
- assert.strictEqual(list.$('input.o_form_input').length, 1,
+ assert.strictEqual(list.$('input[name="qux"]').length, 1,
'The view should have 1 input for editable float.');
- list.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '108.2458938598598',
+ list.$('input[name="qux"]').val('108.2458938598598').trigger('input');
+ assert.strictEqual(list.$('input[name="qux"]').val(), '108.2458938598598',
'The value should not be formated yet.');
- list.$('input.o_form_input').val('18.8958938598598').trigger('input');
+ list.$('input[name="qux"]').val('18.8958938598598').trigger('input');
list.$buttons.find('.o_list_button_save').click();
- assert.strictEqual(list.$('.o_form_field.o_form_field_number').first().text(), '18.896',
+ assert.strictEqual(list.$('.o_field_widget').first().text(), '18.896',
'The new value should be rounded properly.');
list.destroy();
});
- QUnit.module('EmailWidget');
+ QUnit.module('FieldEmail');
QUnit.test('email field in form view', function (assert) {
assert.expect(7);
@@ -455,7 +455,7 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- var $mailtoLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ var $mailtoLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($mailtoLink.length, 1,
"should have a anchor with correct classes");
assert.strictEqual($mailtoLink.text(), 'yop',
@@ -465,17 +465,17 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the email field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- $mailtoLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ $mailtoLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($mailtoLink.text(), 'new',
"new value should be displayed properly");
assert.strictEqual($mailtoLink.attr('href'), 'mailto:new',
@@ -567,22 +567,22 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field').text(), 'yop',
+ assert.strictEqual(form.$('.o_field_widget').text(), 'yop',
"the value should be displayed properly");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the char field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('limbo').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('limbo').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').text(), 'limbo',
+ assert.strictEqual(form.$('.o_field_widget').text(), 'limbo',
'the new value should be displayed');
form.destroy();
});
@@ -639,30 +639,30 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').length, 1,
"should have a anchor with correct classes");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').attr('href'), 'yop',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').attr('href'), 'yop',
"should have proper href link");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').text(), 'yop',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').text(), 'yop',
"the value should be displayed properly");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the char field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('limbo').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('limbo').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').length, 1,
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').length, 1,
"should still have a anchor with correct classes");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').attr('href'), 'limbo',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').attr('href'), 'limbo',
"should have proper new href link");
- assert.strictEqual(form.$('a.o_form_uri.o_form_field.o_text_overflow').text(), 'limbo',
+ assert.strictEqual(form.$('a.o_form_uri.o_field_widget.o_text_overflow').text(), 'limbo',
'the new value should be displayed');
form.destroy();
@@ -727,12 +727,12 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.ok(form.$('div.o_form_textarea').length, "should have a text area");
- assert.strictEqual(form.$('div.o_form_textarea').text(), 'yop', 'should be "yop" in readonly');
+ assert.ok(form.$('div.o_field_text').length, "should have a text area");
+ assert.strictEqual(form.$('div.o_field_text').text(), 'yop', 'should be "yop" in readonly');
form.$buttons.find('.o_form_button_edit').click();
- var $textarea = form.$('.o_form_textarea textarea');
+ var $textarea = form.$('textarea.o_field_text');
assert.ok($textarea.length, "should have a text area");
assert.strictEqual($textarea.val(), 'yop', 'should still be "yop" in edit');
@@ -744,7 +744,7 @@ QUnit.module('basic_fields', {
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('div.o_form_textarea').text(), 'hello world',
+ assert.strictEqual(form.$('div.o_field_text').text(), 'hello world',
'should be "hello world" after save');
form.destroy();
});
@@ -764,7 +764,7 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- var $field = form.$('div.o_list_text');
+ var $field = form.$('div.o_field_text');
assert.strictEqual($field.outerHeight(), $field[0].scrollHeight,
"text field should not have a scroll bar");
@@ -805,27 +805,27 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('a.o_form_field[name="document"] > .fa-download').length, 1,
+ assert.strictEqual(form.$('a.o_field_widget[name="document"] > .fa-download').length, 1,
"the binary field should be rendered as a downloadable link in readonly");
- form.$('a.o_form_field[name="document"]').click();
+ form.$('a.o_field_widget[name="document"]').click();
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('a.o_form_field[name="document"] > .fa-download').length, 0,
+ assert.strictEqual(form.$('a.o_field_widget[name="document"] > .fa-download').length, 0,
"the binary field should not be rendered as a downloadable link in edit");
- assert.strictEqual(form.$('div.o_form_field_binary_file[name="document"]').length, 1,
+ assert.strictEqual(form.$('div.o_field_binary_file[name="document"]').length, 1,
"the binary field should be correctly rendered in edit");
- assert.strictEqual(form.$('.o_form_field_binary_file > input').attr('readonly'), 'readonly',
+ assert.strictEqual(form.$('.o_field_binary_file > input').attr('readonly'), 'readonly',
"the input should be readonly");
- assert.strictEqual(form.$('.o_form_field_binary_file > .o_clear_file_button').length, 1,
+ assert.strictEqual(form.$('.o_field_binary_file > .o_clear_file_button').length, 1,
"there shoud be a button to clear the file");
- form.$('.o_form_field_binary_file > .o_clear_file_button').click();
+ form.$('.o_field_binary_file > .o_clear_file_button').click();
- assert.ok(form.$('.o_form_field_binary_file > input').hasClass('o_hidden'),
+ assert.ok(form.$('.o_field_binary_file > input').hasClass('o_hidden'),
"the input should be hidden");
- assert.strictEqual(form.$('.o_form_field_binary_file > .o_select_file_button:not(.o_hidden)').length, 1,
+ assert.strictEqual(form.$('.o_field_binary_file > .o_select_file_button:not(.o_hidden)').length, 1,
"there shoud be a button to upload the file");
form.destroy();
@@ -1106,7 +1106,7 @@ QUnit.module('basic_fields', {
arch:'<form string="Partners"><field name="date"/></form>',
res_id: 4,
});
- var $span = form.$('span.o_form_field');
+ var $span = form.$('span.o_field_widget');
assert.strictEqual($span.length, 1, "should have one span in the form view");
assert.strictEqual($span.text(), "", "and it should be empty");
form.destroy();
@@ -1135,7 +1135,7 @@ QUnit.module('basic_fields', {
},
});
- assert.strictEqual(form.$('.o_form_field_date').text(), '02/03/2017',
+ assert.strictEqual(form.$('.o_field_date').text(), '02/03/2017',
'the date should be correctly displayed in readonly');
// switch to edit mode
@@ -1157,7 +1157,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '02/22/2017',
+ assert.strictEqual(form.$('.o_field_date').text(), '02/22/2017',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1244,7 +1244,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '',
+ assert.strictEqual(form.$('.o_field_date').text(), '',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1252,7 +1252,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldDatetime');
- QUnit.test('datetime field in form view', function(assert) {
+ QUnit.test('datetime field in form view', function (assert) {
assert.expect(6);
var form = createView({
@@ -1271,7 +1271,7 @@ QUnit.module('basic_fields', {
});
var expectedDateString = "02/08/2017 12:00:00"; // 10:00:00 without timezone
- assert.strictEqual(form.$('.o_form_field_date').text(), expectedDateString,
+ assert.strictEqual(form.$('.o_field_date').text(), expectedDateString,
'the datetime should be correctly displayed in readonly');
// switch to edit mode
@@ -1302,7 +1302,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), newExpectedDateString,
+ assert.strictEqual(form.$('.o_field_date').text(), newExpectedDateString,
'the selected date should be displayed after saving');
form.destroy();
@@ -1407,7 +1407,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_date').text(), '',
+ assert.strictEqual(form.$('.o_field_date').text(), '',
'the selected date should be displayed after saving');
form.destroy();
});
@@ -1415,7 +1415,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldMonetary');
- QUnit.test('monetary field in form view', function(assert) {
+ QUnit.test('monetary field in form view', function (assert) {
assert.expect(5);
var form = createView({
@@ -1435,28 +1435,28 @@ QUnit.module('basic_fields', {
});
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '$\u00a09.10',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '$\u00a09.10',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').first().val(), '9.10',
+ assert.strictEqual(form.$('input').val(), '9.10',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(form.$('input.o_form_input').parent().children().first().text(), '$',
+ assert.strictEqual(form.$('input').parent().children().first().text(), '$',
'The input should be preceded by a span containing the currency symbol.');
- form.$('input.o_form_input').first().val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '108.2458938598598',
+ form.$('input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').val(), '108.2458938598598',
'The value should not be formated yet.');
form.$buttons.find('.o_form_button_save').click();
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '$\u00a0108.25',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '$\u00a0108.25',
'The new value should be rounded properly.');
form.destroy();
});
- QUnit.test('monetary field with currency symbol after', function(assert) {
+ QUnit.test('monetary field with currency symbol after', function (assert) {
assert.expect(5);
var form = createView({
@@ -1476,22 +1476,22 @@ QUnit.module('basic_fields', {
});
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '0.00\u00a0€',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '0.00\u00a0€',
'The value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').first().val(), '0.00',
+ assert.strictEqual(form.$('input').first().val(), '0.00',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(form.$('input.o_form_input').parent().children().eq(1).text(), '€',
+ assert.strictEqual(form.$('input').parent().children().eq(1).text(), '€',
'The input should be followed by a span containing the currency symbol.');
- form.$('input.o_form_input').first().val('108.2458938598598').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').first().val(), '108.2458938598598',
+ form.$('input').first().val('108.2458938598598').trigger('input');
+ assert.strictEqual(form.$('input').first().val(), '108.2458938598598',
'The value should not be formated yet.');
form.$buttons.find('.o_form_button_save').click();
// Non-breaking space between the currency and the amount
- assert.strictEqual(form.$('.o_form_field').first().text(), '108.25\u00a0€',
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '108.25\u00a0€',
'The new value should be rounded properly.');
form.destroy();
@@ -1513,15 +1513,15 @@ QUnit.module('basic_fields', {
},
});
- var dollarValues = list.$('td').filter(function() {return _.str.include($(this).text(), '$')});
+ var dollarValues = list.$('td').filter(function () {return _.str.include($(this).text(), '$');});
assert.strictEqual(dollarValues.length, 1,
'Only one line has dollar as a currency.');
- var euroValues = list.$('td').filter(function() {return _.str.include($(this).text(), '€')});
+ var euroValues = list.$('td').filter(function () {return _.str.include($(this).text(), '€');});
assert.strictEqual(euroValues.length, 1,
'One one line has euro as a currency.');
- var zeroValues = list.$('td').filter(function() {return _.str.include($(this).text(), '0.00')});
+ var zeroValues = list.$('td').filter(function () {return _.str.include($(this).text(), '0.00');});
assert.strictEqual(zeroValues.length, 2,
'Unset float values should be rendered as zeros.');
@@ -1531,15 +1531,15 @@ QUnit.module('basic_fields', {
assert.strictEqual($cell.children().length, 1,
'The cell td should only contain the special div of monetary widget.');
- assert.strictEqual(list.$('input.o_form_input').length, 1,
+ assert.strictEqual(list.$('[name="qux"] input').length, 1,
'The view should have 1 input for editable monetary float.');
- assert.strictEqual(list.$('input.o_form_input').val(), '9.10',
+ assert.strictEqual(list.$('[name="qux"] input').val(), '9.10',
'The input should be rendered without the currency symbol.');
- assert.strictEqual(list.$('input.o_form_input').parent().children().first().text(), '$',
+ assert.strictEqual(list.$('[name="qux"] input').parent().children().first().text(), '$',
'The input should be preceded by a span containing the currency symbol.');
- list.$('input.o_form_input').val('108.2458938598598').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '108.2458938598598',
+ list.$('[name="qux"] input').val('108.2458938598598').trigger('input');
+ assert.strictEqual(list.$('[name="qux"] input').val(), '108.2458938598598',
'The typed value should be correctly displayed.');
list.$buttons.find('.o_list_button_save').click();
@@ -1577,22 +1577,22 @@ QUnit.module('basic_fields', {
},
});
- assert.strictEqual(form.$('.o_form_field_monetary').html(), "$&nbsp;9.10",
+ assert.strictEqual(form.$('.o_field_monetary').html(), "$&nbsp;9.10",
"readonly value should contain the currency");
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_monetary > input').val(), "9.10",
+ assert.strictEqual(form.$('.o_field_monetary > input').val(), "9.10",
"input value in edition should only contain the value, without the currency");
form.$('input[type="checkbox"]').click(); // Change the field on which the monetary depends
- assert.strictEqual(form.$('.o_form_field_monetary > input').length, 1,
+ assert.strictEqual(form.$('.o_field_monetary > input').length, 1,
"After the onchange, the monetary <input/> should not have been duplicated");
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:not(.o_m2o_dropdown_option):last').mouseenter().click();
- assert.strictEqual(form.$('.o_form_field_monetary > span').html(), "€",
+ assert.strictEqual(form.$('.o_field_monetary > span').html(), "€",
"After currency change, the monetary field currency should have been updated");
form.destroy();
@@ -1600,7 +1600,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldInteger');
- QUnit.test('integer field when unset', function(assert) {
+ QUnit.test('integer field when unset', function (assert) {
assert.expect(1);
var form = createView({
@@ -1611,13 +1611,13 @@ QUnit.module('basic_fields', {
res_id: 4,
});
- assert.ok(form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(form.$('.o_field_widget').hasClass('o_field_empty'),
'Non-set integer field should be recognized as unset.');
form.destroy();
});
- QUnit.test('integer field in form view', function(assert) {
+ QUnit.test('integer field in form view', function (assert) {
assert.expect(4);
var form = createView({
@@ -1628,25 +1628,25 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.ok(!form.$('.o_form_field').hasClass('o_form_field_empty'),
+ assert.ok(!form.$('.o_field_widget').hasClass('o_field_empty'),
'Integer field should be considered set for value 0.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '0',
- 'The value should be rendered correctly in edit mode.')
+ assert.strictEqual(form.$('input').val(), '0',
+ 'The value should be rendered correctly in edit mode.');
- form.$('input.o_form_input').val('-18').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '-18',
- 'The value should be correctly displayed in the input.')
+ form.$('input').val('-18').trigger('input');
+ assert.strictEqual(form.$('input').val(), '-18',
+ 'The value should be correctly displayed in the input.');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').text(), '-18',
- 'The new value should be saved and displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').text(), '-18',
+ 'The new value should be saved and displayed properly.');
form.destroy();
});
- QUnit.test('integer field in form view with virtual id', function(assert) {
+ QUnit.test('integer field in form view with virtual id', function (assert) {
assert.expect(2);
var params = {
View: FormView,
@@ -1657,7 +1657,7 @@ QUnit.module('basic_fields', {
params.res_id = this.data.partner.records[1].id = "2-20170808020000";
var form = createView(params);
- assert.strictEqual(form.$('.o_form_field').text(), "2-20170808020000",
+ assert.strictEqual(form.$('.o_field_widget').text(), "2-20170808020000",
"Should display virtual id");
form.destroy();
@@ -1683,7 +1683,7 @@ QUnit.module('basic_fields', {
'</tree>',
});
- var zeroValues = list.$('td').filter(function() {return $(this).text() === '0'});
+ var zeroValues = list.$('td').filter(function () {return $(this).text() === '0';});
assert.strictEqual(zeroValues.length, 1,
'Unset integer values should not be rendered as zeros.');
@@ -1691,16 +1691,16 @@ QUnit.module('basic_fields', {
var $cell = list.$('tr.o_data_row td:not(.o_list_record_selector)').first();
$cell.click();
- assert.strictEqual(list.$('input.o_form_input').length, 1,
- 'The view should have 1 input for editable integer.')
+ assert.strictEqual(list.$('input[name="int_field"]').length, 1,
+ 'The view should have 1 input for editable integer.');
- list.$('input.o_form_input').val('-28').trigger('input');
- assert.strictEqual(list.$('input.o_form_input').val(), '-28',
- 'The value should be displayed properly in the input.')
+ list.$('input[name="int_field"]').val('-28').trigger('input');
+ assert.strictEqual(list.$('input[name="int_field"]').val(), '-28',
+ 'The value should be displayed properly in the input.');
list.$buttons.find('.o_list_button_save').click();
assert.strictEqual(list.$('td:not(.o_list_record_selector)').first().text(), '-28',
- 'The new value should be saved and displayed properly.')
+ 'The new value should be saved and displayed properly.');
list.destroy();
});
@@ -1708,7 +1708,7 @@ QUnit.module('basic_fields', {
QUnit.module('FieldFloatTime');
- QUnit.test('float_time field in form view', function(assert) {
+ QUnit.test('float_time field in form view', function (assert) {
assert.expect(5);
var form = createView({
@@ -1731,20 +1731,20 @@ QUnit.module('basic_fields', {
});
// 9 + 0.1 * 60 = 9.06
- assert.strictEqual(form.$('.o_form_field').first().text(), '09:06',
- 'The formatted time value should be displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '09:06',
+ 'The formatted time value should be displayed properly.');
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_input').val(), '09:06',
- 'The value should be rendered correctly in the input.')
+ assert.strictEqual(form.$('input').val(), '09:06',
+ 'The value should be rendered correctly in the input.');
- form.$('input.o_form_input').val('-11:48').trigger('input');
- assert.strictEqual(form.$('input.o_form_input').val(), '-11:48',
- 'The new value should be displayed properly in the input.')
+ form.$('input').val('-11:48').trigger('input');
+ assert.strictEqual(form.$('input').val(), '-11:48',
+ 'The new value should be displayed properly in the input.');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field').first().text(), '-11:48',
- 'The new value should be saved and displayed properly.')
+ assert.strictEqual(form.$('.o_field_widget').first().text(), '-11:48',
+ 'The new value should be saved and displayed properly.');
form.destroy();
});
@@ -1775,7 +1775,7 @@ QUnit.module('basic_fields', {
},
});
- var $phoneLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ var $phoneLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($phoneLink.length, 1,
"should have a anchor with correct classes");
assert.strictEqual($phoneLink.text(), 'y\u00ADop',
@@ -1785,17 +1785,17 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the phone field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- $phoneLink = form.$('a.o_form_uri.o_form_field.o_text_overflow');
+ $phoneLink = form.$('a.o_form_uri.o_field_widget.o_text_overflow');
assert.strictEqual($phoneLink.text(), 'n\u00ADew',
"new value should be displayed properly as text with the skype obfuscation");
assert.strictEqual($phoneLink.attr('href'), 'tel:new',
@@ -1804,7 +1804,7 @@ QUnit.module('basic_fields', {
form.destroy();
});
- QUnit.test('phone field in editable list view on extra small screens', function(assert) {
+ QUnit.test('phone field in editable list view on extra small screens', function (assert) {
assert.expect(10);
var list = createView({
@@ -1885,7 +1885,7 @@ QUnit.module('basic_fields', {
},
});
- var $phone = form.$('span.o_form_field.o_text_overflow:not(.o_form_uri)');
+ var $phone = form.$('span.o_field_widget.o_text_overflow:not(.o_form_uri)');
assert.strictEqual($phone.length, 1,
"should have a simple span rather than a link");
assert.strictEqual($phone.text(), 'yop',
@@ -1893,23 +1893,23 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').length, 1,
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').length, 1,
"should have an input for the phone field");
- assert.strictEqual(form.$('input[type="text"].o_form_input.o_form_field').val(), 'yop',
+ assert.strictEqual(form.$('input[type="text"].o_field_widget').val(), 'yop',
"input should contain field value in edit mode");
// change value in edit mode
- form.$('input[type="text"].o_form_input.o_form_field').val('new').trigger('input');
+ form.$('input[type="text"].o_field_widget').val('new').trigger('input');
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('span.o_form_field.o_text_overflow:not(.o_form_uri)').text(), 'new',
+ assert.strictEqual(form.$('span.o_field_widget.o_text_overflow:not(.o_form_uri)').text(), 'new',
"new value should be displayed properly as text without skype obfuscation");
form.destroy();
});
- QUnit.test('phone field in editable list view on normal screens', function(assert) {
+ QUnit.test('phone field in editable list view on normal screens', function (assert) {
// The behavior of this widget is completely altered by crm_voip so this
// test is irrelevant and fails if crm_voip is installed. The enterprise
// module is responsible for testing its own behavior in its own tests.
@@ -1981,13 +1981,13 @@ QUnit.module('basic_fields', {
res_id: 2,
});
- assert.strictEqual(form.$('.o_form_field.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set, even though there is no value for this field");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 0,
"should have no full star since there is no value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 2,
"should have two empty stars since there is no value");
form.destroy();
@@ -2010,22 +2010,22 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should have one empty star since the value is the second value");
// hover last star
- form.$('.o_form_field.o_priority a.o_priority_star.fa-star-o').last().trigger('mouseover');
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ form.$('.o_field_widget.o_priority a.o_priority_star.fa-star-o').last().trigger('mouseover');
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should temporary have two full stars since we are hovering the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should temporary have no empty star since we are hovering the third value");
// Here we should test with mouseout, but currently the effect associated with it
@@ -2033,54 +2033,54 @@ QUnit.module('basic_fields', {
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// switch to edit mode to check that the new value was properly written
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 1,
"should still have one full star since the value is the second value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 1,
"should still have one empty star since the value is the second value");
// click on the second star in edit mode
- form.$('.o_form_field.o_priority a.o_priority_star.fa-star-o').last().click();
+ form.$('.o_field_widget.o_priority a.o_priority_star.fa-star-o').last().click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should now have two full stars since the value is the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should now have no empty star since the value is the third value");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star').length, 2,
"should still have two stars");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star').length, 2,
"should now have two full stars since the value is the third value");
- assert.strictEqual(form.$('.o_form_field.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_priority').find('a.o_priority_star.fa-star-o').length, 0,
"should now have no empty star since the value is the third value");
form.destroy();
});
- QUnit.test('priority widget in editable list view', function(assert) {
+ QUnit.test('priority widget in editable list view', function (assert) {
assert.expect(25);
var list = createView({
@@ -2090,7 +2090,7 @@ QUnit.module('basic_fields', {
arch: '<tree editable="bottom"><field name="selection" widget="priority"/></tree>',
});
- assert.strictEqual(list.$('.o_data_row').first().find('.o_priority:not(.o_form_field_empty)').length, 1,
+ assert.strictEqual(list.$('.o_data_row').first().find('.o_priority:not(.o_field_empty)').length, 1,
"widget should be considered set");
assert.strictEqual(list.$('.o_data_row').first().find('.o_priority a.o_priority_star').length, 2,
"should have two stars for representing each possible value: no star, one star and two stars");
@@ -2141,7 +2141,7 @@ QUnit.module('basic_fields', {
"should now have two empty stars since the value is the first value");
// re-enter edit mode to force re-rendering the widget to check if the value was correctly saved
- var $cell = list.$('tbody td:not(.o_list_record_selector)').first();
+ $cell = list.$('tbody td:not(.o_list_record_selector)').first();
$cell.click();
assert.strictEqual(list.$('.o_data_row').first().find('.o_priority a.o_priority_star').length, 2,
@@ -2193,15 +2193,15 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 1,
"should have one red status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should not have one green status since selection is the second, blocked state");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown");
// Click on the status button to make the dropdown appear
- form.$('.o_form_field.o_selection .o_status').first().click();
+ form.$('.o_field_widget.o_selection .o_status').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1,
"there should be a dropdown");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2,
@@ -2211,26 +2211,26 @@ QUnit.module('basic_fields', {
form.$('ul.dropdown-menu.state:visible li').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should not have one red status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should not have one green status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status').length, 1,
"should have one grey status since selection is the first, normal state");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should still not be a dropdown");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should still not have one red status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 0,
"should still not have one green status since selection is the first, normal state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status').length, 1,
"should still have one grey status since selection is the first, normal state");
// Click on the status button to make the dropdown appear
- form.$('.o_form_field.o_selection .o_status').first().click();
+ form.$('.o_field_widget.o_selection .o_status').first().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 1,
"there should be a dropdown");
assert.strictEqual(form.$('ul.dropdown-menu.state:visible li').length, 2,
@@ -2240,18 +2240,18 @@ QUnit.module('basic_fields', {
form.$('ul.dropdown-menu.state:visible li').last().click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should not have one red status since selection is the third, done state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 1,
"should have one green status since selection is the third, done state");
// save
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('ul.dropdown-menu.state:visible').length, 0,
"there should still not be a dropdown anymore");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_red').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_red').length, 0,
"should still not have one red status since selection is the third, done state");
- assert.strictEqual(form.$('.o_form_field.o_selection > a span.o_status.o_status_green').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_selection > a span.o_status.o_status_green').length, 1,
"should still have one green status since selection is the third, done state");
form.destroy();
@@ -2387,41 +2387,41 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
// // switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field.label.label-warning').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').length, 1,
"should have a warning status label since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-default').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-default').length, 0,
"should not have a default status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-success').length, 0,
+ assert.strictEqual(form.$('.o_field_widget.label.label-success').length, 0,
"should not have a success status since selection is the second, blocked state");
- assert.strictEqual(form.$('.o_form_field.label.label-warning').text(), 'Blocked',
+ assert.strictEqual(form.$('.o_field_widget.label.label-warning').text(), 'Blocked',
"the label should say 'Blocked' since this is the label value for that state");
form.destroy();
});
- QUnit.test('label_selection widget in editable list view', function(assert) {
+ QUnit.test('label_selection widget in editable list view', function (assert) {
assert.expect(21);
var list = createView({
@@ -2512,29 +2512,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'int_field', "should have 'int_field' as text");
form.destroy();
@@ -2564,29 +2564,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'yop', "should have 'yop' as text, since it is the value of field foo");
form.destroy();
@@ -2615,29 +2615,29 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should still have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should still have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info').length, 1,
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info').length, 1,
"should have one stat button");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_value').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_value').text(),
'10', "should have 10 as value");
- assert.strictEqual(form.$('.oe_stat_button .o_form_field.o_stat_info .o_stat_text').text(),
+ assert.strictEqual(form.$('.oe_stat_button .o_field_widget.o_stat_info .o_stat_text').text(),
'', "should not have any label");
form.destroy();
@@ -2663,35 +2663,35 @@ QUnit.module('basic_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'10%', "should have 10% as pie value since int_field=10");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(180deg);'), "left mask should be covering the whole left side of the pie");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().attr('style'),
'transform: rotate(36deg);'), "right mask should be rotated from 360*(10/100) = 36 degrees");
form.destroy();
@@ -2714,35 +2714,35 @@ QUnit.module('basic_fields', {
res_id: 3,
});
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie').length, 1,
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie').length, 1,
"should have a pie chart");
- assert.strictEqual(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_pie_value').text(),
+ assert.strictEqual(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_pie_value').text(),
'80%', "should have 80% as pie value since int_field=80");
- assert.ok(_.str.include(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').first().attr('style'),
+ assert.ok(_.str.include(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').first().attr('style'),
'transform: rotate(288deg);'), "left mask should be rotated from 360*(80/100) = 288 degrees");
- assert.ok(form.$('.o_form_field_percent_pie.o_form_field .o_pie .o_mask').last().hasClass('o_full'),
+ assert.ok(form.$('.o_field_percent_pie.o_field_widget .o_pie .o_mask').last().hasClass('o_full'),
"right mask should be hidden since the value > 50%");
form.destroy();
@@ -2767,31 +2767,31 @@ QUnit.module('basic_fields', {
// '</tree>',
// });
//
- // assert.strictEqual(list.$('.o_form_field_percent_pie .o_pie').length, 5,
+ // assert.strictEqual(list.$('.o_field_percent_pie .o_pie').length, 5,
// "should have five pie charts");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole left side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // switch to edit mode and check the result
// list.$('tbody td:not(.o_list_record_selector)').first().click();
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole right side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// // save
// list.$buttons.find('.o_list_button_save').click();
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_pie_value').first().text(),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_pie_value').first().text(),
// '10%', "should have 10% as pie value since int_field=10");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').first().attr('style'),
// 'transform: rotate(180deg);', "left mask should be covering the whole right side of the pie");
- // assert.strictEqual(list.$('.o_form_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
+ // assert.strictEqual(list.$('.o_field_percent_pie:first .o_pie .o_mask').last().attr('style'),
// 'transform: rotate(36deg);', "right mask should be rotated from 360*(10/100) = 36 degrees");
//
// list.destroy();
@@ -2823,7 +2823,7 @@ QUnit.module('basic_fields', {
// As the domain is empty, there should be a button to add the first
// domain part
- var $domain = form.$(".o_form_field_domain");
+ var $domain = form.$(".o_field_domain");
var $domainAddFirstNodeButton = $domain.find(".o_domain_add_first_node_button");
assert.equal($domainAddFirstNodeButton.length, 1,
"there should be a button to create first domain element");
@@ -2865,7 +2865,7 @@ QUnit.module('basic_fields', {
// Saving the form view should show a readonly domain containing the
// "color" field
form.$buttons.find('.o_form_button_save').click();
- $domain = form.$(".o_form_field_domain");
+ $domain = form.$(".o_field_domain");
assert.ok($domain.html().indexOf("Color index") >= 0,
"field selector readonly value should now contain 'Color index'");
form.destroy();
@@ -2897,7 +2897,7 @@ QUnit.module('basic_fields', {
// As the domain is equal to [["id", "=", 1]] there should be a field
// selector to change this
- var $domain = form.$(".o_form_field_domain");
+ var $domain = form.$(".o_field_domain");
var $fieldSelector = $domain.find(".o_field_selector");
assert.equal($fieldSelector.length, 1,
"there should be a field selector");
@@ -2924,7 +2924,7 @@ QUnit.module('basic_fields', {
"field selector popover should contain 'Product Name' field");
// Now change the value of the "bar" field to "partner_type"
- form.$(".o_field_widget.o_form_input").click().val("partner_type").trigger("input");
+ form.$("input.o_field_widget").click().val("partner_type").trigger("input");
// Refocusing the field selector input should open the popover again
$fieldSelector = form.$(".o_field_selector");
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index d6ea4a946be..db81e19731c 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -259,9 +259,9 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
assert.ok($dropdown.is(':visible'),
'clicking on the m2o input should open the dropdown if it is not open yet');
assert.strictEqual($dropdown.find('li:not(.o_m2o_dropdown_option)').length, 7,
@@ -269,19 +269,19 @@ QUnit.module('relational_fields', {
assert.strictEqual($dropdown.find('li.o_m2o_dropdown_option').length, 2,
'autocomplete should contain "Search More" and Create and Edit..."');
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
assert.ok(!$dropdown.is(':visible'),
'clicking on the m2o input should close the dropdown if it is open');
// change the value of the m2o with a suggestion of the dropdown
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:first()').click();
assert.ok(!$dropdown.is(':visible'), 'clicking on a value should close the dropdown');
- assert.strictEqual(form.$('.o_form_field_many2one input').val(), 'first record',
+ assert.strictEqual(form.$('.o_field_many2one input').val(), 'first record',
'value of the m2o should have been correctly updated');
// change the value of the m2o with a record in the 'Search More' modal
- form.$('.o_form_field_many2one input').click();
+ form.$('.o_field_many2one input').click();
// click on 'Search More' (mouseenter required by ui-autocomplete)
$dropdown.find('.o_m2o_dropdown_option:contains(Search)').mouseenter().click();
assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
@@ -299,7 +299,7 @@ QUnit.module('relational_fields', {
$('.modal tbody tr:contains(Partner 20)').click(); // choose record 'Partner 20'
assert.ok(!$('.modal').length, "should have closed the modal");
assert.ok(!$dropdown.is(':visible'), 'should have closed the dropdown');
- assert.strictEqual(form.$('.o_form_field_many2one input').val(), 'Partner 20',
+ assert.strictEqual(form.$('.o_field_many2one input').val(), 'Partner 20',
'value of the m2o should have been correctly updated');
// save
@@ -479,8 +479,8 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('a').text(), '', 'the tag a should be empty');
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_many2one input').click();
- form.$('.o_form_field_many2one input').autocomplete('widget').find('a').first().click();
+ form.$('.o_field_many2one input').click();
+ form.$('.o_field_many2one input').autocomplete('widget').find('a').first().click();
assert.strictEqual(form.$('input').val(), "xphone", "should have selected xphone");
@@ -549,8 +549,8 @@ QUnit.module('relational_fields', {
},
});
- form.$('.o_form_field_many2one input').focus();
- form.$('.o_form_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
+ form.$('.o_field_many2one input').focus();
+ form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
$('.modal .modal-footer .btn-primary').first().click();
@@ -571,8 +571,8 @@ QUnit.module('relational_fields', {
'</form>',
});
- form.$('.o_form_field_many2one input').focus();
- form.$('.o_form_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
+ form.$('.o_field_many2one input').focus();
+ form.$('.o_field_many2one input').val('new partner').trigger('keyup').trigger('focusout');
assert.strictEqual($('.modal').length, 0, "should not display the create modal");
form.destroy();
@@ -607,17 +607,17 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('td.o_list_record_selector').length, 0,
"embedded one2many should not have a selector");
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
"embedded one2many should not be editable");
assert.ok(!form.$('td.o_list_record_delete').length,
"embedded one2many records should not have a trash icon");
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
"embedded one2many should now be editable");
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').attr('colspan'), "2",
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').attr('colspan'), "2",
"should have colspan 2 (one for field foo, one for being below trash icon)");
assert.ok(form.$('td.o_list_record_delete').length,
@@ -934,12 +934,12 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.destroy();
});
@@ -1027,7 +1027,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_kanban_view .delete_icon').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_one2many .o-kanban-button-new').length,
+ assert.ok(!form.$('.o_field_one2many .o-kanban-button-new').length,
'"Create" button should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -1040,20 +1040,20 @@ QUnit.module('relational_fields', {
'color of subrecord should be the one in DB');
assert.ok(form.$('.o_kanban_view .delete_icon').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_one2many .o-kanban-button-new').length,
+ assert.ok(form.$('.o_field_one2many .o-kanban-button-new').length,
'"Create" button should be visible in edit');
// edit existing subrecord
form.$('.oe_kanban_global_click').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record span:first').text(), 'new name',
'value of subrecord should have been updated');
// create a new subrecord
form.$('.o-kanban-button-new').click();
- $('.modal .o_form_view .o_form_input').val('new subrecord 1').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 1').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 2,
'should contain 2 records');
@@ -1062,9 +1062,9 @@ QUnit.module('relational_fields', {
// create two new subrecords
form.$('.o-kanban-button-new').click();
- $('.modal .o_form_view .o_form_input').val('new subrecord 2').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 2').trigger('input');
$('.modal .modal-footer .btn-primary:nth(1)').click(); // save and new
- $('.modal .o_form_view .o_form_input').val('new subrecord 3').trigger('input');
+ $('.modal .o_form_view input').val('new subrecord 3').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save and close
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 4,
'should contain 4 records');
@@ -1153,7 +1153,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -1164,13 +1164,13 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not visible in edit');
// edit existing subrecord
form.$('.o_list_view tbody tr:first() td:eq(1)').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
@@ -1213,7 +1213,7 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$('.o_list_view tbody td:first()').click();
@@ -1223,7 +1223,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should be available in edit');
// edit existing subrecord
@@ -1232,7 +1232,7 @@ QUnit.module('relational_fields', {
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
- form.$('.o_list_view .o_form_input:first()').val('new name').trigger('input');
+ form.$('.o_list_view input:first()').val('new name').trigger('input');
form.$('.o_list_view tbody tr:nth(1) td:first').click(); // click on second record to validate the first one
assert.ok(!form.$('.o_list_view tbody tr:first').hasClass('o_selected_row'),
@@ -1273,11 +1273,11 @@ QUnit.module('relational_fields', {
// edit mode, then click on Add an item and enter a value
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$('.o_selected_row > td input').val('kartoffel').trigger('input');
// click again on Add an item
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('td:contains(kartoffel)').length, 1,
"should have one td with the new value");
assert.strictEqual(form.$('.o_selected_row > td input').length, 1,
@@ -1319,8 +1319,8 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('tr.o_data_row').length, 3,
"should have 3 data rows");
@@ -1365,14 +1365,14 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('textarea').val(), "",
"field turtle_description should be empty");
// add a value in the turtle_trululu field to trigger an onchange
- var $dropdown = form.$('.o_form_field_many2one[name=turtle_trululu] input')
+ var $dropdown = form.$('.o_field_many2one[name=turtle_trululu] input')
.autocomplete('widget');
- form.$('.o_form_field_many2one[name=turtle_trululu] input').click();
+ form.$('.o_field_many2one[name=turtle_trululu] input').click();
$dropdown.find('a:contains(first record)').mouseenter().click();
assert.strictEqual(form.$('textarea').val(), "Some Description",
"field turtle_description should be set to the result of the onchange");
@@ -1411,13 +1411,13 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$('label.o_form_label').first().click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should still have 0 data rows");
// click on Add an item again, then click on save
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should still have 0 data rows");
@@ -1453,7 +1453,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('tr.o_data_row').length, 1,
"should have 1 data rows");
@@ -1518,7 +1518,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should have 0 data rows");
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
// input some text in required turtle_foo field
form.$('input[name="turtle_foo"]').val('aubergine').trigger('input');
@@ -1718,10 +1718,10 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_list_view tbody tr:eq(0) td:first').hasClass('o_readonly'),
+ assert.ok(form.$('.o_list_view tbody tr:eq(0) td:first').hasClass('o_readonly_modifier'),
"first record should have display_name in readonly mode");
- assert.notOk(form.$('.o_list_view tbody tr:eq(1) td:first').hasClass('o_readonly'),
+ assert.notOk(form.$('.o_list_view tbody tr:eq(1) td:first').hasClass('o_readonly_modifier'),
"second record should not have display_name in readonly mode");
form.destroy();
});
@@ -1752,8 +1752,8 @@ QUnit.module('relational_fields', {
'o2m pager should be hidden');
// click to create a subrecord
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
- $('.modal .o_form_input').val('new record').trigger('input');
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
+ $('.modal input').val('new record').trigger('input');
$('.modal .modal-footer button:eq(0)').click(); // save and close
assert.ok(!form.$('.o_x2m_control_panel .o_cp_pager div').is(':visible'),
@@ -1807,11 +1807,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
- $('.modal .o_form_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
- var $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
@@ -1865,11 +1865,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
// write in the many2one field, value = 37 (xphone)
- $('.modal .o_form_field_many2one input').click();
- var $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ var $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(0) a').mouseenter();
$dropdown.find('li:eq(0) a').click();
@@ -1900,8 +1900,8 @@ QUnit.module('relational_fields', {
"should display 123 (previous change has been discarded)");
// write in the many2one field, value = 41 (xpad)
- $('.modal .o_form_field_many2one input').click();
- $dropdown = $('.modal .o_form_field_many2one input').autocomplete('widget');
+ $('.modal .o_field_many2one input').click();
+ $dropdown = $('.modal .o_field_many2one input').autocomplete('widget');
$dropdown.find('li:eq(1) a').mouseenter();
$dropdown.find('li:eq(1) a').click();
@@ -1956,7 +1956,7 @@ QUnit.module('relational_fields', {
form.$('tr.o_data_row:eq(0) td:contains(xphone)').click();
// write in the many2one field
- $('.modal .o_form_field_many2one input').click();
+ $('.modal .o_field_many2one input').click();
form.destroy();
});
@@ -1994,7 +1994,7 @@ QUnit.module('relational_fields', {
form.$('tr.o_data_row:eq(0) td:contains(xphone)').click();
// trigger a name search
- form.$('table td input.o_form_input').click();
+ form.$('table td input').click();
form.destroy();
});
@@ -2030,7 +2030,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2055,17 +2055,17 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('td input.o_field_widget.o_form_input').length, 1,
+ assert.strictEqual(form.$('td input.o_field_widget').length, 1,
"should have created a row in edit mode");
- form.$('td input.o_field_widget.o_form_input').val('a').trigger('input');
+ form.$('td input.o_field_widget').val('a').trigger('input');
- assert.strictEqual(form.$('td input.o_field_widget.o_form_input').length, 1,
+ assert.strictEqual(form.$('td input.o_field_widget').length, 1,
"should not have unselected the row after edition");
- form.$('td input.o_field_widget.o_form_input').val('abc').trigger('input');
+ form.$('td input.o_field_widget').val('abc').trigger('input');
form.$buttons.find('.o_form_button_save').click();
assert.strictEqual(form.$('td:contains(abc)').length, 1,
@@ -2100,7 +2100,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2148,7 +2148,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual($('.modal .o_data_row').length, 2,
"sould have 2 records in the select view (the last one is not displayed because it is already selected)");
@@ -2157,14 +2157,14 @@ QUnit.module('relational_fields', {
$('.modal .o_select_button').click();
$('.o_form_button_save').click();
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual($('.modal .o_data_row').length, 1,
"sould have 1 record in the select view");
$('.modal-footer button:eq(1)').click();
- $('.modal input.o_form_field[name="turtle_foo"]').val('tototo').trigger('input');
- $('.modal input.o_form_field[name="turtle_int"]').val(50).trigger('input');
+ $('.modal input.o_field_widget[name="turtle_foo"]').val('tototo').trigger('input');
+ $('.modal input.o_field_widget[name="turtle_int"]').val(50).trigger('input');
var $many2one = $('.modal [name="product_id"] input').click();
var $dropdown = $many2one.autocomplete('widget');
$dropdown.find('li:first a').mouseenter();
@@ -2245,7 +2245,7 @@ QUnit.module('relational_fields', {
// add a one2many record
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first .o_list_record_selector input').click();
$('.modal .o_select_button').click();
@@ -2294,7 +2294,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2326,7 +2326,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2357,7 +2357,7 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -2384,11 +2384,11 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('tbody td.o_form_field_x2many_list_row_add a').click();
+ form.$('tbody td.o_field_x2many_list_row_add a').click();
$('.modal-footer button.btn-primary').first().click();
assert.strictEqual($('.modal').length, 1, "should still have an open modal");
- assert.strictEqual($('.modal tbody label.o_form_invalid').length, 1,
+ assert.strictEqual($('.modal tbody label.o_field_invalid').length, 1,
"should have displayed invalid fields");
form.destroy();
});
@@ -2539,7 +2539,7 @@ QUnit.module('relational_fields', {
}
});
- assert.strictEqual(form.$('.o_form_field[name="turtles"] .o_list_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget[name="turtles"] .o_list_view').length, 1,
'should display one2many list view in the modal');
assert.strictEqual(form.$('.o_data_row').length, 2,
@@ -2603,7 +2603,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field').text(), "xphone",
+ assert.strictEqual($('.modal .o_field_widget').text(), "xphone",
'should display the form view dialog with the many2one value');
$('.modal-footer button').click(); // close the modal
@@ -2612,21 +2612,21 @@ QUnit.module('relational_fields', {
// edit the m2m of first row
form.$('.o_list_view tbody td:first()').click();
// remove a tag
- form.$('.o_form_field_many2manytags .badge:contains(aaa) .o_delete').click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2manytags .o_badge_text:contains(aaa)').length, 0,
+ form.$('.o_field_many2manytags .badge:contains(aaa) .o_delete').click();
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2manytags .o_badge_text:contains(aaa)').length, 0,
"tag should have been correctly removed");
// add a tag
- var $m2mInput = form.$('.o_selected_row .o_form_field_many2manytags input');
+ var $m2mInput = form.$('.o_selected_row .o_field_many2manytags input');
$m2mInput.click();
$m2mInput.autocomplete('widget').find('li:first()').click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2manytags .o_badge_text:contains(first record)').length, 1,
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2manytags .o_badge_text:contains(first record)').length, 1,
"tag should have been correctly added");
// edit the m2o of first row
- var $m2oInput = form.$('.o_selected_row .o_form_field_many2one:first input');
+ var $m2oInput = form.$('.o_selected_row .o_field_many2one:first input');
$m2oInput.click();
$m2oInput.autocomplete('widget').find('li:contains(xpad)').mouseover().click();
- assert.strictEqual(form.$('.o_selected_row .o_form_field_many2one:first input').val(), 'xpad',
+ assert.strictEqual(form.$('.o_selected_row .o_field_many2one:first input').val(), 'xpad',
"m2o value should have been updated");
// save (should correctly generate the commands)
@@ -2673,7 +2673,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="partner_ids"] .o_list_view').length, 1,
+ assert.strictEqual($('.modal .o_field_widget[name="partner_ids"] .o_list_view').length, 1,
'should display many2many list view in the modal');
form.destroy();
@@ -2705,7 +2705,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -2737,7 +2737,7 @@ QUnit.module('relational_fields', {
form.$('.o_data_row:first').click();
- assert.strictEqual($('.modal .o_form_field[name="turtle_foo"]').text(), 'blip',
+ assert.strictEqual($('.modal .o_field_widget[name="turtle_foo"]').text(), 'blip',
'should open the modal and display the form field');
form.destroy();
@@ -2784,38 +2784,38 @@ QUnit.module('relational_fields', {
res_id: 4,
});
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 0,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 0,
"should not have kanban records yet");
// // switch to edit mode and create a new kanban record
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field .o-kanban-button-new').click();
+ form.$('.o_field_widget .o-kanban-button-new').click();
// save & close the modal
- assert.strictEqual($('.modal-content input.o_form_field').val(), 'My little Foo Value',
+ assert.strictEqual($('.modal-content input.o_field_widget').val(), 'My little Foo Value',
"should already have the default value for field foo");
$('.modal-content .btn-primary').first().click();
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
"should now have one kanban record");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
'', "should not have a value for the id field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
'My little Foo Value', "should have a value for the foo field");
// save the view to force a create of the new record in the one2many
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view').length, 1,
"should have one inner kanban view for the one2many field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost)').length, 1,
"should now have one kanban record");
- assert.notEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
+ assert.notEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_id').text(),
'', "should now have a value for the id field");
- assert.strictEqual(form.$('.o_form_field .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
+ assert.strictEqual(form.$('.o_field_widget .o_kanban_view .o_kanban_record:not(.o_kanban_ghost) .o_test_foo').text(),
'My little Foo Value', "should still have a value for the foo field");
form.destroy();
@@ -2844,11 +2844,11 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
form.$('.o_data_row:first td:first').click();
- assert.strictEqual(form.$('.o_form_input[name="turtle_foo"]')[0], document.activeElement,
+ assert.strictEqual(form.$('input[name="turtle_foo"]')[0], document.activeElement,
"turtle foo field should have focus");
- form.$('.o_form_input[name="turtle_foo"]').trigger({type: 'keydown', which: $.ui.keyCode.TAB});
- assert.strictEqual(form.$('.o_form_input[name="turtle_int"]')[0], document.activeElement,
+ form.$('input[name="turtle_foo"]').trigger({type: 'keydown', which: $.ui.keyCode.TAB});
+ assert.strictEqual(form.$('input[name="turtle_int"]')[0], document.activeElement,
"turtle int field should have focus");
form.destroy();
});
@@ -2887,7 +2887,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row').length, 1,
"should start with one data row");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('.o_data_row').length, 2,
"should have 2 data rows");
@@ -2934,7 +2934,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row').length, 1,
"should start with one data row");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('.o_data_row').length, 2,
"should have 2 data rows");
@@ -2975,7 +2975,7 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_one2many .o_kanban_view').length, 1,
+ assert.strictEqual(form.$('.o_field_one2many .o_kanban_view').length, 1,
"should have rendered a kanban view");
form.destroy();
@@ -3014,16 +3014,16 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should start with value 0");
- form.$('.o_form_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ form.$('.o_field_x2many_list_row_add a').click();
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should still be 0 (no onchange should have been done yet");
assert.verifySteps(['read', 'default_get'], "no onchange should have been applied");
form.$('.o_field_widget[name="turtle_foo"]').val("some text").trigger('input');
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "1",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "1",
"int_field should now be 1 (the onchange should have been done");
form.destroy();
@@ -3066,16 +3066,16 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should start with value 0");
- form.$('.o_form_field_x2many_list_row_add a').click();
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "0",
+ form.$('.o_field_x2many_list_row_add a').click();
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "0",
"int_field should still be 0 (no onchange should have been done yet");
assert.verifySteps(['read', 'default_get'], "no onchange should have been applied");
form.$('.o_field_widget[name="turtle_foo"]').val("some text").trigger('input');
- assert.strictEqual(form.$('.o_form_field[name="int_field"]').val(), "1",
+ assert.strictEqual(form.$('.o_field_widget[name="int_field"]').val(), "1",
"int_field should now be 1 (the onchange should have been done");
form.destroy();
@@ -3152,7 +3152,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_kanban_view .delete_icon').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_many2many .o-kanban-button-new').length,
+ assert.ok(!form.$('.o_field_many2many .o-kanban-button-new').length,
'"Add" button should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3163,20 +3163,20 @@ QUnit.module('relational_fields', {
'display_name of subrecord should be the one in DB');
assert.ok(form.$('.o_kanban_view .delete_icon').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_many2many .o-kanban-button-new').length,
+ assert.ok(form.$('.o_field_many2many .o-kanban-button-new').length,
'"Add" button should be visible in edit');
// edit existing subrecord
form.$('.oe_kanban_global_click:first()').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_kanban_record:first() span').text(), 'new name',
'value of subrecord should have been updated');
// add subrecords
// -> single select
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
assert.ok($('.modal .o_list_view').length, "should have opened a list view in a modal");
assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 3,
"list view should contain 3 records");
@@ -3188,7 +3188,7 @@ QUnit.module('relational_fields', {
'record "red" should be in the kanban');
// -> multiple select
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
assert.ok($('.modal .o_select_button').prop('disabled'), "select button should be disabled");
assert.strictEqual($('.modal .o_list_view tbody .o_list_record_selector').length, 2,
"list view should contain 2 records");
@@ -3199,7 +3199,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 5,
'kanban should now contain 5 records');
// -> created record
- form.$('.o_form_field_many2many .o-kanban-button-new').click();
+ form.$('.o_field_many2many .o-kanban-button-new').click();
$('.modal .modal-footer .btn-primary:nth(1)').click(); // click on 'Create'
assert.ok($('.modal .o_form_view.o_form_editable').length,
"should have opened a form view in edit mode, in a modal");
@@ -3297,7 +3297,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3308,13 +3308,13 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should be visible in edit');
// edit existing subrecord
form.$('.o_list_view tbody tr:first()').click();
- $('.modal .o_form_view .o_form_input').val('new name').trigger('input');
+ $('.modal .o_form_view input').val('new name').trigger('input');
$('.modal .modal-footer .btn-primary').click(); // save
assert.strictEqual(form.$('.o_list_view tbody td:first()').text(), 'new name',
'value of subrecord should have been updated');
@@ -3355,7 +3355,7 @@ QUnit.module('relational_fields', {
assert.ok(!form.$('.o_list_record_delete').length,
'delete icon should not be visible in readonly');
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not be visible in readonly');
form.$buttons.find('.o_form_button_edit').click();
@@ -3366,7 +3366,7 @@ QUnit.module('relational_fields', {
'display_name of first subrecord should be the one in DB');
assert.ok(form.$('.o_list_record_delete').length,
'delete icon should be visible in edit');
- assert.ok(form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(form.$('.o_field_x2many_list_row_add').length,
'"Add an item" should not visible in edit');
// edit existing subrecord
@@ -3375,7 +3375,7 @@ QUnit.module('relational_fields', {
'in edit, clicking on a subrecord should not open a dialog');
assert.ok(form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
'first row should be in edition');
- form.$('.o_list_view .o_form_input:first()').val('new name').trigger('input');
+ form.$('.o_list_view input:first()').val('new name').trigger('input');
// FIXME: this doesn"t work for now as the x2many fields are reset on field changed
// form.$('.o_list_view tbody td:nth(1)').click(); // click on second record to validate the first one
// assert.ok(!form.$('.o_list_view tbody tr:first()').hasClass('o_selected_row'),
@@ -3416,7 +3416,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').length, 1, "should have the 'Add an item' link");
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').length, 1, "should have the 'Add an item' link");
assert.strictEqual(form.$('.o_list_record_delete').length, 2, "should have the 'Add an item' link");
form.destroy();
@@ -3437,7 +3437,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_x2many_list_row_add').length, 0, "should not have the 'Add an item' link");
+ assert.strictEqual(form.$('.o_field_x2many_list_row_add').length, 0, "should not have the 'Add an item' link");
assert.strictEqual(form.$('.o_list_record_delete').length, 0, "should not have the 'Add an item' link");
form.destroy();
@@ -3459,12 +3459,12 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in readonly');
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(!form.$('.o_form_field_x2many_list_row_add').length,
+ assert.ok(!form.$('.o_field_x2many_list_row_add').length,
'"Add an item" link should not be available in edit either');
form.destroy();
@@ -3508,7 +3508,7 @@ QUnit.module('relational_fields', {
},
});
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first').click(); // add a first record to the relation
assert.strictEqual(form.$('.o_data_row').length, 1,
@@ -3516,7 +3516,7 @@ QUnit.module('relational_fields', {
assert.strictEqual(form.$('.o_data_row:first .o_badge_text').text(), 'leonardodonatello',
"inner m2m should have been fetched and correctly displayed");
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
$('.modal .o_data_row:first').click(); // add a second record to the relation
assert.strictEqual(form.$('.o_data_row').length, 2,
@@ -3658,8 +3658,8 @@ QUnit.module('relational_fields', {
},
});
- assert.ok(form.$('.o_statusbar_status').hasClass('o_form_field_empty'),
- 'statusbar widget should have class o_form_field_empty');
+ assert.ok(form.$('.o_statusbar_status').hasClass('o_field_empty'),
+ 'statusbar widget should have class o_field_empty');
assert.strictEqual(form.$('.o_statusbar_status').children().length, 0,
'statusbar widget should be empty');
form.destroy();
@@ -3896,7 +3896,7 @@ QUnit.module('relational_fields', {
return this._super.apply(this, arguments);
},
});
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
assert.ok(form.$('span:contains(gold)').length,
'should have fetched and rendered gold partner tag');
@@ -3907,33 +3907,33 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should still contain 2 tags in edit mode");
assert.ok(form.$('.o_tag_color_2 .o_badge_text:contains(gold)').length,
'first tag should still contain "gold" and be color 2 in edit mode');
- assert.strictEqual(form.$('.o_form_field_many2manytags .o_delete').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags .o_delete').length, 2,
"tags should contain a delete button");
// add an other existing tag
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 1,
"autocomplete dropdown should have 1 entry");
assert.strictEqual($input.autocomplete('widget').find('li a:contains("red")').length, 1,
"autocomplete dropdown should contain 'red'");
$input.autocomplete('widget').find('li').click(); // add 'red'
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 3,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 3,
"should contain 3 tags");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("red")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("red")').length,
"should contain newly added tag 'red'");
- assert.ok(form.$('.o_form_field_many2manytags > span[data-color=8]:contains("red")').length,
+ assert.ok(form.$('.o_field_many2manytags > span[data-color=8]:contains("red")').length,
"should have fetched the color of added tag");
// remove tag with id 14
- form.$('.o_form_field_many2manytags span[data-id=14] .o_delete').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ form.$('.o_field_many2manytags span[data-id=14] .o_delete').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
- assert.ok(!form.$('.o_form_field_many2manytags > span:contains("silver")').length,
+ assert.ok(!form.$('.o_field_many2manytags > span:contains("silver")').length,
"should not contain tag 'silver' anymore");
// save the record (should do the write RPC with the correct commands)
@@ -3969,7 +3969,7 @@ QUnit.module('relational_fields', {
return this._super.apply(this, arguments);
}
});
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain 1 tag");
assert.ok(form.$('span:contains(gold)').length,
'should have fetched and rendered gold partner tag');
@@ -3977,16 +3977,16 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_edit').click();
// add an other existing tag
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 1,
"autocomplete dropdown should have 1 entry");
assert.strictEqual($input.autocomplete('widget').find('li a:contains("silver")').length, 1,
"autocomplete dropdown should contain 'silver'");
$input.autocomplete('widget').find('li').click(); // add 'silver'
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 2,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 2,
"should contain 2 tags");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("silver")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("silver")').length,
"should contain newly added tag 'silver'");
form.destroy();
@@ -4014,14 +4014,14 @@ QUnit.module('relational_fields', {
});
assert.ok(form.$('.o_form_view').hasClass('o_form_editable'), "form should be in edit mode");
- var $input = form.$('.o_form_field_many2manytags input');
+ var $input = form.$('.o_field_many2manytags input');
$input.click(); // opens the dropdown
assert.strictEqual($input.autocomplete('widget').find('li').length, 3,
"autocomplete dropdown should have 3 entries (2 values + 'Search and Edit...')");
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain 1 tag");
- assert.ok(form.$('.o_form_field_many2manytags > span:contains("gold")').length,
+ assert.ok(form.$('.o_field_many2manytags > span:contains("gold")').length,
"should contain newly added tag 'gold'");
// save the record (should do the write RPC with the correct commands)
@@ -4059,7 +4059,7 @@ QUnit.module('relational_fields', {
});
QUnit.test('fieldmany2many tags in editable list', function (assert) {
- assert.expect(5);
+ assert.expect(4);
this.data.partner.records[0].timmy = [12];
@@ -4073,13 +4073,13 @@ QUnit.module('relational_fields', {
'</tree>',
});
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 1,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 1,
"m2m field should contain one tag");
// edit first row
list.$('.o_data_row:first td:nth(2)').click();
- var $m2o = list.$('.o_data_row:first .o_form_field_many2manytags .o_form_field_many2one');
+ var $m2o = list.$('.o_data_row:first .o_field_many2manytags .o_field_many2one');
assert.strictEqual($m2o.length, 1, "a many2one widget should have been instantiated");
// add a tag
@@ -4087,15 +4087,13 @@ QUnit.module('relational_fields', {
$input.click();
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 2,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 2,
"m2m field should contain 2 tags");
- assert.ok(list.$('.o_data_row:first .o_many2many_tags_cell').hasClass('o_field_dirty'),
- "edited cell should have class o_field_dirty");
// leave edition
list.$('.o_data_row:nth(1) td:nth(2)').click();
- assert.strictEqual(list.$('.o_data_row:first .o_form_field_many2manytags .badge').length, 2,
+ assert.strictEqual(list.$('.o_data_row:first .o_field_many2manytags .badge').length, 2,
"m2m field should contain 2 tags");
list.destroy();
@@ -4121,31 +4119,31 @@ QUnit.module('relational_fields', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain one tag");
// update foo, which will trigger an onchange and update timmy
// -> m2mtags input should not have taken the focus
- form.$('.o_form_input:first').focus();
- form.$('.o_form_input:first').val('trigger onchange').trigger('input');
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 0,
+ form.$('input:first').focus();
+ form.$('input:first').val('trigger onchange').trigger('input');
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 0,
"should contain no tags");
- assert.strictEqual(form.$('.o_form_input:first').get(0), document.activeElement,
+ assert.strictEqual(form.$('input:first').get(0), document.activeElement,
"foo input should have kept the focus");
// add a tag -> m2mtags input should still have the focus
- form.$('.o_form_field_many2manytags input').click(); // opens the dropdown
- form.$('.o_form_field_many2manytags input').autocomplete('widget').find('li:first').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 1,
+ form.$('.o_field_many2manytags input').click(); // opens the dropdown
+ form.$('.o_field_many2manytags input').autocomplete('widget').find('li:first').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
"should contain a tag");
- assert.strictEqual(form.$('.o_form_field_many2manytags input').get(0), document.activeElement,
+ assert.strictEqual(form.$('.o_field_many2manytags input').get(0), document.activeElement,
"m2m tags input should have kept the focus");
// remove a tag -> m2mtags input should still have the focus
- form.$('.o_form_field_many2manytags .o_delete').click();
- assert.strictEqual(form.$('.o_form_field_many2manytags > span').length, 0,
+ form.$('.o_field_many2manytags .o_delete').click();
+ assert.strictEqual(form.$('.o_field_many2manytags > span').length, 0,
"should contain no tags");
- assert.strictEqual(form.$('.o_form_field_many2manytags input').get(0), document.activeElement,
+ assert.strictEqual(form.$('.o_field_many2manytags input').get(0), document.activeElement,
"m2m tags input should have kept the focus");
form.destroy();
@@ -4166,11 +4164,11 @@ QUnit.module('relational_fields', {
});
assert.ok(form.$('div.o_radio_item').length, "should have rendered outer div");
- assert.strictEqual(form.$('input.o_form_radio').length, 2, "should have 2 possible choices");
+ assert.strictEqual(form.$('input.o_radio_input').length, 2, "should have 2 possible choices");
assert.ok(form.$('label.o_form_label:contains(xphone)').length, "one of them should be xphone");
assert.strictEqual(form.$('input:checked').length, 0, "none of the input should be checked");
- form.$("input.o_form_radio:first").click();
+ form.$("input.o_radio_input:first").click();
assert.strictEqual(form.$('input:checked').length, 1, "one of the input should be checked");
@@ -4201,11 +4199,11 @@ QUnit.module('relational_fields', {
});
form.$("input[type='checkbox']").click();
- assert.strictEqual(form.$('input.o_form_radio[data-value="37"]:checked').length, 1, "one of the input should be checked");
- assert.strictEqual(form.$('input.o_form_radio[data-value="black"]:checked').length, 1, "the other of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="37"]:checked').length, 1, "one of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="black"]:checked').length, 1, "the other of the input should be checked");
form.$("input[type='checkbox']").click();
- assert.strictEqual(form.$('input.o_form_radio[data-value="41"]:checked').length, 1, "the other of the input should be checked");
- assert.strictEqual(form.$('input.o_form_radio[data-value="red"]:checked').length, 1, "one of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="41"]:checked').length, 1, "the other of the input should be checked");
+ assert.strictEqual(form.$('input.o_radio_input[data-value="red"]:checked').length, 1, "one of the input should be checked");
form.destroy();
});
@@ -4225,11 +4223,11 @@ QUnit.module('relational_fields', {
assert.ok(form.$('div.o_radio_item').length, "should have rendered outer div");
- assert.strictEqual(form.$('input.o_form_radio').length, 2, "should have 2 possible choices");
+ assert.strictEqual(form.$('input.o_radio_input').length, 2, "should have 2 possible choices");
assert.ok(form.$('label.o_form_label:contains(Red)').length, "one of them should be Red");
// click on 2nd option
- form.$("input.o_form_radio").eq(1).click();
+ form.$("input.o_radio_input").eq(1).click();
form.$buttons.find('.o_form_button_save').click();
@@ -4254,24 +4252,24 @@ QUnit.module('relational_fields', {
res_id: 1,
});
- assert.strictEqual(form.$('div.o_form_field div.o_checkbox').length, 2,
+ assert.strictEqual(form.$('div.o_field_widget div.o_checkbox').length, 2,
"should have fetched and displayed the 2 values of the many2many");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').eq(0).prop('checked'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'),
"first checkbox should be checked");
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').eq(1).prop('checked'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'),
"second checkbox should not be checked");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').prop('disabled'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'),
"the checkboxes should be disabled");
form.$buttons.find('.o_form_button_edit').click();
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').prop('disabled'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').prop('disabled'),
"the checkboxes should not be disabled");
// add a m2m value
- form.$('div.o_form_field div.o_checkbox input').eq(1).click();
+ form.$('div.o_field_widget div.o_checkbox input').eq(1).click();
form.$buttons.find('.o_form_button_save').click();
assert.deepEqual(this.data.partner.records[0].timmy, [12, 14],
"should have added the second element to the many2many");
@@ -4280,13 +4278,13 @@ QUnit.module('relational_fields', {
// remove a m2m value
form.$buttons.find('.o_form_button_edit').click();
- form.$('div.o_form_field div.o_checkbox input').eq(0).click();
+ form.$('div.o_field_widget div.o_checkbox input').eq(0).click();
form.$buttons.find('.o_form_button_save').click();
assert.deepEqual(this.data.partner.records[0].timmy, [14],
"should have removed the first element to the many2many");
- assert.notOk(form.$('div.o_form_field div.o_checkbox input').eq(0).prop('checked'),
+ assert.notOk(form.$('div.o_field_widget div.o_checkbox input').eq(0).prop('checked'),
"first checkbox should be checked");
- assert.ok(form.$('div.o_form_field div.o_checkbox input').eq(1).prop('checked'),
+ assert.ok(form.$('div.o_field_widget div.o_checkbox input').eq(1).prop('checked'),
"second checkbox should not be checked");
form.destroy();
@@ -4334,29 +4332,29 @@ QUnit.module('relational_fields', {
},
});
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload').length, 1,
"there should be the attachment widget");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachments').children().length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachments').children().length, 1,
"there should be no attachment");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').length, 0,
"there should not be an Add button (readonly)");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachment .oe_delete').length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachment .oe_delete').length, 0,
"there should not be a Delete button (readonly)");
// to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').length, 1,
"there should be an Add button");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_attach').text().trim(), "Pictures",
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_attach').text().trim(), "Pictures",
"the button should be correctly named");
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .o_hidden_input_file form').length, 1,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .o_hidden_input_file form').length, 1,
"there should be a hidden form to upload attachments");
// TODO: add an attachment
// no idea how to test this
// delete the attachment
- form.$('div.o_form_field.oe_fileupload .oe_attachment .oe_delete').click();
+ form.$('div.o_field_widget.oe_fileupload .oe_attachment .oe_delete').click();
assert.verifySteps([
@@ -4366,7 +4364,7 @@ QUnit.module('relational_fields', {
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('div.o_form_field.oe_fileupload .oe_attachments').children().length, 0,
+ assert.strictEqual(form.$('div.o_field_widget.oe_fileupload .oe_attachments').children().length, 0,
"there should be no attachment");
form.destroy();
diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js
index 59a27607678..482f3910550 100644
--- a/addons/web/static/tests/views/calendar_tests.js
+++ b/addons/web/static/tests/views/calendar_tests.js
@@ -198,15 +198,15 @@ QUnit.module('Views', {
var $attendeesFilter = $sidebar.find('.o_calendar_filter:has(h3:contains(attendees))');
assert.ok($attendeesFilter.length, "should display 'attendees' filter");
assert.strictEqual($attendeesFilter.find('.o_calendar_filter_item').length, 3, "should display 3 filter items for 'attendees' who use write_model (2 saved + Everything)");
- assert.ok($attendeesFilter.find('.o_form_field_many2one').length, "should display one2many search bar for 'attendees' filter");
+ assert.ok($attendeesFilter.find('.o_field_many2one').length, "should display one2many search bar for 'attendees' filter");
// test search bar in filter
- $sidebar.find('input.o_form_input').trigger('click');
+ $sidebar.find('input[type="text"]').trigger('click');
assert.strictEqual($('ul.ui-autocomplete li:not(.o_m2o_dropdown_option)').length, 2, "should display 2 choices in one2many autocomplete"); // TODO: remove :not(.o_m2o_dropdown_option) because can't have "create & edit" choice
$('ul.ui-autocomplete li:first').trigger('click');
assert.strictEqual($sidebar.find('.o_calendar_filter:has(h3:contains(attendees)) .o_calendar_filter_item').length, 4, "should display 4 filter items for 'attendees'");
- $sidebar.find('input.o_form_input').trigger('click');
+ $sidebar.find('input[type="text"]').trigger('click');
assert.strictEqual($('ul.ui-autocomplete li:not(.o_m2o_dropdown_option)').text(), "partner 4", "should display the last choice in one2many autocomplete"); // TODO: remove :not(.o_m2o_dropdown_option) because can't have "create & edit" choice
$sidebar.find('.o_calendar_filter_item[data-id="1"] .o_remove').trigger('click');
assert.ok($('.modal button.btn:contains(Ok)').length, "should display the confirm message");
@@ -503,28 +503,28 @@ QUnit.module('Views', {
$('.modal input:first').val('new event').trigger('input');
$('.modal button.btn:contains(Edit)').trigger('click');
- assert.strictEqual($('.o_form_field[name="start"] input').val(), "12/13/2016 08:00:00",
+ assert.strictEqual($('.o_field_widget[name="start"] input').val(), "12/13/2016 08:00:00",
"should display the datetime");
$('.modal-lg .o_field_boolean[name="allday"] input').trigger('click');
- assert.strictEqual($('.o_form_field[name="start_date"] input').val(), "12/13/2016",
+ assert.strictEqual($('.o_field_widget[name="start_date"] input').val(), "12/13/2016",
"should display the date");
$('.modal-lg .o_field_boolean[name="allday"] input').trigger('click');
- assert.strictEqual($('.o_form_field[name="start"] input').val(), "12/13/2016 02:00:00",
+ assert.strictEqual($('.o_field_widget[name="start"] input').val(), "12/13/2016 02:00:00",
"should display the datetime from the date with the timezone");
// use datepicker to enter a date: 12/13/2016 08:00:00
- $('.o_form_field[name="start"] input').trigger('click');
+ $('.o_field_widget[name="start"] input').trigger('click');
$('.bootstrap-datetimepicker-widget .picker-switch a[data-action="togglePicker"]').trigger('click');
$('.bootstrap-datetimepicker-widget .timepicker .timepicker-hour').trigger('click');
$('.bootstrap-datetimepicker-widget .timepicker-hours td.hour:contains(08)').trigger('click');
$('.bootstrap-datetimepicker-widget .picker-switch a[data-action="close"]').trigger('click');
// use datepicker to enter a date: 12/13/2016 10:00:00
- $('.o_form_field[name="stop"] input').trigger('click');
+ $('.o_field_widget[name="stop"] input').trigger('click');
$('.bootstrap-datetimepicker-widget .picker-switch a[data-action="togglePicker"]').trigger('click');
$('.bootstrap-datetimepicker-widget .timepicker .timepicker-hour').trigger('click');
$('.bootstrap-datetimepicker-widget .timepicker-hours td.hour:contains(10)').trigger('click');
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js
index f09d98d641e..5e22dad990c 100644
--- a/addons/web/static/tests/views/form_tests.js
+++ b/addons/web/static/tests/views/form_tests.js
@@ -141,7 +141,7 @@ QUnit.module('Views', {
assert.strictEqual(form.$('.o_group .o_group:first').attr('style'), 'background-color: red',
"should apply style attribute on groups");
- assert.strictEqual(form.$('.o_form_field[name=foo]').attr('style'), 'color: blue',
+ assert.strictEqual(form.$('.o_field_widget[name=foo]').attr('style'), 'color: blue',
"should apply style attribute on fields");
assert.strictEqual(form.$('label:contains(something_id)').length, 0,
@@ -226,11 +226,11 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('label.o_form_invisible:contains(Foo)').length, 1,
+ assert.strictEqual(form.$('label.o_invisible_modifier:contains(Foo)').length, 1,
"should not contain label Foo");
- assert.strictEqual(form.$('span.o_form_invisible:contains(yop)').length, 1,
+ assert.strictEqual(form.$('span.o_invisible_modifier:contains(yop)').length, 1,
"should not contain span with field value");
- assert.strictEqual(form.$('.o_form_field.o_form_invisible:contains(0.4)').length, 1,
+ assert.strictEqual(form.$('.o_field_widget.o_invisible_modifier:contains(0.4)').length, 1,
"field qux should be invisible");
form.destroy();
});
@@ -257,9 +257,9 @@ QUnit.module('Views', {
'</form>',
res_id: 1,
});
- assert.strictEqual(form.$('.o_notebook li.o_form_invisible a:contains(invisible)').length, 1,
+ assert.strictEqual(form.$('.o_notebook li.o_invisible_modifier a:contains(invisible)').length, 1,
"should not display tab invisible");
- assert.strictEqual(form.$('table.o_inner_group.o_form_invisible td:contains(invgroup)').length, 1,
+ assert.strictEqual(form.$('table.o_inner_group.o_invisible_modifier td:contains(invgroup)').length, 1,
"should not display invisible groups");
form.destroy();
});
@@ -287,14 +287,14 @@ QUnit.module('Views', {
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.foo_field').hasClass('o_form_invisible'), 'should not display foo field');
- assert.ok(form.$('.bar_field').hasClass('o_form_invisible'), 'should not display bar field');
+ assert.ok(form.$('.foo_field').hasClass('o_invisible_modifier'), 'should not display foo field');
+ assert.ok(form.$('.bar_field').hasClass('o_invisible_modifier'), 'should not display bar field');
// set a value on the m2o
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:first()').click();
- assert.ok(!form.$('.foo_field').hasClass('o_form_invisible'), 'should display foo field');
+ assert.ok(!form.$('.foo_field').hasClass('o_invisible_modifier'), 'should display foo field');
form.destroy();
});
@@ -324,16 +324,16 @@ QUnit.module('Views', {
form.$buttons.find('.o_form_button_edit').click();
assert.ok(form.$('.o_notebook .nav li:first()').hasClass('active'),
'first tab should be active');
- assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('o_form_invisible'),
+ assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'),
'first tab should be visible');
// set a value on the m2o
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
- form.$('.o_form_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
+ form.$('.o_field_many2one input').click();
$dropdown.find('li:first()').click();
assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('active'),
'first tab should not be active');
- assert.ok(form.$('.o_notebook .nav li:first()').hasClass('o_form_invisible'),
+ assert.ok(form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'),
'first tab should be invisible');
assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'),
'second tab should be active');
@@ -365,7 +365,7 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.ok(form.$('.o_notebook .nav li:first()').hasClass('o_form_invisible'),
+ assert.notOk(form.$('.o_notebook .nav li:first()').is(':visible'),
'first tab should be invisible');
assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'),
'second tab should be active');
@@ -452,7 +452,7 @@ QUnit.module('Views', {
assert.strictEqual(form.$('button.oe_stat_button').length, 2,
"should have 2 stat buttons");
- assert.strictEqual(form.$('button.oe_stat_button.o_form_invisible').length, 1,
+ assert.strictEqual(form.$('button.oe_stat_button.o_invisible_modifier').length, 1,
"should have 1 invisible stat buttons");
var count = 0;
@@ -547,29 +547,29 @@ QUnit.module('Views', {
res_id: 2,
});
- assert.strictEqual(form.$('.o_form_field.o_form_field_empty').length, 2,
+ assert.strictEqual(form.$('.o_field_widget.o_field_empty').length, 2,
"should have 2 empty fields with correct class");
assert.strictEqual(form.$('.o_form_label_empty').length, 2,
"should have 2 muted labels (for the empty fieds) in readonly");
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field_empty').length, 1,
- "in edit mode, only empty readonly fields should have the o_form_field_empty class");
+ assert.strictEqual(form.$('.o_field_empty').length, 1,
+ "in edit mode, only empty readonly fields should have the o_field_empty class");
assert.strictEqual(form.$('.o_form_label_empty').length, 1,
"in edit mode, only labels associated to empty readonly fields should have the o_form_label_empty class");
form.$('input[name="foo"]').val("test").trigger("input");
- assert.strictEqual(form.$('.o_form_field_empty').length, 0,
- "after readonly modifier change, the o_form_field_empty class should have been removed");
+ assert.strictEqual(form.$('.o_field_empty').length, 0,
+ "after readonly modifier change, the o_field_empty class should have been removed");
assert.strictEqual(form.$('.o_form_label_empty').length, 0,
"after readonly modifier change, the o_form_label_empty class should have been removed");
form.$('input[name="foo"]').val("hello").trigger("input");
- assert.strictEqual(form.$('.o_form_field_empty').length, 1,
- "after value changed to false for a readonly field, the o_form_field_empty class should have been added");
+ assert.strictEqual(form.$('.o_field_empty').length, 1,
+ "after value changed to false for a readonly field, the o_field_empty class should have been added");
assert.strictEqual(form.$('.o_form_label_empty').length, 1,
"after value changed to false for a readonly field, the o_form_label_empty class should have been added");
@@ -596,7 +596,7 @@ QUnit.module('Views', {
});
assert.strictEqual(form.$('.o_form_label_empty').length, 0,
"no empty class on label");
- assert.strictEqual(form.$('.o_form_field_empty').length, 0,
+ assert.strictEqual(form.$('.o_field_empty').length, 0,
"no empty class on field");
form.destroy();
});
@@ -657,19 +657,19 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input[name="foo"].o_form_required').length, 1,
+ assert.strictEqual(form.$('input[name="foo"].o_required_modifier').length, 1,
"the foo field widget should be required");
form.$('.o_field_boolean input').click();
- assert.strictEqual(form.$('input[name="foo"]:not(.o_form_required)').length, 1,
+ assert.strictEqual(form.$('input[name="foo"]:not(.o_required_modifier)').length, 1,
"the foo field widget should now have been marked as non-required");
form.$('.o_field_boolean input').click();
- assert.strictEqual(form.$('input[name="foo"].o_form_required').length, 1,
+ assert.strictEqual(form.$('input[name="foo"].o_required_modifier').length, 1,
"the foo field widget should now have been marked as required again");
form.destroy();
});
- QUnit.test('required fields should have o_form_required in readonly mode', function (assert) {
+ QUnit.test('required fields should have o_required_modifier in readonly mode', function (assert) {
assert.expect(2);
this.data.partner.fields.foo.required = true;
@@ -687,12 +687,12 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('span.o_form_required').length, 1,
- "should have 1 span with o_form_required class");
+ assert.strictEqual(form.$('span.o_required_modifier').length, 1,
+ "should have 1 span with o_required_modifier class");
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('input.o_form_required').length, 1,
- "in edit mode, should have 1 input with o_form_required");
+ assert.strictEqual(form.$('input.o_required_modifier').length, 1,
+ "in edit mode, should have 1 input with o_required_modifier");
form.destroy();
});
@@ -1186,7 +1186,7 @@ QUnit.module('Views', {
return this._super.apply(this, arguments);
},
}).then(function (form) {
- assert.ok(form.$('.o_form_input').val(), 'aaa',
+ assert.ok(form.$('input').val(), 'aaa',
'default value should be correctly displayed');
assert.strictEqual(nameGetCount, 1, 'should have done one name_get');
form.destroy();
@@ -1464,12 +1464,12 @@ QUnit.module('Views', {
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'yop', 'input should contain yop');
+ assert.strictEqual(form.$('input').val(), 'yop', 'input should contain yop');
// click on discard
form.$buttons.find('.o_form_button_cancel').click();
assert.ok(!$('.modal:visible').length, 'no confirm modal should be displayed');
- assert.strictEqual(form.$('.o_form_field').text(), 'yop', 'field in readonly should display yop');
+ assert.strictEqual(form.$('.o_field_widget').text(), 'yop', 'field in readonly should display yop');
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
form.destroy();
@@ -1495,21 +1495,21 @@ QUnit.module('Views', {
// switch to edit mode and edit the foo field
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'yop', 'input should contain yop');
- form.$('.o_form_input').val('new value').trigger('input');
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should contain new value');
+ assert.strictEqual(form.$('input').val(), 'yop', 'input should contain yop');
+ form.$('input').val('new value').trigger('input');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should contain new value');
// click on discard and cancel the confirm request
form.$buttons.find('.o_form_button_cancel').click();
assert.ok($('.modal').length, 'a confirm modal should be displayed');
$('.modal .modal-footer .btn-default').click(); // click on cancel
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should still contain new value');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should still contain new value');
// click on discard and confirm
form.$buttons.find('.o_form_button_cancel').click();
assert.ok($('.modal').length, 'a confirm modal should be displayed');
$('.modal .modal-footer .btn-primary').click(); // click on confirm
- assert.strictEqual(form.$('.o_form_field').text(), 'yop', 'field in readonly should display yop');
+ assert.strictEqual(form.$('.o_field_widget').text(), 'yop', 'field in readonly should display yop');
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
form.destroy();
@@ -1524,7 +1524,6 @@ QUnit.module('Views', {
// then parsed into string, which is wrong.
this.data.partner.fields.date.default = "2017-01-25";
- var nbWrite = 0;
var form = createView({
View: FormView,
model: 'partner',
@@ -1580,12 +1579,12 @@ QUnit.module('Views', {
// switch to edit mode and edit the p field
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
- form.$('.o_form_field_many2one input').click();
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
+ form.$('.o_field_x2many_list_row_add a').click();
+ form.$('.o_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
$dropdown.find('li:first()').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'xphone', 'input should contain xphone');
+ assert.strictEqual(form.$('input').val(), 'xphone', 'input should contain xphone');
// click on discard and confirm
form.$buttons.find('.o_form_button_cancel').click();
@@ -1615,7 +1614,7 @@ QUnit.module('Views', {
// switch to edit mode and edit the foo field
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'ABC', 'input should contain ABC');
+ assert.strictEqual(form.$('input').val(), 'ABC', 'input should contain ABC');
form.$buttons.find('.o_form_button_cancel').click();
@@ -1647,25 +1646,24 @@ QUnit.module('Views', {
},
});
- // switch to edit mode and edit the foo field
- form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'ABC', 'input should contain ABC');
- form.$('.o_form_input').val('DEF').trigger('input');
+ // edit the foo field
+ assert.strictEqual(form.$('input').val(), 'ABC', 'input should contain ABC');
+ form.$('input').val('DEF').trigger('input');
// discard the changes and check it has properly been discarded
form.$buttons.find('.o_form_button_cancel').click();
assert.strictEqual($('.modal').length, 1,
'there should be a confirm modal');
- assert.strictEqual(form.$('.o_form_input').val(), 'DEF', 'input should be DEF');
+ assert.strictEqual(form.$('input').val(), 'DEF', 'input should be DEF');
$('.modal .modal-footer .btn-primary').click(); // click on confirm
- assert.strictEqual(form.$('.o_form_input').val(), 'ABC', 'input should now be ABC');
+ assert.strictEqual(form.$('input').val(), 'ABC', 'input should now be ABC');
// redirty and discard the field foo (to make sure initial changes haven't been lost)
- form.$('.o_form_input').val('GHI').trigger('input');
+ form.$('input').val('GHI').trigger('input');
form.$buttons.find('.o_form_button_cancel').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'GHI', 'input should be GHI');
+ assert.strictEqual(form.$('input').val(), 'GHI', 'input should be GHI');
$('.modal .modal-footer .btn-primary').click(); // click on confirm
- assert.strictEqual(form.$('.o_form_input').val(), 'ABC', 'input should now be ABC');
+ assert.strictEqual(form.$('input').val(), 'ABC', 'input should now be ABC');
form.destroy();
});
@@ -1694,7 +1692,7 @@ QUnit.module('Views', {
form.sidebar.$('a:contains(Duplicate)').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'tralala', 'input should contain ABC');
+ assert.strictEqual(form.$('input').val(), 'tralala', 'input should contain ABC');
form.$buttons.find('.o_form_button_cancel').click();
@@ -1731,24 +1729,24 @@ QUnit.module('Views', {
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'yop', 'input should contain yop');
+ assert.strictEqual(form.$('input').val(), 'yop', 'input should contain yop');
// edit the foo field
- form.$('.o_form_input').val('new value').trigger('input');
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should contain new value');
+ form.$('input').val('new value').trigger('input');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should contain new value');
// click on the pager to switch to the next record and cancel the confirm request
form.pager.$('.o_pager_next').click(); // click on next
assert.ok($('.modal').length, 'a confirm modal should be displayed');
$('.modal .modal-footer .btn-default').click(); // click on cancel
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should still contain new value');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should still contain new value');
assert.strictEqual(form.pager.$('.o_pager_value').text(), "1", 'pager value should still be 1');
// click on the pager to switch to the next record and confirm
form.pager.$('.o_pager_next').click(); // click on next
assert.ok($('.modal').length, 'a confirm modal should be displayed');
$('.modal .modal-footer .btn-primary').click(); // click on confirm
- assert.strictEqual(form.$('.o_form_input').val(), 'blip', 'input should contain blip');
+ assert.strictEqual(form.$('input').val(), 'blip', 'input should contain blip');
assert.strictEqual(form.pager.$('.o_pager_value').text(), "2", 'pager value should be 2');
assert.strictEqual(nbWrite, 0, 'no write RPC should have been done');
@@ -1776,11 +1774,11 @@ QUnit.module('Views', {
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'yop', 'input should contain yop');
+ assert.strictEqual(form.$('input').val(), 'yop', 'input should contain yop');
// edit the foo field
- form.$('.o_form_input').val('new value').trigger('input');
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should contain new value');
+ form.$('input').val('new value').trigger('input');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should contain new value');
form.$buttons.find('.o_form_button_save').click();
@@ -1803,10 +1801,10 @@ QUnit.module('Views', {
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').val(), 'new value', 'input should contain yop');
+ assert.strictEqual(form.$('input').val(), 'new value', 'input should contain yop');
// edit the foo field
- form.$('.o_form_input').val('wrong value').trigger('input');
+ form.$('input').val('wrong value').trigger('input');
form.$buttons.find('.o_form_button_cancel').click();
assert.strictEqual($('.modal').length, 1, 'a confirm modal should be displayed');
@@ -1976,12 +1974,12 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_empty').length, 1,
+ assert.strictEqual(form.$('.o_field_empty').length, 1,
'readonly field should be invisible on an existing record');
form.$buttons.find('.o_form_button_create').click();
- assert.strictEqual(form.$('.o_form_field_empty').length, 0,
+ assert.strictEqual(form.$('.o_field_empty').length, 0,
'readonly field should be visible on a new record');
form.destroy();
});
@@ -2119,15 +2117,15 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_save').click();
- assert.ok(form.$('label').hasClass('o_form_invalid'),
+ assert.ok(form.$('label').hasClass('o_field_invalid'),
"label should be tagged as invalid");
- assert.ok(form.$('input').hasClass('o_form_invalid'),
+ assert.ok(form.$('input').hasClass('o_field_invalid'),
"input should be tagged as invalid");
form.$('input').val("tralala").trigger('input');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_invalid').length, 0,
+ assert.strictEqual(form.$('.o_field_invalid').length, 0,
"nothing should be marked as invalid");
form.destroy();
});
@@ -2224,12 +2222,12 @@ QUnit.module('Views', {
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input[name=int_field]').val(), '9',
+ assert.strictEqual(form.$('input[name=int_field]').val(), '9',
"'int_field' value should be 9 before the change");
form.$('input').first().val("tralala").trigger('input');
- assert.strictEqual(form.$('.o_form_input[name=int_field]').val(), '10',
+ assert.strictEqual(form.$('input[name=int_field]').val(), '10',
"the onchange should have been correctly applied");
form.destroy();
@@ -2273,7 +2271,7 @@ QUnit.module('Views', {
// go to edit mode, click to add a record in the o2m
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('tr.o_data_row').length, 0,
"should not have added a line");
form.destroy();
@@ -2379,15 +2377,15 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_form_field_one2many .o_data_row').length, 1,
+ assert.strictEqual(form.$('.o_field_one2many .o_data_row').length, 1,
"there should be one one2many record linked at first");
- assert.strictEqual(form.$('.o_form_field_one2many .o_data_row td:first').text(), 'aaa',
+ assert.strictEqual(form.$('.o_field_one2many .o_data_row td:first').text(), 'aaa',
"the 'display_name' of the one2many record should be correct");
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_input').val('let us trigger an onchange').trigger('input');
- var $o2m = form.$('.o_form_field_one2many');
+ form.$('input').val('let us trigger an onchange').trigger('input');
+ var $o2m = form.$('.o_field_one2many');
assert.strictEqual($o2m.find('.o_data_row').length, 2,
"there should be two linked record");
assert.strictEqual($o2m.find('.o_data_row:first td:first').text(), 'updated record',
@@ -2479,13 +2477,13 @@ QUnit.module('Views', {
res_id: 2,
});
- assert.strictEqual(form.$('.o_form_field_many2many .o_data_row').length, 0,
+ assert.strictEqual(form.$('.o_field_many2many .o_data_row').length, 0,
"there should be no many2many record linked at first");
// switch to edit mode
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_input').val('let us trigger an onchange').trigger('input');
- var $m2m = form.$('.o_form_field_many2many');
+ form.$('input').val('let us trigger an onchange').trigger('input');
+ var $m2m = form.$('.o_field_many2many');
assert.strictEqual($m2m.find('.o_data_row').length, 2,
"there should be two linked records");
assert.strictEqual($m2m.find('.o_data_row:first td:first').text(), 'gold',
@@ -2526,24 +2524,24 @@ QUnit.module('Views', {
},
});
- assert.strictEqual(form.$('.o_form_field[name=date]').text(),
+ assert.strictEqual(form.$('.o_field_widget[name=date]').text(),
'01/25/2017', "the initial date should be correct");
- assert.strictEqual(form.$('.o_form_field[name=datetime]').text(),
+ assert.strictEqual(form.$('.o_field_widget[name=datetime]').text(),
'12/12/2016 12:55:05', "the initial datetime should be correct");
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_field[name=date] input').val(),
+ assert.strictEqual(form.$('.o_field_widget[name=date] input').val(),
'01/25/2017', "the initial date should be correct in edit");
- assert.strictEqual(form.$('.o_form_field[name=datetime] input').val(),
+ assert.strictEqual(form.$('.o_field_widget[name=datetime] input').val(),
'12/12/2016 12:55:05', "the initial datetime should be correct in edit");
// trigger the onchange
- form.$('.o_form_field[name="foo"]').val("coucou").trigger('input');
+ form.$('.o_field_widget[name="foo"]').val("coucou").trigger('input');
- assert.strictEqual(form.$('.o_form_field[name=date] input').val(),
+ assert.strictEqual(form.$('.o_field_widget[name=date] input').val(),
'12/12/2021', "the initial date should be correct in edit");
- assert.strictEqual(form.$('.o_form_field[name=datetime] input').val(),
+ assert.strictEqual(form.$('.o_field_widget[name=datetime] input').val(),
'12/12/2021 12:55:05', "the initial datetime should be correct in edit");
form.destroy();
@@ -2653,7 +2651,7 @@ QUnit.module('Views', {
// save, and check that the int_field input is marked as invalid
form.$buttons.find('.o_form_button_save').click();
- assert.ok(form.$('input[name="int_field"]').hasClass('o_form_invalid'),
+ assert.ok(form.$('input[name="int_field"]').hasClass('o_field_invalid'),
"input int_field is marked as invalid");
assert.verifySteps(['read', 'onchange']);
@@ -2769,7 +2767,7 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_input:first').val('trigger an onchange').trigger('input');
+ form.$('input:first').val('trigger an onchange').trigger('input');
form.destroy();
});
@@ -2830,7 +2828,7 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_input:first').val('trigger an onchange').trigger('input');
+ form.$('input:first').val('trigger an onchange').trigger('input');
assert.strictEqual(form.$('.o_data_row td:first').text(), 'foo changed',
"onchange should have been correctly applied on field in o2m list");
@@ -2890,13 +2888,13 @@ QUnit.module('Views', {
assert.strictEqual(form.$('.o_data_row td:first').text(), 'My little Foo Value',
"the initial value should be the default one");
- form.$('.o_form_input:first').val('trigger an onchange').trigger('input');
+ form.$('input:first').val('trigger an onchange').trigger('input');
assert.strictEqual(form.$('.o_data_row td:first').text(), 'foo changed',
"onchange should have been correctly applied on field in o2m list");
form.$('.o_data_row').click(); // edit the o2m in the dialog
- assert.strictEqual($('.modal .o_form_field').val(), 'foo changed',
+ assert.strictEqual($('.modal .o_field_widget').val(), 'foo changed',
"the onchange value hasn't been discarded when opening the o2m");
form.destroy();
@@ -2943,7 +2941,7 @@ QUnit.module('Views', {
"onchange should have been correctly applied");
// create a new o2m record
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
assert.strictEqual(form.$('.o_data_row input:first').val(), '[blip] 14',
"onchange should have been correctly applied after default get");
@@ -2988,16 +2986,16 @@ QUnit.module('Views', {
"the initial value should be the default one");
form.$('.o_data_row td:first').click(); // edit the o2m in a dialog
- $('.modal .o_form_input:nth(1)').val(77).trigger('input');
- assert.strictEqual($('.modal .o_form_input:first').val(), '[blip] 77',
+ $('.modal input:nth(1)').val(77).trigger('input');
+ assert.strictEqual($('.modal input:first').val(), '[blip] 77',
"onchange should have been correctly applied");
$('.modal .modal-footer .btn-primary').click(); // save the dialog
assert.strictEqual(form.$('.o_data_row td:first').text(), '[blip] 77',
"onchange should have been correctly applied");
// create a new o2m record
- form.$('.o_form_field_x2many_list_row_add a').click();
- assert.strictEqual($('.modal .o_form_input:first').val(), '[blip] 14',
+ form.$('.o_field_x2many_list_row_add a').click();
+ assert.strictEqual($('.modal input:first').val(), '[blip] 14',
"onchange should have been correctly applied after default get");
$('.modal .modal-footer .btn-primary').click(); // save the dialog
assert.strictEqual(form.$('.o_data_row:nth(1) td:first').text(), '[blip] 14',
@@ -3035,7 +3033,7 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_input:first').val('coucou').trigger('input');
+ form.$('input:first').val('coucou').trigger('input');
form.destroy();
});
@@ -3260,10 +3258,10 @@ QUnit.module('Views', {
});
// add a o2m subrecord with a m2m tag
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.$('.o_many2many_tags_cell').click();
- form.$('.o_form_field_many2one input').click();
- var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget');
+ form.$('.o_field_many2one input').click();
+ var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
$dropdown.find('li:first()').click(); // select the first tag
form.$buttons.find('.o_form_button_save').click();
@@ -3345,13 +3343,13 @@ QUnit.module('Views', {
// could be saved, even if in its field description it is readonly
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input').length, 1,
+ assert.strictEqual(form.$('input[name="foo"]').length, 1,
"foo field should be editable");
- form.$('.o_form_input').val('New foo value').trigger('input');
+ form.$('input[name="foo"]').val('New foo value').trigger('input');
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_form_field[name=foo]').text(), 'New foo value',
+ assert.strictEqual(form.$('.o_field_widget[name=foo]').text(), 'New foo value',
"new value for foo field should have been saved");
form.destroy();
@@ -3388,7 +3386,7 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- form.$('.o_form_field_x2many_list_row_add a').click();
+ form.$('.o_field_x2many_list_row_add a').click();
form.destroy();
});
@@ -3428,7 +3426,7 @@ QUnit.module('Views', {
form.destroy();
function getVisibleButtonTexts() {
- var $visibleButtons = form.$buttons.find('button').not('.o_form_invisible *');
+ var $visibleButtons = form.$buttons.find('button:visible');
return _.map($visibleButtons, function (el) {
return el.innerHTML.trim();
});
@@ -3525,11 +3523,11 @@ QUnit.module('Views', {
return this._super.apply(this, arguments);
},
});
- var row = form.$('.o_form_field_one2many .o_list_view .o_data_row');
+ var row = form.$('.o_field_one2many .o_list_view .o_data_row');
assert.strictEqual(row.children()[1].textContent, '1 record',
"the cell should contains the number of record: 1");
row.click();
- var modal_row = $('.modal-body .o_form_sheet .o_form_field_one2many .o_list_view .o_data_row');
+ var modal_row = $('.modal-body .o_form_sheet .o_field_one2many .o_list_view .o_data_row');
assert.strictEqual(modal_row.children().length, 2,
"the row should contains the 2 fields defined in the form view");
assert.strictEqual($(modal_row).text(), "gold2",
@@ -3554,9 +3552,9 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input[name="foo"]')[0], document.activeElement,
+ assert.strictEqual(form.$('input[name="foo"]')[0], document.activeElement,
"foo field should have focus");
- assert.strictEqual(form.$('.o_form_input[name="foo"]')[0].selectionStart, 3,
+ assert.strictEqual(form.$('input[name="foo"]')[0].selectionStart, 3,
"cursor should be at the end");
form.destroy();
@@ -3576,7 +3574,7 @@ QUnit.module('Views', {
res_id: 1,
});
form.$buttons.find('.o_form_button_edit').click();
- assert.strictEqual(form.$('.o_form_input[name="foo"]')[0], document.activeElement,
+ assert.strictEqual(form.$('input[name="foo"]')[0], document.activeElement,
"foo field should have focus");
form.destroy();
@@ -3646,7 +3644,7 @@ QUnit.module('Views', {
return this._super.apply(this, arguments);
},
});
- var row = form.$('.o_form_field_one2many .o_list_view .o_data_row');
+ var row = form.$('.o_field_one2many .o_list_view .o_data_row');
row.click();
assert.verifySteps(['read', 'read', 'read'],
"there should be 3 read rpcs");
@@ -3809,16 +3807,16 @@ QUnit.module('Views', {
assert.strictEqual($('.modal').length, 1,
"One FormViewDialog should be opened");
var $firstModal = $('.modal');
- assert.strictEqual($firstModal.find('.o_form_input').val(), 'xphone',
+ assert.strictEqual($firstModal.find('input').val(), 'xphone',
"display_name should be correctly displayed");
// Open second dialog
- $firstModal.find('.o_form_field_x2many_list_row_add a').click();
+ $firstModal.find('.o_field_x2many_list_row_add a').click();
assert.strictEqual($('.modal').length, 2,
"two FormViewDialogs should be opened");
var $secondModal = $('.modal:nth(1)');
// Add new value
- $secondModal.find('.o_form_input').val('xtv').trigger('input');
+ $secondModal.find('input').val('xtv').trigger('input');
$secondModal.find('.modal-footer button:first').click(); // Save & close
assert.strictEqual($('.modal').length, 1,
"last opened dialog should be closed");
@@ -3858,7 +3856,7 @@ QUnit.module('Views', {
},
});
- form.$('.o_form_input:first').click(); // trigger the name_search
+ form.$('input:first').click(); // trigger the name_search
form.destroy();
});
@@ -3889,21 +3887,21 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_form_invisible)').length, 2,
+ assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2,
"both tabs should be visible");
assert.ok(form.$('.o_notebook ul li:first').hasClass('active'),
"first tab should be active");
// click on the pager to switch to the next record
form.pager.$('.o_pager_next').click();
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_form_invisible)').length, 1,
+ assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 1,
"only the second tab should be visible");
- assert.ok(form.$('.o_notebook ul li:not(.o_form_invisible)').hasClass('active'),
+ assert.ok(form.$('.o_notebook ul li:not(.o_invisible_modifier)').hasClass('active'),
"the visible tab should be active");
// click on the pager to switch back to the previous record
form.pager.$('.o_pager_previous').click();
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_form_invisible)').length, 2,
+ assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2,
"both tabs should be visible again");
assert.ok(form.$('.o_notebook ul li:nth(1)').hasClass('active'),
"second tab should be active");
@@ -4013,7 +4011,7 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.ok(form.$('.o_form_field_one2many tbody tr:first td:contains(yop)').length,
+ assert.ok(form.$('.o_field_one2many tbody tr:first td:contains(yop)').length,
"record 1 should be first");
form.destroy();
diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js
index e06adb394a2..debb65b60ff 100644
--- a/addons/web/static/tests/views/kanban_tests.js
+++ b/addons/web/static/tests/views/kanban_tests.js
@@ -403,11 +403,11 @@ QUnit.module('Views', {
assert.strictEqual($('.modal .o_form_view.o_form_editable').length, 1,
"a form view dialog should have been opened (in edit)");
- assert.strictEqual($('.modal .o_form_field_many2one input').val(), 'hello',
+ assert.strictEqual($('.modal .o_field_many2one input').val(), 'hello',
"the correct product_id should already be set");
// specify a name and save
- $('.modal .o_form_input[name=foo]').val('test').trigger('input');
+ $('.modal input[name=foo]').val('test').trigger('input');
$('.modal-footer .btn-primary').click();
assert.strictEqual($('.modal').length, 0, "the modal should be closed");
@@ -445,7 +445,7 @@ QUnit.module('Views', {
});
var $first_record = kanban.$('.o_kanban_record:first()');
- assert.strictEqual($first_record.find('.o_form_field_many2manytags .o_tag').length, 2,
+ assert.strictEqual($first_record.find('.o_field_many2manytags .o_tag').length, 2,
'first record should contain 2 tags');
assert.ok($first_record.find('.o_tag:first()').hasClass('o_tag_color_2'),
'first tag should have color 2');
@@ -751,9 +751,9 @@ QUnit.module('Views', {
// edit the title of column [5, 'xmo'] and close without saving
kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit'
assert.ok($('.modal .o_form_editable').length, 'a form view should be open in a modal');
- assert.strictEqual($('.modal .o_form_editable .o_form_input').val(), 'xmo',
+ assert.strictEqual($('.modal .o_form_editable input').val(), 'xmo',
'the name should be "xmo"');
- $('.modal .o_form_editable .o_form_input').val('ged').trigger('input'); // change the value
+ $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value
nbRPCs = 0;
$('.modal .modal-header .close').click(); // click on the cross to close the modal
assert.ok(!$('.modal').length, 'the modal should be closed');
@@ -763,7 +763,7 @@ QUnit.module('Views', {
// edit the title of column [5, 'xmo'] and discard
kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit'
- $('.modal .o_form_editable .o_form_input').val('ged').trigger('input'); // change the value
+ $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value
nbRPCs = 0;
$('.modal .modal-footer .btn-default').click(); // click on discard
assert.ok(!$('.modal').length, 'the modal should be closed');
@@ -773,7 +773,7 @@ QUnit.module('Views', {
// edit the title of column [5, 'xmo'] and save
kanban.$('.o_kanban_group[data-id=5] .o_column_edit').click(); // click on 'Edit'
- $('.modal .o_form_editable .o_form_input').val('ged').trigger('input'); // change the value
+ $('.modal .o_form_editable input').val('ged').trigger('input'); // change the value
nbRPCs = 0;
$('.modal .modal-footer .btn-primary').click(); // click on save
assert.ok(!$('.modal').length, 'the modal should be closed');
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index beb3b1843b1..2ec0e2ccbb4 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -302,17 +302,17 @@ QUnit.module('Views', {
$td.click();
assert.ok($td.parent().hasClass('o_selected_row'),
"row should be in edit mode");
- assert.ok($td.hasClass('o_readonly'),
+ assert.ok($td.hasClass('o_readonly_modifier'),
"foo cell should be readonly in edit mode");
- assert.ok(!$second_td.hasClass('o_readonly'),
+ assert.ok(!$second_td.hasClass('o_readonly_modifier'),
"bar cell should be editable");
- assert.ok($third_td.hasClass('o_readonly'),
+ assert.ok($third_td.hasClass('o_readonly_modifier'),
"int_field cell should be readonly in edit mode");
list.destroy();
});
QUnit.test('basic operations for editable list renderer', function (assert) {
- assert.expect(4);
+ assert.expect(2);
var list = createView({
View: ListView,
@@ -325,9 +325,6 @@ QUnit.module('Views', {
assert.ok(!$td.parent().hasClass('o_selected_row'), "td should not be in edit mode");
$td.click();
assert.ok($td.parent().hasClass('o_selected_row'), "td should be in edit mode");
- assert.ok(!$td.hasClass('o_field_dirty'), "td should not be dirty");
- $td.find('input').val('abc').trigger('input');
- assert.ok($td.hasClass('o_field_dirty'), "td should be dirty");
list.destroy();
});
@@ -1085,9 +1082,9 @@ QUnit.module('Views', {
// edit first row
list.$('tbody tr:nth(0) td:nth(2)').click(); // click on first row to edit it
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(4) input.o_form_invisible').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(4) input.o_invisible_modifier').length, 1,
"td that contains an invisible field should not be empty in edition");
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > button.o_form_invisible').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > button.o_invisible_modifier').length, 1,
"td that contains an invisible button should not be empty in edition");
list.$buttons.find('.o_list_button_discard').click(); // leave edition
@@ -1161,16 +1158,16 @@ QUnit.module('Views', {
arch: '<tree editable="bottom"><field name="foo"/><field name="int_field"/></tree>',
});
- assert.ok(list.$('.o_data_row:first td:nth(1)').hasClass('o_readonly'),
- "foo field cells should have class 'o_readonly'");
+ assert.ok(list.$('.o_data_row:first td:nth(1)').hasClass('o_readonly_modifier'),
+ "foo field cells should have class 'o_readonly_modifier'");
// edit the first row
list.$('.o_data_row:first td:nth(1)').click();
assert.ok(list.$('.o_data_row:first').hasClass('o_selected_row'),
"first row should be selected");
var $cell = list.$('.o_data_row:first td:nth(1)');
- assert.ok($cell.hasClass('o_readonly') && $cell.parent().hasClass('o_selected_row'),
- "foo field cells should have class 'o_readonly' and the row should be in edition");
+ assert.ok($cell.hasClass('o_readonly_modifier') && $cell.parent().hasClass('o_selected_row'),
+ "foo field cells should have class 'o_readonly_modifier' and the row should be in edition");
assert.strictEqual(list.$('.o_data_row:first td:nth(1) span').text(), 'yop',
"a widget should have been rendered for readonly fields");
assert.ok(list.$('.o_data_row:first td:nth(2)').parent().hasClass('o_selected_row'),
@@ -1415,32 +1412,32 @@ QUnit.module('Views', {
'</tree>',
});
- assert.strictEqual(list.$('tbody td.o_form_invisible').length, 3,
+ assert.strictEqual(list.$('tbody td.o_invisible_modifier').length, 3,
"there should be 3 invisible foo cells in readonly mode");
// Make first line editable
list.$('tbody tr:nth(0) td:nth(1)').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_form_invisible').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_invisible_modifier').length, 1,
"the foo field widget should have been rendered as invisible");
list.$('tbody tr:nth(0) td:nth(2) input').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"]:not(.o_form_invisible)').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"]:not(.o_invisible_modifier)').length, 1,
"the foo field widget should have been marked as non-invisible");
- assert.strictEqual(list.$('tbody td.o_form_invisible').length, 2,
+ assert.strictEqual(list.$('tbody td.o_invisible_modifier').length, 2,
"the foo field widget parent cell should not be invisible anymore");
list.$('tbody tr:nth(0) td:nth(2) input').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_form_invisible').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_invisible_modifier').length, 1,
"the foo field widget should have been marked as invisible again");
- assert.strictEqual(list.$('tbody td.o_form_invisible').length, 3,
+ assert.strictEqual(list.$('tbody td.o_invisible_modifier').length, 3,
"the foo field widget parent cell should now be invisible again");
// Reswitch the cell to editable and save the row
list.$('tbody tr:nth(0) td:nth(2) input').click();
list.$('thead').click();
- assert.strictEqual(list.$('tbody td.o_form_invisible').length, 2,
+ assert.strictEqual(list.$('tbody td.o_invisible_modifier').length, 2,
"there should be 2 invisible foo cells in readonly mode");
list.destroy();
@@ -1460,7 +1457,7 @@ QUnit.module('Views', {
'</tree>',
});
- assert.strictEqual(list.$('tbody td.o_readonly').length, 3,
+ assert.strictEqual(list.$('tbody td.o_readonly_modifier').length, 3,
"there should be 3 readonly foo cells in readonly mode");
// Make first line editable
@@ -1472,20 +1469,20 @@ QUnit.module('Views', {
list.$('tbody tr:nth(0) td:nth(2) input').click();
assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"]').length, 1,
"the foo field widget should have been rerendered as editable");
- assert.strictEqual(list.$('tbody td.o_readonly').length, 2,
+ assert.strictEqual(list.$('tbody td.o_readonly_modifier').length, 2,
"the foo field widget parent cell should not be readonly anymore");
list.$('tbody tr:nth(0) td:nth(2) input').click();
assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > span[name="foo"]').length, 1,
"the foo field widget should have been rerendered as readonly");
- assert.strictEqual(list.$('tbody td.o_readonly').length, 3,
+ assert.strictEqual(list.$('tbody td.o_readonly_modifier').length, 3,
"the foo field widget parent cell should now be readonly again");
// Reswitch the cell to editable and save the row
list.$('tbody tr:nth(0) td:nth(2) input').click();
list.$('thead').click();
- assert.strictEqual(list.$('tbody td.o_readonly').length, 2,
+ assert.strictEqual(list.$('tbody td.o_readonly_modifier').length, 2,
"there should be 2 readonly foo cells in readonly mode");
list.destroy();
@@ -1505,32 +1502,32 @@ QUnit.module('Views', {
'</tree>',
});
- assert.strictEqual(list.$('tbody td.o_form_required').length, 3,
+ assert.strictEqual(list.$('tbody td.o_required_modifier').length, 3,
"there should be 3 required foo cells in readonly mode");
// Make first line editable
list.$('tbody tr:nth(0) td:nth(1)').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_form_required').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_required_modifier').length, 1,
"the foo field widget should have been rendered as required");
list.$('tbody tr:nth(0) td:nth(2) input').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"]:not(.o_form_required)').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"]:not(.o_required_modifier)').length, 1,
"the foo field widget should have been marked as non-required");
- assert.strictEqual(list.$('tbody td.o_form_required').length, 2,
+ assert.strictEqual(list.$('tbody td.o_required_modifier').length, 2,
"the foo field widget parent cell should not be required anymore");
list.$('tbody tr:nth(0) td:nth(2) input').click();
- assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_form_required').length, 1,
+ assert.strictEqual(list.$('tbody tr:nth(0) td:nth(1) > input[name="foo"].o_required_modifier').length, 1,
"the foo field widget should have been marked as required again");
- assert.strictEqual(list.$('tbody td.o_form_required').length, 3,
+ assert.strictEqual(list.$('tbody td.o_required_modifier').length, 3,
"the foo field widget parent cell should now be required again");
// Reswitch the cell to editable and save the row
list.$('tbody tr:nth(0) td:nth(2) input').click();
list.$('thead').click();
- assert.strictEqual(list.$('tbody td.o_form_required').length, 2,
+ assert.strictEqual(list.$('tbody td.o_required_modifier').length, 2,
"there should be 2 required foo cells in readonly mode");
list.destroy();
@@ -1571,7 +1568,7 @@ QUnit.module('Views', {
"first line should still be in edition as invalid");
assert.strictEqual(list.$('tbody tr.o_selected_row').length, 1,
"no other line should be in edition");
- assert.strictEqual($firstFooTd.find('input.o_form_invalid').length, 1,
+ assert.strictEqual($firstFooTd.find('input.o_field_invalid').length, 1,
"the required field should be marked as invalid");
assert.strictEqual(warnings, 1,
"a warning should have been displayed");