summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields
diff options
context:
space:
mode:
authorPierre Paridans <app@odoo.com>2019-08-22 09:25:18 +0000
committerPierre Paridans <app@odoo.com>2019-08-26 14:13:06 +0000
commit96a52daa80b18d129bd9dbf332c1dd52d062629a (patch)
treeefdfb08dbd82a1e1c590cc9ff4daea2b6bd8fd6d /addons/web/static/tests/fields/relational_fields
parent0a540e0ef25a439e29a762de5b35a2c6a63ad7f7 (diff)
[REF] web: remove test coverage overlap in mobile test suite
The tests in the file `relational_fields_mobile_tests.js` - which is part of the mobile test suite - are actually not specific to mobile. This commit merges those tests asserts into the tests already present in the regular test suite. It ensures that all the existing asserts remains and the actual coverage stays the same.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields')
-rw-r--r--addons/web/static/tests/fields/relational_fields/field_many2many_tests.js3
-rw-r--r--addons/web/static/tests/fields/relational_fields/field_one2many_tests.js22
2 files changed, 23 insertions, 2 deletions
diff --git a/addons/web/static/tests/fields/relational_fields/field_many2many_tests.js b/addons/web/static/tests/fields/relational_fields/field_many2many_tests.js
index ab80fd59983..db0fb3632d3 100644
--- a/addons/web/static/tests/fields/relational_fields/field_many2many_tests.js
+++ b/addons/web/static/tests/fields/relational_fields/field_many2many_tests.js
@@ -116,7 +116,7 @@ QUnit.module('fields', {}, function () {
QUnit.module('FieldMany2Many');
QUnit.test('many2many kanban: edition', async function (assert) {
- assert.expect(32);
+ assert.expect(33);
this.data.partner.records[0].timmy = [12, 14];
this.data.partner_type.records.push({ id: 15, display_name: "red", color: 6 });
@@ -250,6 +250,7 @@ QUnit.module('fields', {}, function () {
assert.strictEqual($('.modal .modal-footer .o_btn_remove').length, 1,
'There should be a modal having Remove Button');
await testUtils.dom.click($('.modal .modal-footer .o_btn_remove'));
+ assert.containsNone($('.o_modal'), "modal should have been closed");
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 5,
'should contain 5 records');
assert.ok(!form.$('.o_kanban_record:contains(silver)').length,
diff --git a/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js b/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js
index d9bb4a9624b..35b4be9f25e 100644
--- a/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js
+++ b/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js
@@ -2255,7 +2255,7 @@ QUnit.module('fields', {}, function () {
});
QUnit.test('one2many kanban: edition', async function (assert) {
- assert.expect(17);
+ assert.expect(23);
this.data.partner.records[0].p = [2];
var form = await createView({
@@ -2286,6 +2286,22 @@ QUnit.module('fields', {}, function () {
'</field>' +
'</form>',
res_id: 1,
+ mockRPC: function (route, args) {
+ if (route === '/web/dataset/call_kw/partner/write') {
+ var commands = args.args[1].p;
+ assert.strictEqual(commands.length, 2,
+ 'should have generated two commands');
+ assert.strictEqual(commands[0][0], 0,
+ 'generated command should be ADD WITH VALUES');
+ assert.strictEqual(commands[0][2].display_name, "new subrecord 3",
+ 'value of newly created subrecord should be "new subrecord 3"');
+ assert.strictEqual(commands[1][0], 2,
+ 'generated command should be REMOVE AND DELETE');
+ assert.strictEqual(commands[1][1], 2,
+ 'deleted record id should be 2');
+ }
+ return this._super.apply(this, arguments);
+ },
});
assert.ok(!form.$('.o_kanban_view .delete_icon').length,
@@ -2341,6 +2357,7 @@ QUnit.module('fields', {}, function () {
assert.strictEqual($('.modal .modal-footer .o_btn_remove').length, 1,
'There should be a modal having Remove Button');
await testUtils.dom.click($('.modal .modal-footer .o_btn_remove'));
+ assert.containsNone($('.o_modal'), "modal should have been closed");
assert.strictEqual(form.$('.o_kanban_record:not(.o_kanban_ghost)').length, 3,
'should contain 3 records');
await testUtils.dom.click(form.$('.o_kanban_view .delete_icon:first()'));
@@ -2349,6 +2366,9 @@ QUnit.module('fields', {}, function () {
'should contain 1 records');
assert.strictEqual(form.$('.o_kanban_record span:first').text(), 'new subrecord 3',
'the remaining subrecord should be "new subrecord 3"');
+
+ // save and check that the correct command has been generated
+ await testUtils.form.clickSave(form);
form.destroy();
});